summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.cxx168
-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.cxx156
-rw-r--r--drawinglayer/source/processor2d/canvasprocessor.cxx1144
-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.cxx1806
-rw-r--r--svx/source/engine3d/cube3d.cxx185
-rw-r--r--svx/source/engine3d/deflt3d.cxx6
-rw-r--r--svx/source/engine3d/dragmt3d.cxx626
-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.cxx467
-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.cxx252
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx76
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx75
-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, 6378 insertions, 8293 deletions
diff --git a/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx
index f441e8047193..392f1b0a9113 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 d38250e7bf47..94a5623a2a77 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 6a6cb5d767e5..605c26733cf3 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 03f7487c1aa7..41ae18b30fc9 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 c17ca34d733a..f5a851b0b053 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 000000000000..28029f223b1b
--- /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 b79f8381c695..0c356e731169 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 fb9bf24bdb2e..82c65e249c2e 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 373bf575f916..3e3055d73cfb 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 a52a81e418e4..bc3e8f3b317b 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 52fdf12cf3bc..372de9936935 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 61ceddc8396a..a47384485ee7 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 70b965e32d67..13f1f699f1ab 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 3b1fd70a6964..6241eeb2fa73 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 6246bfb07b87..edb8752d57ba 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 e994357b5724..8725323c6bf5 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 000000000000..50616ab1548b
--- /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 325155995acf..fb160fb9bfa7 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 af91a74f6591..341d2907a53d 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(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(bObjectSpecificX || bObjectSpecificY)
+ 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);
- }
+ basegfx::B2DPoint aPoint(aTmpPoly.getTextureCoordinate(b));
- if(bObjectSpecificY)
- {
- aPoint.setY((2L == b || 3L == b) ? 1.0 : 0.0);
- }
+ if(bObjectSpecificX)
+ {
+ aPoint.setX((1L == b || 2L == b) ? 1.0 : 0.0);
+ }
- aTmpPoly.setTextureCoordinate(b, aPoint);
+ if(bObjectSpecificY)
+ {
+ 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 e7d170b967e5..a83147da5022 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 b04c90e07336..f51aa3a85e24 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 639635970c87..e27b8b43fe93 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 74a5713b69e8..e7149c611dd9 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());
+ double fRelativeAngle(0.0);
- if(bParallelX || bParallelY)
+ 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 394f86299b2b..0fe629545900 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,7 +1985,7 @@ namespace drawinglayer
updateViewInformation(aLastViewInformation2D);
// restore at canvas
- canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getObjectToViewTransformation());
+ canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation());
break;
}
@@ -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();
-
- 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();
-
- if(rAlpha.hasElements() && 1 == rAlpha.getLength())
- {
- const primitive2d::Primitive2DReference xReference(rAlpha[0]);
- pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get());
+ impRenderAlphaPrimitive2D(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate));
- if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitiveID())
- {
- bIsSimpleTransparence = true;
- }
- }
-
- 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);
- }
- }
+ break;
+ }
+ case PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D:
+ {
+ // PolygonStrokePrimitive
+ impRenderPolygonStrokePrimitive2D(static_cast< const primitive2d::PolygonStrokePrimitive2D& >(rCandidate));
- // restore old canvas and ViewInformation
- mxCanvas = xLastCanvas;
- updateViewInformation(aLastViewInformation2D);
- canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getObjectToViewTransformation());
+ break;
+ }
+ case PRIMITIVE2D_ID_FILLBITMAPPRIMITIVE2D :
+ {
+ // FillBitmapPrimitive2D
+ impRenderFillBitmapPrimitive2D(static_cast< const primitive2d::FillBitmapPrimitive2D& >(rCandidate));
- // 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;
+ break;
+ }
+ case PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D :
+ {
+ // UnifiedAlphaPrimitive2D
+ impRenderUnifiedAlphaPrimitive2D(static_cast< const primitive2d::UnifiedAlphaPrimitive2D& >(rCandidate));
- // 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());
+ 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);
- // 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(!renderChartPrimitive2D(rChartPrimitive, *mpOutputDevice))
+ {
+ // fallback to decomposition (MetaFile)
+ process(rChartPrimitive.get2DDecomposition(getViewInformation2D()));
+ }
- 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);
- }
- }
+ 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 000000000000..c2d99604469b
--- /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 000000000000..de13431c79c0
--- /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 000000000000..f832698b18f2
--- /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 000000000000..6d9938a72f4e
--- /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 1ca3aad2e494..38dcb42cd4a0 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 f4e74a949b3a..63ee8108c35c 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 7c2717c9b1e7..f987585249ad 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 d8857b4bedaf..25d7513006fa 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 ed769b95b4d0..077670481c96 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 000013fa1898..3b3a0f19f612 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 817159985f5a..69368fbba2d5 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 5abf576f9ce3..54485f9e05c7 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 230a634086f1..3985ab6ca594 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 ed86e3fd234d..4c67a969e925 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 906d73e7fdeb..e8993b6d7fba 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 a031737415e6..ca2c3ac1e4f7 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 000000000000..a68a8e66e43e
--- /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 60fca293df83..ee0c38af9fdd 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 13eef494afc2..889701764413 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 000000000000..0364fd6622fc
--- /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 9d831462bb0b..a0474fef522d 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 88a13b642f37..4a21b7fad652 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 850d8b588149..5bc9f9b8fb15 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 b295c93d743b..718225aa990b 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 461833b38bc1..831a359d9c9f 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 fb06490acbb7..415526b07d77 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 0d98bc18adbb..2664278749af 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 557ec28e75db..79e610c3bc21 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 72ad1f0fa06a..6ea75e3cfa28 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 7ed2452f0e6c..c190d78b7890 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 4ea478db0b68..a29ecb890df6 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 64cb90f3f9c1..2f4702e62b07 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 e4bfa7333f47..10b35c4dd027 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 71183e8969be..e84263128482 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 2739118bbfc1..9c11b6537354 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 125fc108f2b3..3662f8c67c3f 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 aaa439f79392..87149cb1685d 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 35ea8a6a6712..ddd90736e82b 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 bf781d970849..abcc0d90e425 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 a7e6e904a97d..74de1262e44f 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 992edae87f4f..7ac03774adb6 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 514a8f4afe24..6787969a83b4 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 41f49fdeced9..967bc9ec1b8a 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 4e1563c6966b..79746d6a7bbe 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 bbbebc8dd711..afc25021b081 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 e30a90d57019..05f288daf1ed 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 82f5b4cda346..2b883465a635 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 8477bf4ec9af..b8282a706d81 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 f9da7f30a1ba..a77a9c3f8459 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 be1409d0db2b..bd6f2f5310ef 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 21ee6b06a1e8..6fa2ee7211e5 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 fb4fa6b2eaf3..80f230721dbb 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 919e3150a495..26d71d0a87bd 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 5c553d16387a..adf5563680f2 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 0ef8894b082a..8123a353bc63 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 )
+//////////////////////////////////////////////////////////////////////////////
+
+#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()
{
- 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();
+ // 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);
}
-}
-
-/*************************************************************************
-|*
-|* 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)
-{
- // 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);
+ // 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);
}
- 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 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::SetRotation(double fRotX, double fRotY, double fRotZ)
-{
- if(fRotX != fRotateX || fRotY != fRotateY || fRotZ != fRotateZ)
{
- fRotateX = fRotX;
- fRotateY = fRotY;
- fRotateZ = fRotZ;
- CreateGeometry();
+ // 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);
}
- Invalidate();
-}
-void SvxPreviewCtl3D::GetRotation(double& rRotX, double& rRotY, double& rRotZ)
-{
- rRotX = fRotateX;
- rRotY = fRotateY;
- rRotZ = fRotateZ;
+ // invalidate SnapRects of objects
+ mpScene->SetRectsDirty();
}
-// Zugriffsfunktionen Materialien
-void SvxPreviewCtl3D::SetMaterial(Color rNew, Base3DMaterialValue eVal)
+void Svx3DLightControl::ConstructLightObjects()
{
- if(aObjectMaterial.GetMaterial(eVal) != rNew)
+ for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
{
- 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();
- }
-}
-
-UINT16 SvxPreviewCtl3D::GetShininess()
-{
- return aObjectMaterial.GetShininess();
-}
-
-// Lichtquellen setzen
-void SvxPreviewCtl3D::SetLightGroup(B3dLightGroup* pNew)
-{
- if(pNew)
- {
- 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);
+ 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;
+ }
}
}
-/*************************************************************************
-|*
-|* 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)
+void Svx3DLightControl::AdaptToSelectedLight()
{
- if(eNew != eSelectedLight)
+ if(NO_LIGHT_SELECTED == maSelectedLight)
{
- eSelectedLight = eNew;
- bGeometrySelected = FALSE;
- 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::SelectGeometry()
-{
- if(!bGeometrySelected)
+ else
{
- bGeometrySelected = TRUE;
- eSelectedLight = Base3DLightNone;
- Invalidate();
- }
-}
+ basegfx::B3DVector aDirection(GetLightDirection(maSelectedLight));
+ aDirection.normalize();
-void SvxLightPrevievCtl3D::SetObjectRadius(double fNew)
-{
- if(fObjectRadius != fNew)
- {
- fObjectRadius = fNew;
- Invalidate();
- }
-}
+ // 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);
-void SvxLightPrevievCtl3D::SetDistanceToObject(double fNew)
-{
- if(fDistanceToObject != fNew)
- {
- fDistanceToObject = fNew;
- Invalidate();
- }
-}
+ // adapt transformation of mpLampShaftObject
+ basegfx::B3DHomMatrix aTransform;
+ double fRotateY(0.0);
-void SvxLightPrevievCtl3D::SetScaleSizeSelected(double fNew)
-{
- if(fScaleSizeSelected != fNew)
- {
- fScaleSizeSelected = fNew;
- Invalidate();
- }
-}
+ if(!basegfx::fTools::equalZero(aDirection.getZ()) || !basegfx::fTools::equalZero(aDirection.getX()))
+ {
+ fRotateY = atan2(-aDirection.getZ(), aDirection.getX());
+ }
-void SvxLightPrevievCtl3D::SetLampSize(double fNew)
-{
- if(fLampSize != fNew)
- {
- fLampSize = fNew;
- CreateLightGeometry();
- Invalidate();
- }
-}
+ aTransform.rotate(0.0, fRotateY, 0.0);
+ mpLampShaftObject->SetTransform(aTransform);
-void SvxLightPrevievCtl3D::DrawGeometry(Base3D *pBase3D)
-{
- // call parent; zeichnet das Objekt selbst
- SvxPreviewCtl3D::DrawGeometry(pBase3D);
+ // adapt transformation of selected light
+ E3dObject* pSelectedLight = maLightObjects[sal_Int32(maSelectedLight)];
- // Lichter zeichnen
- for(UINT16 a=0;a<BASE3D_MAX_NUMBER_LIGHTS;a++)
- {
- Base3DLightNumber eLightNum = (Base3DLightNumber)(Base3DLight0 + a);
- if(aLights.IsEnabled(eLightNum))
- DrawLightGeometry(eLightNum, pBase3D);
+ if(pSelectedLight)
+ {
+ 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);
+ }
}
}
-void SvxLightPrevievCtl3D::DrawLightGeometry(Base3DLightNumber eLightNum,
- Base3D* pBase3D)
+void Svx3DLightControl::TrySelection(Point aPosPixel)
{
- // 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)
+ if(mpScene)
{
- // 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)
- {
- aPoint.setZ(-cos(fWink) * fRadius);
- aPoint.setX(-sin(fWink) * fRadius);
- pBase3D->AddVertex(aPoint);
- }
- pBase3D->EndPrimitive();
+ const Point aPosLogic(PixelToLogic(aPosPixel));
+ const basegfx::B2DPoint aPoint(aPosLogic.X(), aPosLogic.Y());
+ std::vector< const E3dCompoundObject* > aResult;
+ getAllHit3DObjectsSortedFrontToBack(aPoint, *mpScene, aResult);
- // 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);
-
- for(fWink=-F_PI2;fWink < F_PI2; fWink += F_PI/12.0)
+ if(aResult.size())
{
- aPoint.setX(cos(fWink) * -fSinBoden);
- aPoint.setY(sin(fWink) * fRadius);
- aPoint.setZ(cos(fWink) * -fCosBoden);
- pBase3D->AddVertex(aPoint);
- }
- 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);
- }
-}
+ // take the frontmost one
+ const E3dCompoundObject* pResult = aResult[0];
-void SvxLightPrevievCtl3D::CreateLightGeometry()
-{
- // Wuerfel erzeugen fuer Objektgroesse
- basegfx::B3DRange aVolume;
- aVolume.expand(basegfx::B3DPoint(-fLampSize, -fLampSize, -fLampSize));
- aVolume.expand(basegfx::B3DPoint( fLampSize, fLampSize, fLampSize));
+ 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);
- // Kugel erzeugen
- aLightGeometry.CreateSphere(aVolume, 4.0, 3.0);
-}
+ for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
+ {
+ if(maLightObjects[a] && maLightObjects[a] == pResult)
+ {
+ aNewSelectedLight = a;
+ }
+ }
-// 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(aNewSelectedLight != maSelectedLight)
+ {
+ SelectLight(aNewSelectedLight);
-// 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;
+ 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;
+ }
- // Vertikal cutten
- if(fNewRotX < -90.0)
- fNewRotX = -90.0;
- if(fNewRotX > 90.0)
- fNewRotX = 90.0;
+ while(fNewRotY >= F_2PI)
+ {
+ fNewRotY -= F_2PI;
+ }
- SetRotation(fNewRotX, fNewRotY, fSaveActionStartRotZ);
+ // cut vertical
+ if(fNewRotX < -F_PI2)
+ {
+ fNewRotX = -F_PI2;
+ }
+
+ if(fNewRotX > F_PI2)
+ {
+ fNewRotX = F_PI2;
+ }
- if(aChangeCallback.IsSet())
- aChangeCallback.Call(this);
+ SetRotation(fNewRotX, fNewRotY, mfSaveActionStartRotZ);
+
+ 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;
+ }
+
+ return false;
+}
- for(UINT16 a=0;a<BASE3D_MAX_NUMBER_LIGHTS;a++)
+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)
{
- eNew = eActualLight;
- bNewSelection = TRUE;
+ 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)
+ {
+ basegfx::B3DHomMatrix aObjectRotation;
+ aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
+ mp3DObj->SetTransform(aObjectRotation);
- if(bNewSelection && eSelectedLight != eNew)
+ Invalidate();
+ }
+ }
+ }
+}
+
+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;
- // Falls tatsaechlich eine andere Lampe selektiert
- // wurde, rufe den entsprechenden Callback
- if(aSelectionChangeCallback.IsSet())
- aSelectionChangeCallback.Call(this);
+ if(mp3DObj)
+ {
+ basegfx::B3DHomMatrix aObjectRotation;
+ aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
+ mp3DObj->SetTransform(aObjectRotation);
+
+ 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:
+ {
+ sal_Int32 nLight(maLightControl.GetSelectedLight() - 1);
+
+ while((nLight >= 0) && !maLightControl.GetLightOnOff(nLight))
{
- B3dLightGroup* pLights = aLightControl.GetLightGroup();
- int eLight = aLightControl.GetSelectedLight() - 1;
+ nLight--;
+ }
- while( (eLight >= Base3DLight0) && !pLights->IsEnabled((Base3DLightNumber)eLight) )
- eLight--;
+ if(nLight < 0)
+ {
+ nLight = 7;
- if( eLight < Base3DLight0 )
+ while((nLight >= 0) && !maLightControl.GetLightOnOff(nLight))
{
- eLight = Base3DLight7;
- while( (eLight >= Base3DLight0) && !pLights->IsEnabled((Base3DLightNumber)eLight) )
- eLight--;
+ nLight--;
}
+ }
- if( eLight >= Base3DLight0 )
+ if(nLight >= 0)
+ {
+ maLightControl.SelectLight(nLight);
+ CheckSelection();
+
+ 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 b50661e158d9..52787ccf5ca5 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 e1aa907bdc2e..c47c516b05f2 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 420ac198a72c..504f4e95168f 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();
- // Teilen durch Anzahl
- if(nCnt > 1)
- aGlobalCenter /= (double)nCnt;
+ if(pScene)
+ {
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
- // Gruppe schon gesetzt? Sonst gruppe irgendeines Objektes
- // (erstes) holen
- if(!pScene && nCnt)
- {
- if(aGrp[0]->p3DObj)
- pScene = aGrp[0]->p3DObj->GetScene();
- }
+ 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);
- if(pScene)
- {
- // 2D-Koordinaten des Controls Rotationszentrum holen
- Point aRotCenter2D = Ref1();
+ aObjCenter = aTransform * aObjCenter;
+ maGlobalCenter += aObjCenter;
+ }
+
+ // 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());
+
+ // from world to relative scene using inverse getObjectTransformation()
+ basegfx::B2DHomMatrix aInverseObjectTransform(rVCScene.getObjectTransformation());
+ aInverseObjectTransform.invert();
+ aRotCenter2D = aInverseObjectTransform * aRotCenter2D;
- // In Augkoordinaten transformieren
- basegfx::B3DPoint aRotCenter(aRotCenter2D.X(), aRotCenter2D.Y(), 0.0);
- aRotCenter = pScene->GetCameraSet().ViewToEyeCoor(aRotCenter);
+ // 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();
+ 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();
- // Bewegungsvektor von View-Koordinaten nach Aug-Koordinaten
- basegfx::B3DPoint aMoveHead(rCameraSet.ViewToEyeCoor(aGlobalMoveHead));
- basegfx::B3DPoint aMoveTail(rCameraSet.ViewToEyeCoor(aGlobalMoveTail));
+ aMoveHead3D = aInverseViewToEye * aMoveHead3D;
+ aMoveTail3D = aInverseViewToEye * aMoveTail3D;
- // Eventuell Bewegung von XY-Ebene auf XZ-Ebene umschalten
+ // 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);
- // Transformation bestimmen
+ aMoveHead3D = aCompleteTrans * aMoveHead3D;
+ aMoveTail3D = aCompleteTrans* aMoveTail3D;
+
+ // 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 000000000000..c604ffc5831c
--- /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 0f2c7b8c8ecb..825ee89926ba 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 f9f474fbd6ae..ea08d3919e0f 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;
+
+ 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());
+ }
- // Linien aktivieren, um Objekt garantiert sichtbar zu machen
- aSet.Put(XLineStyleItem(XLINE_SOLID));
+ // 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 6fd7235ca6fc..a5147c55e81e 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 000000000000..12bc9a2b53d5
--- /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 000000000000..85ba97f1a826
--- /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 000000000000..aefa4dba3768
--- /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 89af592764c2..9c222baf55c5 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 18ed727628e6..4c03f949e939 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 5da69712d532..743aa3c6aa56 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;
- SetTransform(mObjTrans);
- // force new camera and SnapRect on scene, geometry may have really
- // changed
- pScene->CorrectSceneDimensions();
+ E3DModifySceneSnapRectUpdater aUpdater(this);
+ SetTransform(mObjTrans);
}
}
@@ -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;
-
- E3dObjList* pOL = pSub;
- ULONG nObjCnt = pOL->GetObjCount();
+ InvalidateBoundVolume();
- 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;
-
- E3dObjList* pOL = pSub;
- ULONG nObjCnt = pOL->GetObjCount();
+ InvalidateBoundVolume();
+ mbTfHasChanged = true;
- 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;
-}
-/*************************************************************************
-|*
-|* 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);
+ // to 3d view coor
+ aPos3D *= aViewInfo3D.getObjectToView() * GetTransform();
- // Neue Geometrie zerstoeren
- aDisplayGeometry.Erase();
+ // create 2d relative scene
+ basegfx::B2DPoint aPos2D(aPos3D.getX(), aPos3D.getY());
- // BoundVols resetten
- aLocalBoundVol = Volume3D();
- bBoundVolValid = FALSE;
- StructureChanged(this);
+ // to 2d world coor
+ aPos2D *= rVCScene.getObjectTransformation();
- // 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);
+ // get 3D primitive sequence
+ const drawinglayer::primitive3d::Primitive3DSequence xLocalSequence(pVCOfE3D->getViewIndependentPrimitive3DSequence());
- aRect3D.append(basegfx::B3DPoint(), 4L);
- aRect3D.setB3DPoint(3L, aPoly3DFront.getB3DPoint(nPrefillIndex));
- aRect3D.setB3DPoint(2L, aPoly3DBack.getB3DPoint(nPrefillIndex));
-
- 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 = ((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue();
- XLineStyle eLineStyle = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
- BOOL bFillAttrIsNone = eFillStyle == XFILL_NONE;
- BOOL bLineAttrIsNone = eLineStyle == XLINE_NONE;
- return (bFillAttrIsNone && !bLineAttrIsNone);
-}
-
-INT32 E3dCompoundObject::GetShadowXDistance() const
-{
- return (long)((SdrShadowXDistItem&)(GetObjectItem(SDRATTR_SHADOWXDIST))).GetValue();
-}
-
-INT32 E3dCompoundObject::GetShadowYDistance() const
+SdrObject* E3dCompoundObject::CheckHit(const Point& rPnt, USHORT /*nTol*/, const SetOfByte* /*pVisiLayer*/) const
{
- return (long)((SdrShadowYDistItem&)(GetObjectItem(SDRATTR_SHADOWYDIST))).GetValue();
-}
-
-BOOL E3dCompoundObject::DoDrawShadow()
-{
- const SfxItemSet& rSet = GetObjectItemSet();
- BOOL bRetval(FALSE);
- BOOL bShadOn = ((SdrShadowItem&)(rSet.Get(SDRATTR_SHADOW))).GetValue();
-
- if(bShadOn)
+ if(checkHitSingle3DObject(basegfx::B2DPoint(rPnt.X(), rPnt.Y()), *this))
{
- bRetval = TRUE;
-
- if(((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue() == XFILL_NONE)
- {
- if(((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue() == XLINE_NONE)
- {
- bRetval = FALSE;
- }
- }
+ return const_cast< E3dCompoundObject* >(this);
}
- return bRetval;
-}
-
-/*************************************************************************
-|*
-|* Create vertical polygons for line polygon
-|*
-\************************************************************************/
-
-// #i28528#
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpCompleteLinePolygon(const basegfx::B3DPolyPolygon& rLinePolyPoly, sal_uInt32 nPolysPerRun, sal_Bool bClosed)
-{
- basegfx::B3DPolyPolygon aRetval;
- const sal_uInt32 nLinePolyPolyCount(rLinePolyPoly.count());
-
- if(nLinePolyPolyCount && nPolysPerRun)
- {
- // get number of layers
- sal_uInt32 nLayers(nLinePolyPolyCount / nPolysPerRun);
-
- // add vertical Polygons if at least two horizontal ones exist
- if(nLayers > 1L)
- {
- for(sal_uInt32 a(0L); a < nPolysPerRun; a++)
- {
- const sal_uInt32 nPntCnt(rLinePolyPoly.getB3DPolygon(a).count());
-
- for(sal_uInt32 b(0L); b < nPntCnt; b++)
- {
- basegfx::B3DPolygon aNewVerPoly;
-
- for(sal_uInt32 c(0L); c < nLayers; c++)
- {
- aNewVerPoly.append(rLinePolyPoly.getB3DPolygon((c * nPolysPerRun) + a).getB3DPoint(b));
- }
-
- // evtl. set first point again to close polygon
- aNewVerPoly.setClosed(bClosed);
-
- // insert
- aRetval.append(aNewVerPoly);
- }
- }
- }
- }
-
- return aRetval;
-}
-
-/*************************************************************************
-|*
-|* Ein Segment fuer Extrude oder Lathe erzeugen
-|*
-\************************************************************************/
-
-void E3dCompoundObject::ImpCreateSegment(
- const basegfx::B3DPolyPolygon& rFront, // vorderes Polygon
- const basegfx::B3DPolyPolygon& rBack, // hinteres Polygon
- const basegfx::B3DPolyPolygon* pPrev, // smooth uebergang zu Vorgaenger
- const basegfx::B3DPolyPolygon* pNext, // smooth uebergang zu Nachfolger
- BOOL bCreateFront, // vorderen Deckel erzeugen
- BOOL bCreateBack, // hinteren Deckel erzeugen
- double fPercentDiag, // Anteil des Deckels an der Tiefe
- BOOL bSmoothLeft, // Glaetten der umlaufenden Normalen links
- BOOL bSmoothRight, // Glaetten der umlaufenden Normalen rechts
- BOOL bSmoothFrontBack, // Glaetten der Abschlussflaechen
- double fSurroundFactor, // Wertebereich der Texturkoordinaten im Umlauf
- double fTextureStart, // TexCoor ueber Extrude-Tiefe
- double fTextureDepth, // TexCoor ueber Extrude-Tiefe
- BOOL bDoCreateTexture,
- BOOL bDoCreateNormals,
- BOOL bCharacterExtrude, // FALSE=exakt, TRUE=ohne Ueberschneidungen
- BOOL bRotateTexture90, // Textur der Seitenflaechen um 90 Grad kippen
- // #i28528#
- basegfx::B3DPolyPolygon* pLineGeometryFront, // For creation of line geometry front parts
- basegfx::B3DPolyPolygon* pLineGeometryBack, // For creation of line geometry back parts
- basegfx::B3DPolyPolygon* pLineGeometry // For creation of line geometry in-betweens
- )
-{
- basegfx::B3DPolyPolygon aNormalsLeft(ImpCreateByPattern(rFront));
- basegfx::B3DPolyPolygon aNormalsRight(ImpCreateByPattern(rFront));
- aNormalsLeft = ImpAddInBetweenNormals(rFront, rBack, aNormalsLeft, bSmoothLeft);
- aNormalsRight = ImpAddInBetweenNormals(rFront, rBack, aNormalsRight, bSmoothRight);
- const basegfx::B3DRange aBackRange(basegfx::tools::getRange(rBack));
- const basegfx::B3DRange aFrontRange(basegfx::tools::getRange(rFront));
- basegfx::B3DPoint aOffset(aBackRange.getCenter() - aFrontRange.getCenter());
-
- // #i28528#
- sal_Bool bTakeCareOfLineGeometry(pLineGeometryFront != 0L || pLineGeometryBack != 0L || pLineGeometry != 0L);
-
- // Ausnahmen: Nicht geschlossen
- if(!rFront.isClosed())
- {
- bCreateFront = FALSE;
- }
- if(!rBack.isClosed())
- {
- bCreateBack = FALSE;
- }
-
- // Ausnahmen: Einfache Linie
- if(rFront.getB3DPolygon(0L).count() < 3L || (!bCreateFront && !bCreateBack))
- {
- fPercentDiag = 0.0;
- }
-
- if(fPercentDiag == 0.0)
- {
- // Ohne Schraegen, Vorderseite
- if(bCreateFront)
- {
- basegfx::B3DPolyPolygon aNormalsFront(ImpCreateByPattern(rFront));
- aNormalsFront = ImpAddFrontNormals(aNormalsFront, aOffset);
-
- if(!bSmoothFrontBack)
- ImpCreateFront(rFront, aNormalsFront, bDoCreateNormals, bDoCreateTexture);
- if(bSmoothLeft)
- aNormalsLeft = ImpAddFrontNormals(aNormalsLeft, aOffset);
- if(bSmoothFrontBack)
- ImpCreateFront(rFront, aNormalsLeft, bDoCreateNormals, bDoCreateTexture);
- }
- else
- {
- if(pPrev)
- aNormalsLeft = ImpAddInBetweenNormals(*pPrev, rFront, aNormalsLeft, bSmoothLeft);
- }
-
- // Ohne Schraegen, Rueckseite
- if(bCreateBack)
- {
- basegfx::B3DPolyPolygon aNormalsBack(ImpCreateByPattern(rBack));
- aNormalsBack = ImpAddBackNormals(aNormalsBack, aOffset);
-
- if(!bSmoothFrontBack)
- ImpCreateBack(rBack, aNormalsBack, bDoCreateNormals, bDoCreateTexture);
- if(bSmoothRight)
- aNormalsRight = ImpAddBackNormals(aNormalsRight, aOffset);
- if(bSmoothFrontBack)
- ImpCreateBack(rBack, aNormalsRight, bDoCreateNormals, bDoCreateTexture);
- }
- else
- {
- if(pNext)
- aNormalsRight = ImpAddInBetweenNormals(rBack, *pNext, aNormalsRight, bSmoothRight);
- }
-
- // eigentliches Zwischenstueck
- ImpCreateInBetween(rFront, rBack,
- aNormalsLeft, aNormalsRight,
- bDoCreateNormals,
- fSurroundFactor,
- fTextureStart,
- fTextureDepth,
- bRotateTexture90);
-
- // #78972#
- if(bTakeCareOfLineGeometry)
- {
- if(bCreateFront)
- {
- if(pLineGeometryFront) pLineGeometryFront->append(rFront);
- }
- else
- {
- if(pLineGeometry) pLineGeometry->append(rFront);
- }
-
- if(bCreateBack)
- {
- if(pLineGeometryBack) pLineGeometryBack->append(rBack);
- }
- }
- }
- else
- {
- // Mit Scraegen, Vorderseite
- basegfx::B3DPolyPolygon aLocalFront = rFront;
- basegfx::B3DPolyPolygon aLocalBack = rBack;
- double fExtrudeDepth, fDiagLen(0.0);
- double fTexMidStart = fTextureStart;
- double fTexMidDepth = fTextureDepth;
-
- if(bCreateFront || bCreateBack)
- {
- fExtrudeDepth = basegfx::B3DVector(aOffset).getLength();
- fDiagLen = fPercentDiag * fExtrudeDepth;
- }
-
- basegfx::B3DPolyPolygon aOuterFront;
- basegfx::B3DPolyPolygon aOuterBack;
-
- if(bCreateFront)
- {
- basegfx::B3DPolyPolygon aNormalsOuterFront(ImpCreateByPattern(aLocalFront));
- aNormalsOuterFront = ImpAddFrontNormals(aNormalsOuterFront, aOffset);
-
- if(bCharacterExtrude)
- {
- // Polygon kopieren
- aOuterFront = aLocalFront;
-
- // notwendige Normalen erzeugen
- basegfx::B3DPolyPolygon aGrowDirection(ImpCreateByPattern(aLocalFront));
- aGrowDirection = ImpAddInBetweenNormals(aLocalFront, aLocalBack, aGrowDirection, bSmoothLeft);
-
- // Groesse inneres Polygon merken
- Volume3D aOldSize(basegfx::tools::getRange(aLocalFront));
-
- // Inneres Polygon vergroessern
- aLocalFront = ImpGrowPoly(aLocalFront, aGrowDirection, fDiagLen);
-
- // Inneres Polygon nach innen verschieben
- //GrowPoly(aLocalFront, aNormalsOuterFront, -fDiagLen);
-
- // Neue Groesse inneres Polygon feststellen
- basegfx::B3DRange aNewSize(basegfx::tools::getRange(aLocalFront));
-
- // Skalierung feststellen (nur X,Y)
- basegfx::B3DPoint aScaleVec(
- (aNewSize.getWidth() != 0.0) ? aOldSize.getWidth() / aNewSize.getWidth() : 1.0,
- (aNewSize.getHeight() != 0.0) ? aOldSize.getHeight() / aNewSize.getHeight() : 1.0,
- (aNewSize.getDepth() != 0.0) ? aOldSize.getDepth() / aNewSize.getDepth() : 1.0);
-
- // Transformation bilden
- basegfx::B3DHomMatrix aTransMat;
- aTransMat.scale(aScaleVec.getX(), aScaleVec.getY(), aScaleVec.getZ());
-
- // aeusseres und inneres Polygon skalieren
- aLocalFront.transform(aTransMat);
- aOuterFront.transform(aTransMat);
-
- // Neue Groesse aktualisieren
- aNewSize = basegfx::tools::getRange(aLocalFront);
-
- // Translation feststellen
- basegfx::B3DPoint aTransVec(aOldSize.getCenter() - aNewSize.getCenter());
- // Transformation bilden
- aTransMat.identity();
- aTransMat.translate(aTransVec.getX(), aTransVec.getY(), aTransVec.getZ());
-
- // aeusseres und inneres Polygon skalieren
- aLocalFront.transform(aTransMat);
- aOuterFront.transform(aTransMat);
-
- // move aLocalFront again, scale and translate has moved it back
- aLocalFront = ImpGrowPoly(aLocalFront, aNormalsOuterFront, -fDiagLen);
- }
- else
- {
- // Polygon kopieren
- aOuterFront = aLocalFront;
-
- // notwendige Normalen erzeugen
- basegfx::B3DPolyPolygon aGrowDirection(ImpCreateByPattern(aLocalFront));
- aGrowDirection = ImpAddInBetweenNormals(aLocalFront, aLocalBack, aGrowDirection, bSmoothLeft);
-
- // Aeusseres Polygon verkleinern
- aOuterFront = ImpGrowPoly(aOuterFront, aGrowDirection, -fDiagLen);
- aOuterFront = ImpCorrectGrownPoly(aOuterFront, aLocalFront);
-
- // Inneres Polygon nach innen verschieben
- aLocalFront = ImpGrowPoly(aLocalFront, aNormalsOuterFront, -fDiagLen);
- }
-
- // eventuell noch glaetten
- if(bSmoothLeft)
- {
- if(bSmoothFrontBack)
- aNormalsOuterFront = ImpAddInBetweenNormals(aOuterFront, aLocalFront, aNormalsOuterFront, bSmoothLeft);
- aNormalsLeft = ImpAddInBetweenNormals(aOuterFront, aLocalFront, aNormalsLeft, bSmoothLeft);
- }
-
- // vordere Zwischenstuecke erzeugen
- ImpCreateInBetween(aOuterFront, aLocalFront,
- aNormalsOuterFront, aNormalsLeft,
- bDoCreateNormals,
- fSurroundFactor,
- fTextureStart,
- fTextureDepth * fPercentDiag,
- bRotateTexture90);
-
- // Vorderseite erzeugen
- ImpCreateFront(aOuterFront, aNormalsOuterFront, bDoCreateNormals, bDoCreateTexture);
-
- // Weitere Texturwerte setzen
- fTexMidStart += fTextureDepth * fPercentDiag;
- fTexMidDepth -= fTextureDepth * fPercentDiag;
- }
- else
- {
- if(pPrev)
- aNormalsLeft = ImpAddInBetweenNormals(*pPrev, rFront, aNormalsLeft, bSmoothLeft);
- }
-
- // Mit Scraegen, Rueckseite
- if(bCreateBack)
- {
- basegfx::B3DPolyPolygon aNormalsOuterBack(ImpCreateByPattern(aLocalBack));
- aNormalsOuterBack = ImpAddBackNormals(aNormalsOuterBack, aOffset);
-
- if(bCharacterExtrude)
- {
- // Polygon kopieren
- aOuterBack = aLocalBack;
-
- // notwendige Normalen erzeugen
- basegfx::B3DPolyPolygon aGrowDirection(ImpCreateByPattern(aLocalFront));
- aGrowDirection = ImpAddInBetweenNormals(aLocalFront, aLocalBack, aGrowDirection, bSmoothRight);
-
- // Groesse inneres Polygon merken
- Volume3D aOldSize(basegfx::tools::getRange(aLocalBack));
-
- // Inneres Polygon vergroessern
- aLocalBack = ImpGrowPoly(aLocalBack, aGrowDirection, fDiagLen);
-
- // Inneres Polygon nach innen verschieben
- //GrowPoly(aLocalBack, aNormalsOuterBack, -fDiagLen);
-
- // Neue Groesse inneres Polygon feststellen
- basegfx::B3DRange aNewSize(basegfx::tools::getRange(aLocalBack));
-
- // Skalierung feststellen (nur X,Y)
- basegfx::B3DPoint aScaleVec(
- (aNewSize.getWidth() != 0.0) ? aOldSize.getWidth() / aNewSize.getWidth() : 1.0,
- (aNewSize.getHeight() != 0.0) ? aOldSize.getHeight() / aNewSize.getHeight() : 1.0,
- (aNewSize.getDepth() != 0.0) ? aOldSize.getDepth() / aNewSize.getDepth() : 1.0);
-
- // Transformation bilden
- basegfx::B3DHomMatrix aTransMat;
- aTransMat.scale(aScaleVec.getX(), aScaleVec.getY(), aScaleVec.getZ());
-
- // aeusseres und inneres Polygon skalieren
- aLocalBack.transform(aTransMat);
- aOuterBack.transform(aTransMat);
-
- // Neue Groesse aktualisieren
- aNewSize = basegfx::tools::getRange(aLocalBack);
-
- // Translation feststellen
- basegfx::B3DPoint aTransVec(aOldSize.getCenter() - aNewSize.getCenter());
-
- // Transformation bilden
- aTransMat.identity();
- aTransMat.translate(aTransVec.getX(), aTransVec.getY(), aTransVec.getZ());
-
- // aeusseres und inneres Polygon skalieren
- aLocalBack.transform(aTransMat);
- aOuterBack.transform(aTransMat);
-
- // move aLocalBack again, scale and translate has moved it back
- aLocalBack = ImpGrowPoly(aLocalBack, aNormalsOuterBack, -fDiagLen);
- }
- else
- {
- // Polygon kopieren
- aOuterBack = aLocalBack;
-
- // notwendige Normalen erzeugen
- basegfx::B3DPolyPolygon aGrowDirection(ImpCreateByPattern(aLocalFront));
- aGrowDirection = ImpAddInBetweenNormals(aLocalFront, aLocalBack, aGrowDirection, bSmoothRight);
-
- // Aeusseres Polygon verkleinern
- aOuterBack = ImpGrowPoly(aOuterBack, aGrowDirection, -fDiagLen);
- aOuterBack = ImpCorrectGrownPoly(aOuterBack, aLocalBack);
-
- // Inneres Polygon nach innen verschieben
- aLocalBack = ImpGrowPoly(aLocalBack, aNormalsOuterBack, -fDiagLen);
- }
-
- // eventuell noch glaetten
- if(bSmoothRight)
- {
- if(bSmoothFrontBack)
- aNormalsOuterBack = ImpAddInBetweenNormals(aLocalBack, aOuterBack, aNormalsOuterBack, bSmoothRight);
- aNormalsRight = ImpAddInBetweenNormals(aLocalBack, aOuterBack, aNormalsRight, bSmoothRight);
- }
-
- // vordere Zwischenstuecke erzeugen
- // hintere Zwischenstuecke erzeugen
- ImpCreateInBetween(aLocalBack, aOuterBack,
- aNormalsRight, aNormalsOuterBack,
- bDoCreateNormals,
- fSurroundFactor,
- fTextureStart + (fTextureDepth * (1.0 - fPercentDiag)),
- fTextureDepth * fPercentDiag,
- bRotateTexture90);
-
- // Rueckseite erzeugen
- ImpCreateBack(aOuterBack, aNormalsOuterBack, bDoCreateNormals, bDoCreateTexture);
-
- // Weitere Texturwerte setzen
- fTexMidDepth -= fTextureDepth * fPercentDiag;
- }
- else
- {
- if(pNext)
- aNormalsRight = ImpAddInBetweenNormals(rBack, *pNext, aNormalsRight, bSmoothRight);
- }
-
- // eigentliches Zwischenstueck
- ImpCreateInBetween(aLocalFront, aLocalBack,
- aNormalsLeft, aNormalsRight,
- bDoCreateNormals,
- fSurroundFactor,
- fTexMidStart,
- fTexMidDepth,
- bRotateTexture90);
-
- // #78972#
- if(bTakeCareOfLineGeometry)
- {
- if(bCreateFront)
- {
- if(pLineGeometryFront) pLineGeometryFront->append(aOuterFront);
- }
-
- if(bCreateFront)
- {
- if(pLineGeometryFront) pLineGeometryFront->append(aLocalFront);
- }
- else
- {
- if(pLineGeometry) pLineGeometry->append(aLocalFront);
- }
-
- if(bCreateBack && pLineGeometryBack)
- {
- pLineGeometryBack->append(aLocalBack);
- pLineGeometryBack->append(aOuterBack);
- }
- }
- }
+ return 0;
}
/*************************************************************************
@@ -2867,7 +1240,7 @@ void E3dCompoundObject::SetCreateNormals(BOOL bNew)
if(bCreateNormals != bNew)
{
bCreateNormals = bNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -2876,29 +1249,12 @@ void E3dCompoundObject::SetCreateTexture(BOOL bNew)
if(bCreateTexture != bNew)
{
bCreateTexture = bNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
/*************************************************************************
|*
-|* DisplayGeometry rausruecken
-|*
-\************************************************************************/
-
-const B3dGeometry& E3dCompoundObject::GetDisplayGeometry() const
-{
- // Geometrie herstellen
- if(!bGeometryValid)
- {
- ((E3dCompoundObject*)this)->ReCreateGeometry();
- }
-
- return aDisplayGeometry;
-}
-
-/*************************************************************************
-|*
|* Material des Objektes
|*
\************************************************************************/
@@ -2911,22 +1267,6 @@ void E3dCompoundObject::SetMaterialAmbientColor(const Color& rColor)
}
}
-void E3dCompoundObject::SetBackMaterial(const B3dMaterial& rNew)
-{
- if(aBackMaterial != rNew)
- {
- aBackMaterial = rNew;
- }
-}
-
-void E3dCompoundObject::SetUseDifferentBackMaterial(BOOL bNew)
-{
- if(bUseDifferentBackMaterial != bNew)
- {
- bUseDifferentBackMaterial = bNew;
- }
-}
-
/*************************************************************************
|*
|* convert given basegfx::B3DPolyPolygon to screen coor
@@ -2935,65 +1275,22 @@ void E3dCompoundObject::SetUseDifferentBackMaterial(BOOL bNew)
basegfx::B2DPolyPolygon E3dCompoundObject::TransformToScreenCoor(const basegfx::B3DPolyPolygon& rCandidate)
{
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
basegfx::B2DPolyPolygon aRetval;
- B3dTransformationSet& rTransSet = GetScene()->GetCameraSet();
- const basegfx::B3DHomMatrix mTransform(GetFullTransform() * rTransSet.GetMatFromWorldToView());
- for(sal_uInt32 a(0L); a < rCandidate.count(); a++)
+ if(pRootScene)
{
- const basegfx::B3DPolygon aCandidate(rCandidate.getB3DPolygon(a));
- const sal_uInt32 nCount(aCandidate.count());
-
- if(nCount)
- {
- basegfx::B2DPolygon aTempPoly;
-
- for(sal_uInt32 b(0L); b < nCount; b++)
- {
- basegfx::B3DPoint aPoint(aCandidate.getB3DPoint(b));
- aPoint *= mTransform;
- aTempPoly.append(basegfx::B2DPoint(aPoint.getX(), aPoint.getY()));
- }
-
- aRetval.append(aTempPoly);
- }
+ aRetval = basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(rCandidate,
+ aViewInfo3D.getObjectToView() * GetTransform());
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+ aRetval.transform(rVCScene.getObjectTransformation());
}
return aRetval;
}
-// #110988#
-double E3dCompoundObject::GetMinimalDepthInViewCoor(E3dScene& rScene) const
-{
- double fRetval(DBL_MAX);
- B3dTransformationSet& rTransSet = rScene.GetCameraSet();
- basegfx::B3DHomMatrix mTransform = GetFullTransform();
- rTransSet.SetObjectTrans(mTransform);
- const B3dEntityBucket& rEntityBucket = GetDisplayGeometry().GetEntityBucket();
- const GeometryIndexValueBucket& rIndexBucket = GetDisplayGeometry().GetIndexBucket();
- sal_uInt32 nPolyCounter(0L);
- sal_uInt32 nEntityCounter(0L);
-
- while(nPolyCounter < rIndexBucket.Count())
- {
- sal_uInt32 nUpperBound(rIndexBucket[nPolyCounter++].GetIndex());
-
- while(nEntityCounter < nUpperBound)
- {
- basegfx::B3DPoint aNewPoint(rEntityBucket[nEntityCounter++].Point());
- aNewPoint = rTransSet.ObjectToViewCoor(aNewPoint);
-
- if(aNewPoint.getZ() < fRetval)
- {
- fRetval = aNewPoint.getZ();
- }
- }
- }
-
- return fRetval;
-}
-
-// #110988#
sal_Bool E3dCompoundObject::IsAOrdNumRemapCandidate(E3dScene*& prScene) const
{
if(GetObjList()
@@ -3007,4 +1304,5 @@ sal_Bool E3dCompoundObject::IsAOrdNumRemapCandidate(E3dScene*& prScene) const
return sal_False;
}
+//////////////////////////////////////////////////////////////////////////////
// eof
diff --git a/svx/source/engine3d/polygn3d.cxx b/svx/source/engine3d/polygn3d.cxx
index 40cdd596704f..033499fc227f 100644
--- a/svx/source/engine3d/polygn3d.cxx
+++ b/svx/source/engine3d/polygn3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: polygn3d.cxx,v $
- * $Revision: 1.17 $
+ * $Revision: 1.17.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -69,9 +69,6 @@ E3dPolygonObj::E3dPolygonObj(
// Default-Texturkoordinaten erzeugen
CreateDefaultTexture();
-
- // Geometrie erzeugen
- CreateGeometry();
}
/*************************************************************************
@@ -94,9 +91,6 @@ E3dPolygonObj::E3dPolygonObj(
// Default-Texturkoordinaten erzeugen
CreateDefaultTexture();
-
- // Geometrie erzeugen
- CreateGeometry();
}
/*************************************************************************
@@ -117,9 +111,6 @@ E3dPolygonObj::E3dPolygonObj(
SetPolyPolygon3D(rPolyPoly3D);
SetPolyNormals3D(rPolyNormals3D);
SetPolyTexture2D(rPolyTexture2D);
-
- // Geometrie erzeugen
- CreateGeometry();
}
/*************************************************************************
@@ -190,7 +181,7 @@ void E3dPolygonObj::CreateDefaultTexture()
const basegfx::B3DPolygon& aPolygon(aPolyPoly3D.getB3DPolygon(a));
// Gesamtgroesse des Objektes feststellen
- Volume3D aVolume(basegfx::tools::getRange(aPolygon));
+ basegfx::B3DRange aVolume(basegfx::tools::getRange(aPolygon));
// Normale holen
basegfx::B3DVector aNormal(basegfx::tools::getNormal(aPolygon));
@@ -296,7 +287,7 @@ void E3dPolygonObj::SetPolyPolygon3D(const basegfx::B3DPolyPolygon& rNewPolyPoly
aPolyPoly3D = rNewPolyPoly3D;
// Geometrie neu erzeugen
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -308,7 +299,7 @@ void E3dPolygonObj::SetPolyNormals3D(const basegfx::B3DPolyPolygon& rNewPolyNorm
aPolyNormals3D = rNewPolyNormals3D;
// Geometrie neu erzeugen
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -320,7 +311,7 @@ void E3dPolygonObj::SetPolyTexture2D(const basegfx::B2DPolyPolygon& rNewPolyText
aPolyTexture2D = rNewPolyTexture2D;
// Geometrie neu erzeugen
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -337,63 +328,6 @@ SdrObject *E3dPolygonObj::DoConvertToPolyObj(BOOL /*bBezier*/) const
/*************************************************************************
|*
-|* Give out simple line geometry
-|*
-\************************************************************************/
-
-basegfx::B3DPolyPolygon E3dPolygonObj::Get3DLineGeometry() const
-{
- basegfx::B3DPolyPolygon aRetval;
-
- for(sal_uInt32 a(0L); a < aPolyPoly3D.count(); a++)
- {
- basegfx::B3DPolygon aNew(aPolyPoly3D.getB3DPolygon(a));
-
- if(aNew.count() && aNew.isClosed())
- {
- aNew.append(aNew.getB3DPoint(0L));
- aNew.setClosed(false);
- }
-
- aRetval.append(aNew);
- }
-
- return aRetval;
-}
-
-/*************************************************************************
-|*
-|* Geometrieerzeugung
-|*
-\************************************************************************/
-
-void E3dPolygonObj::CreateGeometry()
-{
- // Start der Geometrieerzeugung ankuendigen
- StartCreateGeometry();
-
- if(aPolyNormals3D.count())
- {
- if(aPolyTexture2D.count())
- {
- AddGeometry(aPolyPoly3D, aPolyNormals3D, aPolyTexture2D, TRUE, bLineOnly);
- }
- else
- {
- AddGeometry(aPolyPoly3D, aPolyNormals3D, TRUE, bLineOnly);
- }
- }
- else
- {
- AddGeometry(aPolyPoly3D, TRUE, bLineOnly);
- }
-
- // call parent
- E3dCompoundObject::CreateGeometry();
-}
-
-/*************************************************************************
-|*
|* Zuweisungsoperator
|*
\************************************************************************/
@@ -423,7 +357,7 @@ void E3dPolygonObj::SetLineOnly(BOOL bNew)
if(bNew != bLineOnly)
{
bLineOnly = bNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
diff --git a/svx/source/engine3d/polysc3d.cxx b/svx/source/engine3d/polysc3d.cxx
index ff2922c94234..7f2c1af02e96 100644
--- a/svx/source/engine3d/polysc3d.cxx
+++ b/svx/source/engine3d/polysc3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: polysc3d.cxx,v $
- * $Revision: 1.18 $
+ * $Revision: 1.18.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -43,8 +43,6 @@
#include <svtools/style.hxx>
#include "globl3d.hxx"
#include <svx/polysc3d.hxx>
-#include <goodies/base3d.hxx>
-#include <goodies/b3dtex.hxx>
#include <svx/xlnclit.hxx>
#include <svtools/metitem.hxx>
#include <svx/xtable.hxx>
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index ff8f35a44c52..7909ccbfd10a 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: scene3d.cxx,v $
- * $Revision: 1.34 $
+ * $Revision: 1.34.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 "svditer.hxx"
@@ -44,9 +43,7 @@
#include <svtools/style.hxx>
#include <svx/scene3d.hxx>
#include <svx/e3dundo.hxx>
-#include <goodies/base3d.hxx>
#include <svx/svdtrans.hxx>
-
#include <svx/svxids.hrc>
#include <svx/colritem.hxx>
#include <svx/e3ditem.hxx>
@@ -56,13 +53,13 @@
#include <svtools/whiter.hxx>
#include <svx/xflftrit.hxx>
#include <svx/sdr/properties/e3dsceneproperties.hxx>
-
-// #110094#
#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
#include <svx/svddrag.hxx>
-
-// for ::std::sort
+#include <helperminimaldepth3d.hxx>
#include <algorithm>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <svx/e3dsceneupdater.hxx>
#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
@@ -157,7 +154,7 @@ Imp3DDepthRemapper::Imp3DDepthRemapper(E3dScene& rScene)
if(pCandidate->ISA(E3dCompoundObject))
{
// single 3d object, calc depth
- const double fMinimalDepth(((E3dCompoundObject*)pCandidate)->GetMinimalDepthInViewCoor(rScene));
+ const double fMinimalDepth(getMinimalDepthInViewCoordinates(static_cast< const E3dCompoundObject& >(*pCandidate)));
ImpRemap3DDepth aEntry(a, fMinimalDepth);
maVector.push_back(aEntry);
}
@@ -218,16 +215,8 @@ TYPEINIT1(E3dScene, E3dObject);
E3dScene::E3dScene()
: E3dObject(),
aCamera(basegfx::B3DPoint(0.0, 0.0, 4.0), basegfx::B3DPoint()),
- aPaintTime(),
- nDisplayQuality(255),
mp3DDepthRemapper(0L),
- bDoubleBuffered(FALSE),
- bClipping(FALSE),
- bFitInSnapRect(TRUE),
- bDither(false),
- bWasSelectedWhenCopy(false),
- bDrawOnlySelected(false),
- mfPolygonOffset(0.005) // #i71618#
+ bDrawOnlySelected(false)
{
// Defaults setzen
E3dDefaultAttributes aDefault;
@@ -237,22 +226,14 @@ E3dScene::E3dScene()
E3dScene::E3dScene(E3dDefaultAttributes& rDefault)
: E3dObject(),
aCamera(basegfx::B3DPoint(0.0, 0.0, 4.0), basegfx::B3DPoint()),
- aPaintTime(),
- nDisplayQuality(255),
mp3DDepthRemapper(0L),
- bDoubleBuffered(FALSE),
- bClipping(FALSE),
- bFitInSnapRect(TRUE),
- bDither(false),
- bWasSelectedWhenCopy(false),
- bDrawOnlySelected(false),
- mfPolygonOffset(0.005) // #i71618#
+ bDrawOnlySelected(false)
{
// Defaults setzen
SetDefaultAttributes(rDefault);
}
-void E3dScene::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
+void E3dScene::SetDefaultAttributes(E3dDefaultAttributes& /*rDefault*/)
{
// Fuer OS/2 die FP-Exceptions abschalten
#if defined(OS2)
@@ -269,38 +250,6 @@ void E3dScene::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
#endif
// Defaults setzen
-
- // set defaults for LightGroup from ItemPool
- aLightGroup.SetModelTwoSide(GetTwoSidedLighting());
- aLightGroup.SetIntensity( GetLightColor1(), Base3DMaterialDiffuse, Base3DLight0);
- aLightGroup.SetIntensity( GetLightColor2(), Base3DMaterialDiffuse, Base3DLight1);
- aLightGroup.SetIntensity( GetLightColor3(), Base3DMaterialDiffuse, Base3DLight2);
- aLightGroup.SetIntensity( GetLightColor4(), Base3DMaterialDiffuse, Base3DLight3);
- aLightGroup.SetIntensity( GetLightColor5(), Base3DMaterialDiffuse, Base3DLight4);
- aLightGroup.SetIntensity( GetLightColor6(), Base3DMaterialDiffuse, Base3DLight5);
- aLightGroup.SetIntensity( GetLightColor7(), Base3DMaterialDiffuse, Base3DLight6);
- aLightGroup.SetIntensity( GetLightColor8(), Base3DMaterialDiffuse, Base3DLight7);
- aLightGroup.SetGlobalAmbientLight(GetGlobalAmbientColor());
- aLightGroup.Enable( GetLightOnOff1(), Base3DLight0);
- aLightGroup.Enable( GetLightOnOff2(), Base3DLight1);
- aLightGroup.Enable( GetLightOnOff3(), Base3DLight2);
- aLightGroup.Enable( GetLightOnOff4(), Base3DLight3);
- aLightGroup.Enable( GetLightOnOff5(), Base3DLight4);
- aLightGroup.Enable( GetLightOnOff6(), Base3DLight5);
- aLightGroup.Enable( GetLightOnOff7(), Base3DLight6);
- aLightGroup.Enable( GetLightOnOff8(), Base3DLight7);
- aLightGroup.SetDirection( GetLightDirection1(), Base3DLight0);
- aLightGroup.SetDirection( GetLightDirection2(), Base3DLight1);
- aLightGroup.SetDirection( GetLightDirection3(), Base3DLight2);
- aLightGroup.SetDirection( GetLightDirection4(), Base3DLight3);
- aLightGroup.SetDirection( GetLightDirection5(), Base3DLight4);
- aLightGroup.SetDirection( GetLightDirection6(), Base3DLight5);
- aLightGroup.SetDirection( GetLightDirection7(), Base3DLight6);
- aLightGroup.SetDirection( GetLightDirection8(), Base3DLight7);
-
- bDither = rDefault.GetDefaultDither();
-
- // Alte Werte initialisieren
aCamera.SetViewWindow(-2, -2, 4, 4);
aCameraSet.SetDeviceRectangle(-2, 2, -2, 2);
aCamera.SetDeviceWindow(Rectangle(0, 0, 10, 10));
@@ -333,6 +282,19 @@ E3dScene::~E3dScene()
ImpCleanup3DDepthMapper();
}
+basegfx::B2DPolyPolygon E3dScene::TakeXorPoly() const
+{
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ const basegfx::B3DPolyPolygon aCubePolyPolygon(CreateWireframe());
+
+ basegfx::B2DPolyPolygon aRetval(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aCubePolyPolygon,
+ aViewInfo3D.getObjectToView()));
+ aRetval.transform(rVCScene.getObjectTransformation());
+
+ return aRetval;
+}
+
// #110988#
void E3dScene::ImpCleanup3DDepthMapper()
{
@@ -377,39 +339,6 @@ UINT16 E3dScene::GetObjIdentifier() const
/*************************************************************************
|*
-|* Anzahl der Handles zurueckgeben
-|*
-\************************************************************************/
-
-sal_uInt32 E3dScene::GetHdlCount() const
-{
- // Ueberladung aus E3dObject rueckgaengig machen
- return SdrAttrObj::GetHdlCount();
-}
-
-/*************************************************************************
-|*
-|* Handle-Liste fuellen
-|*
-\************************************************************************/
-
-void E3dScene::AddToHdlList(SdrHdlList& rHdlList) const
-{
- // Ueberladung aus E3dObject rueckgaengig machen
- SdrAttrObj::AddToHdlList(rHdlList);
-}
-
-/*************************************************************************
-|*
-\************************************************************************/
-
-FASTBOOL E3dScene::HasSpecialDrag() const
-{
- return FALSE;
-}
-
-/*************************************************************************
-|*
|* SetSnapRect
|*
\************************************************************************/
@@ -514,9 +443,9 @@ void E3dScene::NewObjectInserted(const E3dObject* p3DObj)
|*
\************************************************************************/
-void E3dScene::StructureChanged(const E3dObject* p3DObj)
+void E3dScene::StructureChanged()
{
- E3dObject::StructureChanged(p3DObj);
+ E3dObject::StructureChanged();
SetRectsDirty();
// #110988#
@@ -525,120 +454,6 @@ void E3dScene::StructureChanged(const E3dObject* p3DObj)
/*************************************************************************
|*
-|* Double Buffering aus-/einschalten
-|*
-\************************************************************************/
-
-void E3dScene::SetDoubleBuffered(FASTBOOL bBuff)
-{
- if ( bDoubleBuffered != (BOOL)bBuff )
- {
- bDoubleBuffered = bBuff;
- SetRectsDirty();
- }
-}
-
-/*************************************************************************
-|*
-|* Clipping auf umschliessendes Rechteck der Szene aus-/einschalten
-|*
-\************************************************************************/
-
-void E3dScene::SetClipping(FASTBOOL bClip)
-{
- if ( bClipping != (BOOL)bClip )
- {
- bClipping = bClip;
- SetRectsDirty();
- }
-}
-
-/*************************************************************************
-|*
-|* Einpassen der Objekte in umschliessendes Rechteck aus-/einschalten
-|*
-\************************************************************************/
-
-void E3dScene::SetFitInSnapRect(FASTBOOL bFit)
-{
- if ( bFitInSnapRect != (BOOL)bFit )
- {
- bFitInSnapRect = bFit;
- SetRectsDirty();
- }
-}
-
-/*************************************************************************
-|*
-|* Einpassen der Projektion aller Szenenobjekte in das
-|* umschliessende Rechteck
-|*
-\************************************************************************/
-
-basegfx::B3DRange E3dScene::FitInSnapRect()
-{
- basegfx::B3DRange aNewVol;
- const sal_uInt32 nObjCount(GetSubList() ? GetSubList()->GetObjCount() : 0L);
-
- if(nObjCount)
- {
- // Alter Kram
- basegfx::B3DHomMatrix aFullTrans(GetFullTransform());
- aCamera.FitViewToVolume(GetBoundVolume(), aFullTrans);
-
- // Neuer Kram
- // Maximas holen in Augkoordinaten zwecks Z-Werten
- basegfx::B3DPoint aTfVec;
- Vol3DPointIterator aIter(GetBoundVolume());
-
- GetCameraSet().SetObjectTrans(aFullTrans);
-
- while ( aIter.Next(aTfVec) )
- {
- aTfVec = GetCameraSet().ObjectToEyeCoor(aTfVec);
- aNewVol.expand(aTfVec);
- }
-
- // ... und merken
- double fZMin(-aNewVol.getMaxZ());
- double fZMax(-aNewVol.getMinZ());
-
- // Jetzt XY-Werte projizieren auf Projektionsflaeche
- // in Device-Koordinaten
- basegfx::B3DHomMatrix aWorldToDevice(GetCameraSet().GetOrientation());
-
- if(aCamera.GetProjection() == PR_PERSPECTIVE)
- {
- aWorldToDevice.frustum(-1.0, 1.0, -1.0, 1.0, fZMin, fZMax);
- }
- else
- {
- aWorldToDevice.ortho(-1.0, 1.0, -1.0, 1.0, fZMin, fZMax);
- }
-
- aNewVol.reset();
- aIter.Reset();
-
- while ( aIter.Next(aTfVec) )
- {
- aTfVec = GetCameraSet().ObjectToWorldCoor(aTfVec);
- aTfVec *= aWorldToDevice;
- aNewVol.expand(aTfVec);
- }
-
- // Z-Werte eintragen
- aNewVol = basegfx::B3DRange(aNewVol.getMinX(), aNewVol.getMinY(), fZMin, aNewVol.getMaxX(), aNewVol.getMaxY(), fZMax);
- }
-
- // #110988#
- ImpCleanup3DDepthMapper();
-
- // Rueckgabewert setzen
- return aNewVol;
-}
-
-/*************************************************************************
-|*
|* Uebergeordnetes Szenenobjekt bestimmen
|*
\************************************************************************/
@@ -651,118 +466,52 @@ E3dScene* E3dScene::GetScene() const
return (E3dScene*)this;
}
-/*************************************************************************
-|*
-|* TransformationSet vorbereiten
-|*
-\************************************************************************/
-
-void E3dScene::InitTransformationSet()
-{
- Rectangle aBound(GetSnapRect());
-
- // GeometricSet reset und mit pBase3D assoziieren
- B3dCamera& rSet = GetCameraSet();
-
- // Transformation auf Weltkoordinaten holen
- basegfx::B3DHomMatrix mTransform = GetFullTransform();
- rSet.SetObjectTrans(mTransform);
-
- // 3D Ausgabe vorbereiten, Maximas holen in DeviceKoordinaten
- basegfx::B3DRange aVolume(FitInSnapRect());
-
- // #i85887#
- static basegfx::B3DRange aLastVolume;
- if(aVolume != aLastVolume)
- {
- // The BoundRects for the contained 3D SdrObjects depend on the
- // calculated BoundVolume. If the BoundVolume changes, those rects
- // need to be invalidated. Since the first inits when importing a ODF
- // work with wrong 3D Volumes, the initially calculated BoundRects
- // tend to be wrong and need to be invalidated on 3D Volume change.
- SetRectsDirty();
- aLastVolume = aVolume;
- }
-
- // Maximas fuer Abbildung verwenden
- rSet.SetDeviceVolume(aVolume, FALSE);
- rSet.SetViewportRectangle(aBound);
-
- // #110988#
- ImpCleanup3DDepthMapper();
-}
-
-/*************************************************************************
-|*
-|* Einpassen der Objekte in umschliessendes Rechteck aus-/einschalten
-|*
-\************************************************************************/
-
-void E3dScene::FitSnapRectToBoundVol()
+void E3dScene::removeAllNonSelectedObjects()
{
- basegfx::B3DPoint aTfVec;
- Volume3D aFitVol;
-
- SetBoundVolInvalid();
- basegfx::B3DHomMatrix aTransform = aCamera.GetViewTransform() * GetFullTransform(); // #112587#
- Vol3DPointIterator aIter(GetBoundVolume(), &aTransform);
- Rectangle aRect;
+ E3DModifySceneSnapRectUpdater aUpdater(this);
- while ( aIter.Next(aTfVec) )
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
{
- aTfVec = aCamera.DoProjection(aTfVec);
- aFitVol.expand(aTfVec);
- basegfx::B3DPoint aZwi(aCamera.MapToDevice(aTfVec));
- Point aP((long)aZwi.getX(), (long)aZwi.getY());
- aRect.Union(Rectangle(aP, aP));
- }
- aCamera.SetViewWindow(aFitVol.getMinX(), aFitVol.getMinY(), aFitVol.getWidth(), aFitVol.getHeight());
- SetSnapRect(aRect);
-
- // Die SnapRects aller beteiligten Objekte muessen auf dieser
- // veraenderten Basis aufgebaut werden, invalidiere diese. Das
- // eigene kann auch invalidiert werden, da ein RecalcSnapRect
- // an einer Szene nur aus der Kamera liest
- SetRectsDirty();
+ SdrObject* pObj = maSubList.GetObj(a);
- // #110988#
- ImpCleanup3DDepthMapper();
-}
-
-/*************************************************************************
-|*
-|* Falls die Geometrie einer Szene sich ausgedehnt/vermindert hat,
-|* muss das Volume und das SnapRect angepasst werden
-|*
-\************************************************************************/
+ if(pObj)
+ {
+ bool bRemoveObject(false);
-void E3dScene::CorrectSceneDimensions()
-{
- const sal_uInt32 nObjCount(GetSubList() ? GetSubList()->GetObjCount() : 0L);
+ if(pObj->ISA(E3dScene))
+ {
+ E3dScene* pScene = (E3dScene*)pObj;
- if(nObjCount)
- {
- // SnapRects der Objekte ungueltig
- SetRectsDirty();
+ // iterate over this sub-scene
+ pScene->removeAllNonSelectedObjects();
- // SnapRect anpassen, invalidiert auch die SnapRects
- // der enthaltenen Objekte
- FitSnapRectToBoundVol();
+ // check object count. Empty scenes can be deleted
+ const sal_uInt32 nObjCount(pScene->GetSubList() ? pScene->GetSubList()->GetObjCount() : 0);
- // Neues BoundVolume der Kamera holen
- basegfx::B3DRange aVolume(FitInSnapRect());
+ if(!nObjCount)
+ {
+ // all objects removed, scene can be removed, too
+ bRemoveObject = true;
+ }
+ }
+ else if(pObj->ISA(E3dCompoundObject))
+ {
+ E3dCompoundObject* pCompound = (E3dCompoundObject*)pObj;
- // Neues BoundVolume an der Kamera setzen
- GetCameraSet().SetDeviceVolume(aVolume, FALSE);
+ if(!pCompound->GetSelected())
+ {
+ bRemoveObject = true;
+ }
+ }
- // Danach noch die SnapRects der enthaltenen Objekte
- // invalidieren, um diese auf der neuen Grundlage berechnen
- // zu lassen (falls diese von FitInSnapRect() berechnet wurden)
- SetRectsDirty();
+ if(bRemoveObject)
+ {
+ maSubList.NbcRemoveObject(pObj->GetOrdNum());
+ a--;
+ SdrObject::Free(pObj);
+ }
+ }
}
-
- // #110988#
- ImpCleanup3DDepthMapper();
}
/*************************************************************************
@@ -777,23 +526,14 @@ void E3dScene::operator=(const SdrObject& rObj)
const E3dScene& r3DObj = (const E3dScene&) rObj;
aCamera = r3DObj.aCamera;
- bDoubleBuffered = r3DObj.bDoubleBuffered;
- bClipping = r3DObj.bClipping;
- bFitInSnapRect = r3DObj.bFitInSnapRect;
// neu ab 377:
aCameraSet = r3DObj.aCameraSet;
((sdr::properties::E3dSceneProperties&)GetProperties()).SetSceneItemsFromCamera();
- // neu ab 383:
- aLightGroup = r3DObj.aLightGroup;
- ((sdr::properties::E3dSceneProperties&)GetProperties()).SetLightItemsFromLightGroup(aLightGroup);
-
- bDither = r3DObj.bDither;
-
- bBoundVolValid = FALSE;
+ // SetSnapRect(r3DObj.GetSnapRect());
+ InvalidateBoundVolume();
RebuildLists();
-
SetRectsDirty();
// #110988#
@@ -811,7 +551,7 @@ void E3dScene::RebuildLists()
// zuerst loeschen
SdrLayerID nCurrLayerID = GetLayer();
- SdrObjListIter a3DIterator(*pSub, IM_FLAT);
+ SdrObjListIter a3DIterator(maSubList, IM_FLAT);
// dann alle Objekte in der Szene pruefen
while ( a3DIterator.IsMore() )
@@ -843,7 +583,7 @@ void E3dScene::SaveGeoData(SdrObjGeoData& rGeo) const
{
E3dObject::SaveGeoData (rGeo);
- ((E3DSceneGeoData &) rGeo).aCamera = aCamera;
+ ((E3DSceneGeoData &) rGeo).aCamera = aCamera;
}
/*************************************************************************
@@ -854,10 +594,9 @@ void E3dScene::SaveGeoData(SdrObjGeoData& rGeo) const
void E3dScene::RestGeoData(const SdrObjGeoData& rGeo)
{
+ E3DModifySceneSnapRectUpdater aUpdater(this);
E3dObject::RestGeoData (rGeo);
-
SetCamera (((E3DSceneGeoData &) rGeo).aCamera);
- FitSnapRectToBoundVol();
}
/*************************************************************************
@@ -962,24 +701,45 @@ void E3dScene::TakeObjNamePlural(XubString& rName) const
|*
\************************************************************************/
+void E3dScene::NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix)
+{
+ if(maTransformation != rMatrix)
+ {
+ // call parent
+ E3dObject::NbcSetTransform(rMatrix);
+ }
+}
+
+void E3dScene::SetTransform(const basegfx::B3DHomMatrix& rMatrix)
+{
+ if(rMatrix != maTransformation)
+ {
+ // call parent
+ E3dObject::SetTransform(rMatrix);
+ }
+}
+
void E3dScene::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);
- // So dass war die Szene, ab jetzt kommen die Objekte in der Szene
- // 3D-Objekte gibt es nur ein einziges das kann zwar mehrere Flaechen haben aber die Flaechen
- // muessen ja nicht zusammenhaengend sein
- // es ermoeglicht den Zugriff auf Kindobjekte
- // Ich gehe also die gesamte Liste durch und rotiere um die Z-Achse die durch den
- // Mittelpunkt von aOutRect geht (Satz von Steiner), also RotateZ
+ // So dass war die Szene, ab jetzt kommen die Objekte in der Szene
+ // 3D-Objekte gibt es nur ein einziges das kann zwar mehrere Flaechen haben aber die Flaechen
+ // muessen ja nicht zusammenhaengend sein
+ // es ermoeglicht den Zugriff auf Kindobjekte
+ // Ich gehe also die gesamte Liste durch und rotiere um die Z-Achse die durch den
+ // Mittelpunkt von aOutRect geht (Satz von Steiner), also RotateZ
RotateScene (rRef, nWink, sn, cs); // Rotiert die Szene
double fWinkelInRad = nWink/100 * F_PI180;
- NbcRotateZ(fWinkelInRad);
- FitSnapRectToBoundVol();
+
+ basegfx::B3DHomMatrix aRotation;
+ aRotation.rotate(0.0, 0.0, fWinkelInRad);
+ NbcSetTransform(aRotation * GetTransform());
+
SetRectsDirty(); // Veranlasst eine Neuberechnung aller BoundRects
NbcRotateGluePoints(rRef,nWink,sn,cs); // Rotiert die Klebepunkte (die haben noch Koordinaten relativ
// zum Urpsung des Blattes
@@ -996,6 +756,7 @@ void E3dScene::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
void E3dScene::RecalcSnapRect()
{
E3dScene* pScene = GetScene();
+
if(pScene == this)
{
// Szene wird als 2D-Objekt benutzt, nimm SnapRect aus der
@@ -1020,18 +781,16 @@ void E3dScene::RecalcSnapRect()
BOOL E3dScene::IsBreakObjPossible()
{
// Szene ist aufzubrechen, wenn alle Mitglieder aufzubrechen sind
- SdrObjList* pSubList = GetSubList();
- if(pSubList)
+ SdrObjListIter a3DIterator(maSubList, IM_DEEPWITHGROUPS);
+
+ while ( a3DIterator.IsMore() )
{
- SdrObjListIter a3DIterator(*pSubList, IM_DEEPWITHGROUPS);
- while ( a3DIterator.IsMore() )
- {
- E3dObject* pObj = (E3dObject*) a3DIterator.Next();
- DBG_ASSERT(pObj->ISA(E3dObject), "AW: In Szenen sind nur 3D-Objekte erlaubt!");
- if(!pObj->IsBreakObjPossible())
- return FALSE;
- }
+ E3dObject* pObj = (E3dObject*) a3DIterator.Next();
+ DBG_ASSERT(pObj->ISA(E3dObject), "AW: In Szenen sind nur 3D-Objekte erlaubt!");
+ if(!pObj->IsBreakObjPossible())
+ return FALSE;
}
+
return TRUE;
}
@@ -1049,163 +808,9 @@ void E3dScene::SetShadowPlaneDirection(const basegfx::B3DVector& rVec)
GetProperties().SetObjectItemDirect(Svx3DShadowSlantItem(nSceneShadowSlant));
}
-
-// #115662#
-// helper class for in-between results from E3dScene::HitTest
-class ImplPairDephAndObject
-{
-public:
- SdrObject* pObject;
- double fDepth;
-
- // for ::std::sort
- bool operator<(const ImplPairDephAndObject& rComp) const;
-};
-
-bool ImplPairDephAndObject::operator<(const ImplPairDephAndObject& rComp) const
-{
- if(fDepth < rComp.fDepth)
- return true;
- return false;
-}
-
-// #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 E3dScene::HitTest(const Point& rHitTestPosition, ::std::vector< SdrObject* >& o_rResult)
-{
- // prepare output variables
- sal_uInt32 nRetval(0L);
- o_rResult.clear();
- SdrObjList* pList = GetSubList();
-
- if(pList && pList->GetObjCount())
- {
- SdrObjListIter aIterator(*pList, IM_DEEPNOGROUPS);
- ::std::vector< ImplPairDephAndObject > aDepthAndObjectResults;
-
- while(aIterator.IsMore())
- {
- SdrObject* pObj = aIterator.Next();
-
- if(pObj->ISA(E3dCompoundObject))
- {
- E3dCompoundObject* pCompoundObj = (E3dCompoundObject*)pObj;
-
- // get HitLine in local 3D ObjectKoordinates
- basegfx::B3DHomMatrix mTransform = pCompoundObj->GetFullTransform();
- GetCameraSet().SetObjectTrans(mTransform);
-
- // create HitPoint Front und Back, transform to local object coordinates
- basegfx::B3DPoint aFront(rHitTestPosition.X(), rHitTestPosition.Y(), 0.0);
- basegfx::B3DPoint aBack(rHitTestPosition.X(), rHitTestPosition.Y(), ZBUFFER_DEPTH_RANGE);
- aFront = GetCameraSet().ViewToObjectCoor(aFront);
- aBack = GetCameraSet().ViewToObjectCoor(aBack);
-
- // make BoundVolume HitTest for speedup first
- const Volume3D& rBoundVol = pCompoundObj->GetBoundVolume();
-
- if(!rBoundVol.isEmpty())
- {
- double fXMax(aFront.getX());
- double fXMin(aBack.getX());
-
- if(fXMax < fXMin)
- {
- fXMax = aBack.getX();
- fXMin = aFront.getX();
- }
-
- if(rBoundVol.getMinX() <= fXMax && rBoundVol.getMaxX() >= fXMin)
- {
- double fYMax(aFront.getY());
- double fYMin(aBack.getY());
-
- if(fYMax < fYMin)
- {
- fYMax = aBack.getY();
- fYMin = aFront.getY();
- }
-
- if(rBoundVol.getMinY() <= fYMax && rBoundVol.getMaxY() >= fYMin)
- {
- double fZMax(aFront.getZ());
- double fZMin(aBack.getZ());
-
- if(fZMax < fZMin)
- {
- fZMax = aBack.getZ();
- fZMin = aFront.getZ();
- }
-
- if(rBoundVol.getMinZ() <= fZMax && rBoundVol.getMaxZ() >= fZMin)
- {
- // BoundVol is hit, get geometry cuts now
- ::std::vector< basegfx::B3DPoint > aParameter;
- const B3dGeometry& rGeometry = pCompoundObj->GetDisplayGeometry();
- rGeometry.GetAllCuts(aParameter, aFront, aBack);
-
- if(aParameter.size())
- {
- // take first cut as base, use Z-Coor in ViewCoor (0 ..ZBUFFER_DEPTH_RANGE)
- ImplPairDephAndObject aTempResult;
- basegfx::B3DPoint aTempVector(aParameter[0]);
- aTempVector = GetCameraSet().ObjectToViewCoor(aTempVector);
-
- aTempResult.pObject = pCompoundObj;
- aTempResult.fDepth = aTempVector.getZ();
-
- // look for cut points in front of the first one
- ::std::vector< basegfx::B3DPoint >::iterator aIterator2(aParameter.begin());
- aIterator2++;
-
- for(;aIterator2 != aParameter.end(); aIterator2++)
- {
- basegfx::B3DPoint aTempVector2(*aIterator2);
- aTempVector2 = GetCameraSet().ObjectToViewCoor(aTempVector2);
-
- // use the smallest one
- if(aTempVector2.getZ() < aTempResult.fDepth)
- {
- aTempResult.fDepth = aTempVector2.getZ();
- }
- }
-
- // remember smallest cut with this object
- aDepthAndObjectResults.push_back(aTempResult);
- }
- }
- }
- }
- }
- }
- }
-
- // fill nRetval
- nRetval = aDepthAndObjectResults.size();
-
- if(nRetval)
- {
- // 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->pObject);
- }
- }
- }
-
- return nRetval;
-}
-
basegfx::B2DPolyPolygon E3dScene::TakeCreatePoly(const SdrDragStat& /*rDrag*/) const
{
- return TakeXorPoly(sal_True);
+ return TakeXorPoly();
}
FASTBOOL E3dScene::BegCreate(SdrDragStat& rStat)
diff --git a/svx/source/engine3d/sphere3d.cxx b/svx/source/engine3d/sphere3d.cxx
index ee5defcf121f..e27cc1d08468 100644
--- a/svx/source/engine3d/sphere3d.cxx
+++ b/svx/source/engine3d/sphere3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: sphere3d.cxx,v $
- * $Revision: 1.20 $
+ * $Revision: 1.20.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -80,9 +80,6 @@ E3dSphereObj::E3dSphereObj(E3dDefaultAttributes& rDefault, const basegfx::B3DPoi
// Uebergebene drueberbuegeln
aCenter = rCenter;
aSize = r3DSize;
-
- // Geometrie erzeugen
- CreateGeometry();
}
E3dSphereObj::E3dSphereObj()
@@ -119,247 +116,6 @@ void E3dSphereObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
/*************************************************************************
|*
-|* Give out simple line geometry
-|*
-\************************************************************************/
-
-basegfx::B3DPolyPolygon E3dSphereObj::Get3DLineGeometry() const
-{
- basegfx::B3DPolyPolygon aRetval;
-
- // add geometry describing polygons to rLinePolyPolygon
- const sal_uInt32 nCntHor((sal_uInt32)GetHorizontalSegments());
- const sal_uInt32 nCntVer((sal_uInt32)GetVerticalSegments());
- const sal_Bool bCreateHorizontal(sal_True);
- const sal_Bool bCreateVertical(sal_True);
-
- if(nCntHor && nCntVer && (bCreateHorizontal || bCreateVertical))
- {
- const double fHInc((double)DEG2RAD(360) / nCntHor);
- const double fVInc((double)DEG2RAD(180) / nCntVer);
- const basegfx::B3DVector aRadius(aSize / 2.0);
- const basegfx::B3DPoint aCenterPos(aCenter);
- double fHAng(0.0);
- basegfx::B3DPolygon aAllPoints;
-
- // create all sphere points
- for(sal_uInt32 nH(0L); nH < nCntHor; nH++)
- {
- const double fHSin(sin(fHAng));
- const double fHCos(cos(fHAng));
- fHAng += fHInc;
- double fVAng(DEG2RAD(90) - fVInc);
-
- for(sal_uInt32 nV(1L); nV < nCntVer; nV++)
- {
- const double fVSin(sin(fVAng));
- const double fVCos(cos(fVAng));
- fVAng -= fVInc;
-
- basegfx::B3DPoint aNewPos(
- aCenterPos.getX() + (aRadius.getX() * fVCos) * fHCos,
- aCenterPos.getY() + (aRadius.getY() * fVSin),
- aCenterPos.getZ() + (aRadius.getZ() * fVCos) * fHSin);
-
- aAllPoints.append(aNewPos);
- }
- }
-
- // create horizontal lines
- if(bCreateHorizontal)
- {
- for(sal_uInt32 a(1L); a < nCntVer; a++)
- {
- basegfx::B3DPolygon aNewHor;
- sal_uInt32 nStartIndex(a - 1L);
-
- for(sal_uInt32 b(0L); b < nCntHor; b++)
- {
- aNewHor.append(aAllPoints.getB3DPoint(nStartIndex));
- nStartIndex += (nCntVer - 1L);
- }
-
- aNewHor.append(aNewHor.getB3DPoint(0L));
- aRetval.append(aNewHor);
- }
- }
-
- // create vertical lines
- if(bCreateVertical)
- {
- const basegfx::B3DPoint aTopPos(aCenterPos.getX(), aCenterPos.getY() + aRadius.getY(), aCenterPos.getZ());
- const basegfx::B3DPoint aBottomPos(aCenterPos.getX(), aCenterPos.getY() - aRadius.getY(), aCenterPos.getZ());
-
- for(sal_uInt32 a(0L); a < nCntHor; a++)
- {
- basegfx::B3DPolygon aNewVer;
- aNewVer.append(aTopPos);
- sal_uInt32 nStartIndex(a * (nCntVer - 1L));
-
- for(sal_uInt32 b(1L); b < nCntVer; b++, nStartIndex++)
- {
- aNewVer.append(aAllPoints.getB3DPoint(nStartIndex));
- }
-
- aNewVer.append(aBottomPos);
- aRetval.append(aNewVer);
- }
- }
- }
-
- return aRetval;
-}
-
-/*************************************************************************
-|*
-|* Geometrieerzeugung
-|*
-\************************************************************************/
-
-void E3dSphereObj::CreateGeometry()
-{
- if ( GetHorizontalSegments() < 3L )
- {
- GetProperties().SetObjectItemDirect(Svx3DHorizontalSegmentsItem(3L));
- }
-
- if ( GetHorizontalSegments() > 100L )
- {
- GetProperties().SetObjectItemDirect(Svx3DHorizontalSegmentsItem(100L));
- }
-
- if ( GetVerticalSegments() < 2L )
- {
- GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(2L));
- }
-
- if ( GetVerticalSegments() > 100L )
- {
- GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(100L));
- }
-
- // Start der Geometrieerzeugung ankuendigen
- StartCreateGeometry();
-
- basegfx::B3DVector aRadius(aSize / 2.0);
- double fHSin1, fHSin2, fHCos1, fHCos2;
- double fHAng = 0;
- double fHInc = DEG2RAD(360) / GetHorizontalSegments();
- double fVInc = DEG2RAD(180) / GetVerticalSegments();
-
- fHSin2 = 0.0; // sin(0)
- fHCos2 = 1.0; // cos(0)
- sal_uInt16 nUpperBound = (sal_uInt16)GetHorizontalSegments();
-
- for (USHORT nH = 0; nH < nUpperBound; nH++)
- {
- fHAng += fHInc;
- fHSin1 = fHSin2;
- fHSin2 = sin(fHAng);
- fHCos1 = fHCos2;
- fHCos2 = cos(fHAng);
-
- double fRx, fRz;
- double fVAng = DEG2RAD(90);
- double fVSin1, fVSin2, fVCos1, fVCos2;
- fVSin2 = 1.0; // sin(90)
- fVCos2 = 0.0; // cos(90)
- sal_uInt16 nUpperVert = (sal_uInt16)GetVerticalSegments();
-
- for (USHORT nV = 0; nV < nUpperVert; nV++)
- {
- fVAng -= fVInc;
- fVSin1 = fVSin2;
- fVSin2 = sin(fVAng);
- fVCos1 = fVCos2;
- fVCos2 = cos(fVAng);
-
- basegfx::B3DPoint aPos1(aCenter);
- fRx = aRadius.getX() * fVCos1;
- fRz = aRadius.getZ() * fVCos1;
- aPos1.setX(aPos1.getX() + (fRx * fHCos1));
- aPos1.setY(aPos1.getY() + (aRadius.getY() * fVSin1));
- aPos1.setZ(aPos1.getZ() + (fRz * fHSin1));
-
- basegfx::B3DPoint aPos2(aPos1);
- aPos2.setX(aCenter.getX() + fRx * fHCos2);
- aPos2.setZ(aCenter.getZ() + fRz * fHSin2);
-
- basegfx::B3DPoint aPos0(aCenter);
- fRx = aRadius.getX() * fVCos2;
- fRz = aRadius.getZ() * fVCos2;
- aPos0.setX(aPos0.getX() + (fRx * fHCos1));
- aPos0.setY(aPos0.getY() + (aRadius.getY() * fVSin2));
- aPos0.setZ(aPos0.getZ() + (fRz * fHSin1));
-
- basegfx::B3DPoint aPos3(aPos0);
- aPos3.setX(aCenter.getX() + (fRx * fHCos2));
- aPos3.setZ(aCenter.getZ() + (fRz * fHSin2));
-
- basegfx::B3DPolygon aRect3D;
- basegfx::B2DPolygon aTexture2D;
-
- aRect3D.append(aPos0);
- aRect3D.append(aPos1);
- aRect3D.append(aPos2);
- aRect3D.append(aPos3);
-
- if(GetCreateTexture())
- {
- basegfx::B2DPoint aTex1;
- aTex1.setX((double)(nUpperBound - (nH + 1)) / (double)nUpperBound);
- aTex1.setY((double)nV / (double)nUpperVert);
-
- basegfx::B2DPoint aTex2;
- aTex2.setX((double)((nUpperBound - (nH + 1)) - 1) / (double)nUpperBound);
- aTex2.setY(aTex1.getY());
-
- basegfx::B2DPoint aTex3;
- aTex3.setX(aTex2.getX());
- aTex3.setY((double)(nV+1) / (double)nUpperVert);
-
- basegfx::B2DPoint aTex0;
- aTex0.setX(aTex1.getX());
- aTex0.setY(aTex3.getY());
-
- aTexture2D.append(aTex0);
- aTexture2D.append(aTex1);
- aTexture2D.append(aTex2);
- aTexture2D.append(aTex3);
- }
-
- if(GetCreateNormals())
- {
- basegfx::B3DPolygon aNormal3D;
- basegfx::B3DVector aNorZwi;
-
- aNorZwi = aRect3D.getB3DPoint(0L); aNorZwi.normalize(); aNormal3D.append(aNorZwi);
- aNorZwi = aRect3D.getB3DPoint(1L); aNorZwi.normalize(); aNormal3D.append(aNorZwi);
- aNorZwi = aRect3D.getB3DPoint(2L); aNorZwi.normalize(); aNormal3D.append(aNorZwi);
- aNorZwi = aRect3D.getB3DPoint(3L); aNorZwi.normalize(); aNormal3D.append(aNorZwi);
-
- if(GetCreateTexture())
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormal3D), basegfx::B2DPolyPolygon(aTexture2D), FALSE);
- }
- else
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormal3D), FALSE);
- }
- }
- else
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), FALSE);
- }
- }
- }
-
- // call parent
- E3dCompoundObject::CreateGeometry();
-}
-
-/*************************************************************************
-|*
|* Identifier zurueckgeben
|*
\************************************************************************/
@@ -393,7 +149,7 @@ void E3dSphereObj::ReSegment(sal_uInt32 nHSegs, sal_uInt32 nVSegs)
GetProperties().SetObjectItemDirect(Svx3DHorizontalSegmentsItem(nHSegs));
GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(nVSegs));
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -426,7 +182,7 @@ void E3dSphereObj::SetCenter(const basegfx::B3DPoint& rNew)
if(aCenter != rNew)
{
aCenter = rNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -435,7 +191,7 @@ void E3dSphereObj::SetSize(const basegfx::B3DVector& rNew)
if(aSize != rNew)
{
aSize = rNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 18e17fcc28f5..6d57a9f1dd7a 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: view3d.cxx,v $
- * $Revision: 1.32 $
+ * $Revision: 1.32.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -73,6 +73,8 @@
#include <svx/sdr/overlay/overlaypolypolygon.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
#include <sdrpaintwindow.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
@@ -111,7 +113,7 @@ Impl3DMirrorConstructOverlay::Impl3DMirrorConstructOverlay(const E3dView& rView)
{
SdrMark *pMark = rMarkList.GetMark(a);
SdrObject *pObj = pMark->GetMarkedSdrObj();
- mpPolygons[mnCount - (a + 1L)] = pObj->TakeXorPoly(sal_False);
+ mpPolygons[mnCount - (a + 1L)] = pObj->TakeXorPoly();
}
}
@@ -279,138 +281,117 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const
SdrModel* E3dView::GetMarkedObjModel() const
{
// Existieren 3D-Objekte, deren Szenen nicht selektiert sind?
- BOOL bSpecialHandling = FALSE;
- E3dScene *pScene = NULL;
+ bool bSpecialHandling(false);
+ const sal_uInt32 nCount(GetMarkedObjectCount());
+ sal_uInt32 nObjs(0);
+ E3dScene *pScene = 0;
- long nCnt = GetMarkedObjectCount();
- for(long nObjs = 0;nObjs < nCnt;nObjs++)
+ for(nObjs = 0; nObjs < nCount; nObjs++)
{
- SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
- if(pObj && pObj->ISA(E3dCompoundObject))
+ const SdrObject* pObj = GetMarkedObjectByIndex(nObjs);
+
+ if(!bSpecialHandling && pObj && pObj->ISA(E3dCompoundObject))
{
- // zugehoerige Szene
+ // if the object is selected, but it's scene not,
+ // we need special handling
pScene = ((E3dCompoundObject*)pObj)->GetScene();
+
if(pScene && !IsObjMarked(pScene))
- bSpecialHandling = TRUE;
+ {
+ bSpecialHandling = true;
+ }
}
- // Alle SelectionFlags zuruecksetzen
+
if(pObj && pObj->ISA(E3dObject))
{
+ // reset all selection flags at 3D objects
pScene = ((E3dObject*)pObj)->GetScene();
+
if(pScene)
- pScene->SetSelected(FALSE);
+ {
+ pScene->SetSelected(false);
+ }
}
}
- SdrModel* pNewModel = 0L;
- if(bSpecialHandling)
+ if(!bSpecialHandling)
{
- // SelectionFlag bei allen zu 3D Objekten gehoerigen
- // Szenen und deren Objekten auf nicht selektiert setzen
- long nObjs;
- for(nObjs = 0;nObjs < nCnt;nObjs++)
- {
- SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
- if(pObj && pObj->ISA(E3dCompoundObject))
- {
- // zugehoerige Szene
- pScene = ((E3dCompoundObject*)pObj)->GetScene();
- if(pScene)
- pScene->SetSelected(FALSE);
- }
- }
- // bei allen direkt selektierten Objekten auf selektiert setzen
- for(nObjs = 0;nObjs < nCnt;nObjs++)
+ // call parent
+ return SdrView::GetMarkedObjModel();
+ }
+
+ SdrModel* pNewModel = 0;
+ Rectangle aSelectedSnapRect;
+
+ // set 3d selection flags at all directly selected objects
+ // and collect SnapRect of selected objects
+ for(nObjs = 0; nObjs < nCount; nObjs++)
+ {
+ SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+
+ if(pObj && pObj->ISA(E3dCompoundObject))
{
- SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
- if(pObj && pObj->ISA(E3dObject))
- {
- // Objekt markieren
- E3dObject* p3DObj = (E3dObject*)pObj;
- p3DObj->SetSelected(TRUE);
- }
+ // mark object, but not scenes
+ E3dCompoundObject* p3DObj = (E3dCompoundObject*)pObj;
+ p3DObj->SetSelected(true);
+ aSelectedSnapRect.Union(p3DObj->GetSnapRect());
}
+ }
- // Neue MarkList generieren, die die betroffenen
- // Szenen als markierte Objekte enthaelt
- SdrMarkList aOldML(GetMarkedObjectList()); // alte Marklist merken
- SdrMarkList aNewML; // neue leere Marklist
- SdrMarkList& rCurrentMarkList = ((E3dView*)this)->GetMarkedObjectListWriteAccess();
- rCurrentMarkList = aNewML; // ((E3dView*)this)->maMarkedObjectList = aNewML;
+ // create new mark list which contains all indirectly selected3d
+ // scenes as selected objects
+ SdrMarkList aOldML(GetMarkedObjectList());
+ SdrMarkList aNewML;
+ SdrMarkList& rCurrentMarkList = ((E3dView*)this)->GetMarkedObjectListWriteAccess();
+ rCurrentMarkList = aNewML;
- for(nObjs = 0;nObjs < nCnt;nObjs++)
+ for(nObjs = 0; nObjs < nCount; nObjs++)
+ {
+ SdrObject *pObj = aOldML.GetMark(nObjs)->GetMarkedSdrObj();
+
+ if(pObj && pObj->ISA(E3dObject))
{
- SdrObject *pObj = aOldML.GetMark(nObjs)->GetMarkedSdrObj();
- if(pObj)
- {
- if(pObj->ISA(E3dCompoundObject))
- {
- // zugehoerige Szene holen
- pScene = ((E3dCompoundObject*)pObj)->GetScene();
- if(pScene)
- pObj = pScene;
- }
+ pScene = ((E3dObject*)pObj)->GetScene();
- // Keine Objekte doppelt markieren
- // (dies koennten nur Szenen sein)
- if(!IsObjMarked(pObj))
- {
- if(GetSdrPageView())
- {
- ((E3dView*)this)->MarkObj(pObj, GetSdrPageView(), FALSE, TRUE);
- }
- }
+ if(pScene && !IsObjMarked(pScene) && GetSdrPageView())
+ {
+ ((E3dView*)this)->MarkObj(pScene, GetSdrPageView(), FALSE, TRUE);
}
}
+ }
- // call parent
- pNewModel = SdrView::GetMarkedObjModel();
+ // call parent. This will copy all scenes and the selection flags at the 3d objectss. So
+ // it will be possible to delete all non-selected 3d objects from the cloned 3d scenes
+ pNewModel = SdrView::GetMarkedObjModel();
- // Alle Szenen im kopierten Model in Ihren Ausdehnungen Korrigieren
- // und IsSelected zuruecksetzen
- if(pNewModel)
+ if(pNewModel)
+ {
+ for(sal_uInt16 nPg(0); nPg < pNewModel->GetPageCount(); nPg++)
{
- for(UINT16 nPg=0; nPg < pNewModel->GetPageCount(); nPg++)
+ const SdrPage* pSrcPg=pNewModel->GetPage(nPg);
+ const sal_uInt32 nObAnz(pSrcPg->GetObjCount());
+
+ for(sal_uInt32 nOb(0); nOb < nObAnz; nOb++)
{
- const SdrPage* pSrcPg=pNewModel->GetPage(nPg);
- UINT32 nObAnz=pSrcPg->GetObjCount();
+ const SdrObject* pSrcOb=pSrcPg->GetObj(nOb);
- // Unterobjekte von Szenen einfuegen
- for(UINT32 nOb=0; nOb<nObAnz; nOb++)
+ if(pSrcOb->ISA(E3dScene))
{
- const SdrObject* pSrcOb=pSrcPg->GetObj(nOb);
- if(pSrcOb->ISA(E3dScene))
- {
- pScene = (E3dScene*)pSrcOb;
- pScene->CorrectSceneDimensions();
- pScene->SetSelected(FALSE);
- }
- }
- }
- }
+ pScene = (E3dScene*)pSrcOb;
- // Alte Liste wieder setzen
- // ((E3dView*)this)->maMarkedObjectList= aOldML;
- rCurrentMarkList = aOldML;
+ // delete all not intentionally cloned 3d objects
+ pScene->removeAllNonSelectedObjects();
- // SelectionFlag zuruecksetzen
- for(nObjs = 0;nObjs < nCnt;nObjs++)
- {
- SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
- if(pObj && pObj->ISA(E3dCompoundObject))
- {
- // zugehoerige Szene
- pScene = ((E3dCompoundObject*)pObj)->GetScene();
- if(pScene)
- pScene->SetSelected(FALSE);
+ // reset select flags and set SnapRect of all selected objects
+ pScene->SetSelected(false);
+ pScene->SetSnapRect(aSelectedSnapRect);
+ }
}
}
}
- else
- {
- // call parent
- pNewModel = SdrView::GetMarkedObjModel();
- }
+
+ // restore old selection
+ rCurrentMarkList = aOldML;
// model zurueckgeben
return pNewModel;
@@ -440,7 +421,6 @@ BOOL E3dView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, U
if(pOwner && pOwner->ISA(E3dScene))
{
E3dScene* pDstScene = (E3dScene*)pOwner;
- BOOL bDstInserted(FALSE);
BegUndo(SVX_RESSTR(RID_SVX_3D_UNDO_EXCHANGE_PASTE));
// Alle Objekte aus E3dScenes kopieren und direkt einfuegen
@@ -460,19 +440,11 @@ BOOL E3dView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, U
if(pSrcOb->ISA(E3dScene))
{
E3dScene* pSrcScene = (E3dScene*)pSrcOb;
- bDstInserted = ImpCloneAll3DObjectsToDestScene(pSrcScene, pDstScene, aDist);
+ ImpCloneAll3DObjectsToDestScene(pSrcScene, pDstScene, aDist);
}
}
}
EndUndo();
-
- // DestScene anpassen
- if(bDstInserted)
- {
- pDstScene->SetRectsDirty();
- pDstScene->CorrectSceneDimensions();
- bRetval = TRUE;
- }
}
else
{
@@ -485,177 +457,107 @@ BOOL E3dView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, U
}
// #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...)
-BOOL E3dView::ImpCloneAll3DObjectsToDestScene(E3dScene* pSrcScene, E3dScene* pDstScene, Point aOffset)
+BOOL E3dView::ImpCloneAll3DObjectsToDestScene(E3dScene* pSrcScene, E3dScene* pDstScene, Point /*aOffset*/)
{
BOOL bRetval(FALSE);
if(pSrcScene && pDstScene)
{
- B3dCamera& rCameraSetDst = pDstScene->GetCameraSet();
- B3dCamera& rCameraSetSrc = pSrcScene->GetCameraSet();
+ const sdr::contact::ViewContactOfE3dScene& rVCSceneDst = static_cast< sdr::contact::ViewContactOfE3dScene& >(pDstScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3DDst(rVCSceneDst.getViewInformation3D());
+ const sdr::contact::ViewContactOfE3dScene& rVCSceneSrc = static_cast< sdr::contact::ViewContactOfE3dScene& >(pSrcScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3DSrc(rVCSceneSrc.getViewInformation3D());
for(sal_uInt32 i(0); i < pSrcScene->GetSubList()->GetObjCount(); i++)
{
- SdrObject* pObj = pSrcScene->GetSubList()->GetObj(i);
- if(pObj && pObj->ISA(E3dCompoundObject))
- {
- // Kopieren
- // E3dObject* pNew = (E3dObject*)pObj->Clone(pDstScene->GetPage(), pDstScene->GetModel());
+ E3dCompoundObject* pCompoundObj = dynamic_cast< E3dCompoundObject* >(pSrcScene->GetSubList()->GetObj(i));
+ if(pCompoundObj)
+ {
// #116235#
- E3dObject* pNew = (E3dObject*)pObj->Clone();
+ E3dCompoundObject* pNewCompoundObj = dynamic_cast< E3dCompoundObject* >(pCompoundObj->Clone());
- if(pNew)
+ if(pNewCompoundObj)
{
- // #116235#
- pNew->SetModel(pDstScene->GetModel());
- pNew->SetPage(pDstScene->GetPage());
-
- // Neues Objekt in Szene einfuegen
- pNew->NbcSetLayer(pObj->GetLayer());
- pNew->NbcSetStyleSheet(pObj->GetStyleSheet(), sal_True);
- pDstScene->Insert3DObj(pNew);
- bRetval = TRUE;
+ // get dest scene's current range in 3D world coordinates
+ const basegfx::B3DHomMatrix aSceneToWorldTrans(pDstScene->GetFullTransform());
+ basegfx::B3DRange aSceneRange(pDstScene->GetBoundVolume());
+ aSceneRange.transform(aSceneToWorldTrans);
+
+ // get new object's implied object transformation
+ const basegfx::B3DHomMatrix aNewObjectTrans(pNewCompoundObj->GetTransform());
+
+ // get new object's range in 3D world coordinates in dest scene
+ // as if it were already added
+ const basegfx::B3DHomMatrix aObjectToWorldTrans(aSceneToWorldTrans * aNewObjectTrans);
+ basegfx::B3DRange aObjectRange(pNewCompoundObj->GetBoundVolume());
+ aObjectRange.transform(aObjectToWorldTrans);
+
+ // get scale adaption
+ const basegfx::B3DVector aSceneScale(aSceneRange.getRange());
+ const basegfx::B3DVector aObjectScale(aObjectRange.getRange());
+ double fScale(1.0);
+
+ // if new object's size in X,Y or Z is bigger that 80% of dest scene, adapt scale
+ // to not change the scene by the inserted object
+ const double fSizeFactor(0.5);
+
+ if(aObjectScale.getX() * fScale > aSceneScale.getX() * fSizeFactor)
+ {
+ const double fObjSize(aObjectScale.getX() * fScale);
+ const double fFactor((aSceneScale.getX() * fSizeFactor) / (basegfx::fTools::equalZero(fObjSize) ? 1.0 : fObjSize));
+ fScale *= fFactor;
+ }
- // Transformation ObjectToEye Src
- basegfx::B3DHomMatrix aMatSrc;
- aMatSrc = ((E3dCompoundObject*)pObj)->GetFullTransform();
- aMatSrc *= rCameraSetSrc.GetOrientation();
-
- // Tanslation und scale von source
- basegfx::B3DRange aDevVolSrc(rCameraSetSrc.GetDeviceVolume());
-
- // auf Augkoordinaten umstellen
- aDevVolSrc = basegfx::B3DRange(
- aDevVolSrc.getMinX(), aDevVolSrc.getMinY(), -aDevVolSrc.getMaxZ(),
- aDevVolSrc.getMaxX(), aDevVolSrc.getMaxY(), -aDevVolSrc.getMinZ());
-
- basegfx::B3DPoint aProjScaleSrc(
- 2.0 / aDevVolSrc.getWidth(),
- 2.0 / aDevVolSrc.getHeight(),
- 2.0 / aDevVolSrc.getDepth());
- basegfx::B3DPoint aProjTransSrc(
- -1.0 * ((aDevVolSrc.getMaxX() + aDevVolSrc.getMinX()) / aDevVolSrc.getWidth()),
- -1.0 * ((aDevVolSrc.getMaxY() + aDevVolSrc.getMinY()) / aDevVolSrc.getHeight()),
- -1.0 * ((aDevVolSrc.getMaxZ() + aDevVolSrc.getMinZ()) / aDevVolSrc.getDepth()));
- basegfx::B3DPoint aViewScaleSrc(rCameraSetSrc.GetScale());
- aViewScaleSrc.setZ(1.0);
-
- // Tanslation und scale von dest
- basegfx::B3DRange aDevVolDst(rCameraSetDst.GetDeviceVolume());
-
- // auf Augkoordinaten umstellen
- aDevVolDst = basegfx::B3DRange(
- aDevVolDst.getMinX(), aDevVolDst.getMinY(), -aDevVolDst.getMaxZ(),
- aDevVolDst.getMaxX(), aDevVolDst.getMaxY(), -aDevVolDst.getMinZ());
-
- basegfx::B3DPoint aProjScaleDst(
- 2.0 / aDevVolDst.getWidth(),
- 2.0 / aDevVolDst.getHeight(),
- 2.0 / aDevVolDst.getDepth());
- basegfx::B3DPoint aProjTransDst(
- -1.0 * ((aDevVolDst.getMaxX() + aDevVolDst.getMinX()) / aDevVolDst.getWidth()),
- -1.0 * ((aDevVolDst.getMaxY() + aDevVolDst.getMinY()) / aDevVolDst.getHeight()),
- -1.0 * ((aDevVolDst.getMaxZ() + aDevVolDst.getMinZ()) / aDevVolDst.getDepth()));
- basegfx::B3DPoint aViewScaleDst(rCameraSetDst.GetScale());
- aViewScaleDst.setZ(1.0);
-
- // Groesse des Objektes in Augkoordinaten Src
- basegfx::B3DRange aObjVolSrc(((E3dCompoundObject*)pObj)->GetBoundVolume().GetTransformVolume(aMatSrc));
-
- // Vorlaeufige Groesse in Augkoordinaten Dst
- basegfx::B3DHomMatrix aMatZwi = aMatSrc;
- aMatZwi.scale(aProjScaleSrc.getX(), aProjScaleSrc.getY(), aProjScaleSrc.getZ());
- aMatZwi.translate(aProjTransSrc.getX(), aProjTransSrc.getY(), aProjTransSrc.getZ());
- aMatZwi.scale(aViewScaleSrc.getX(), aViewScaleSrc.getY(), aViewScaleSrc.getZ());
-
- basegfx::B3DHomMatrix aMatDst;
- aMatDst.scale(aProjScaleDst.getX(), aProjScaleDst.getY(), aProjScaleDst.getZ());
- aMatDst.translate(aProjTransDst.getX(), aProjTransDst.getY(), aProjTransDst.getZ());
- aMatDst.scale(aViewScaleDst.getX(), aViewScaleDst.getY(), aViewScaleDst.getZ());
- aMatDst.invert();
-
- aMatZwi *= aMatDst;
-
- basegfx::B3DRange aObjVolDst(((E3dCompoundObject*)pObj)->GetBoundVolume().GetTransformVolume(aMatZwi));
-
- // Beide verhaeltnistiefen berechnen und mitteln
- double fDepthOne = (aObjVolSrc.getDepth() * aObjVolDst.getWidth()) / aObjVolSrc.getWidth();
- double fDepthTwo = (aObjVolSrc.getDepth() * aObjVolDst.getHeight()) / aObjVolSrc.getHeight();
- double fWantedDepth = (fDepthOne + fDepthTwo) / 2.0;
-
- // Faktor zum Tiefe anpassen bilden
- double fFactor = fWantedDepth / aObjVolDst.getDepth();
- basegfx::B3DPoint aDepthScale(1.0, 1.0, fFactor);
-
- // Endgueltige Transformation bilden
- aMatSrc.scale(aProjScaleSrc.getX(), aProjScaleSrc.getY(), aProjScaleSrc.getZ());
- aMatSrc.translate(aProjTransSrc.getX(), aProjTransSrc.getY(), aProjTransSrc.getZ());
- aMatSrc.scale(aViewScaleSrc.getX(), aViewScaleSrc.getY(), aViewScaleSrc.getZ());
- aMatSrc.scale(aDepthScale.getX(), aDepthScale.getY(), aDepthScale.getZ());
-
- aMatDst = pDstScene->GetFullTransform();
- aMatDst *= rCameraSetDst.GetOrientation();
- aMatDst.scale(aProjScaleDst.getX(), aProjScaleDst.getY(), aProjScaleDst.getZ());
- aMatDst.translate(aProjTransDst.getX(), aProjTransDst.getY(), aProjTransDst.getZ());
- aMatDst.scale(aViewScaleDst.getX(), aViewScaleDst.getY(), aViewScaleDst.getZ());
- aMatDst.invert();
-
- aMatSrc *= aMatDst;
-
- // Neue Objekttransformation setzen
- pNew->SetTransform(aMatSrc);
-
- // force new camera and SnapRect on scene, geometry may have really
- // changed
- pDstScene->CorrectSceneDimensions();
-
- // #83403# translate in view coor
+ if(aObjectScale.getY() * fScale > aSceneScale.getY() * fSizeFactor)
{
- // screen position of center of old object
- basegfx::B3DHomMatrix aSrcFullTrans = ((E3dCompoundObject*)pObj)->GetFullTransform();
- rCameraSetSrc.SetObjectTrans(aSrcFullTrans);
- basegfx::B3DPoint aSrcCenter(((E3dCompoundObject*)pObj)->GetCenter());
- aSrcCenter = rCameraSetSrc.ObjectToViewCoor(aSrcCenter);
+ const double fObjSize(aObjectScale.getY() * fScale);
+ const double fFactor((aSceneScale.getY() * fSizeFactor) / (basegfx::fTools::equalZero(fObjSize) ? 1.0 : fObjSize));
+ fScale *= fFactor;
+ }
- if(aOffset.X() != 0 || aOffset.Y() != 0)
- {
- aSrcCenter += basegfx::B3DPoint((double)aOffset.X(), (double)aOffset.Y(), 0.0);
- }
+ if(aObjectScale.getZ() * fScale > aSceneScale.getZ() * fSizeFactor)
+ {
+ const double fObjSize(aObjectScale.getZ() * fScale);
+ const double fFactor((aSceneScale.getZ() * fSizeFactor) / (basegfx::fTools::equalZero(fObjSize) ? 1.0 : fObjSize));
+ fScale *= fFactor;
+ }
- // to have a valid Z-Coor in dst system, calc current center of dst object
- basegfx::B3DHomMatrix aDstFullTrans = pNew->GetFullTransform();
- rCameraSetDst.SetObjectTrans(aDstFullTrans);
- basegfx::B3DPoint aDstCenter(pNew->GetCenter());
- aDstCenter = rCameraSetDst.ObjectToEyeCoor(aDstCenter);
+ // get translation adaption
+ const basegfx::B3DPoint aSceneCenter(aSceneRange.getCenter());
+ const basegfx::B3DPoint aObjectCenter(aObjectRange.getCenter());
- // convert aSrcCenter to a eye position of dst scene
- basegfx::B3DPoint aNewDstCenter(rCameraSetDst.ViewToEyeCoor(aSrcCenter));
- aNewDstCenter.setZ(aDstCenter.getZ());
+ // build full modification transform. The object's transformation
+ // shall be modified, so start at object coordinates; transform to 3d world coor
+ basegfx::B3DHomMatrix aModifyingTransform(aObjectToWorldTrans);
- // transform back to object coor
- aNewDstCenter = rCameraSetDst.EyeToObjectCoor(aNewDstCenter);
+ // translate to absolute center in 3d world coor
+ aModifyingTransform.translate(-aObjectCenter.getX(), -aObjectCenter.getY(), -aObjectCenter.getZ());
- // get transform vector
- basegfx::B3DPoint aTransformCorrection(aNewDstCenter - pNew->GetCenter());
- basegfx::B3DHomMatrix aTransCorrMat;
- aTransCorrMat.translate(aTransformCorrection.getX(), aTransformCorrection.getY(), aTransformCorrection.getZ());
+ // scale to dest size in 3d world coor
+ aModifyingTransform.scale(fScale, fScale, fScale);
- // treanslate new object, add translate in front of obj transform
- pNew->SetTransform(pNew->GetTransform() * aTransCorrMat); // #112587#
+ // translate to dest scene center in 3d world coor
+ aModifyingTransform.translate(aSceneCenter.getX(), aSceneCenter.getY(), aSceneCenter.getZ());
- // force new camera and SnapRect on scene, geometry may have really
- // changed
- pDstScene->CorrectSceneDimensions();
+ // transform from 3d world to dest object coordinates
+ basegfx::B3DHomMatrix aWorldToObject(aObjectToWorldTrans);
+ aWorldToObject.invert();
+ aModifyingTransform = aWorldToObject * aModifyingTransform;
- //Rectangle aOldPosSize = pObj->GetSnapRect();
- //if(aOffset.X() != 0 || aOffset.Y() != 0)
- // aOldPosSize.Move(aOffset.X(), aOffset.Y());
- //Rectangle aNewPosSize = pNew->GetSnapRect();
- }
+ // correct implied object transform by applying changing one in object coor
+ pNewCompoundObj->SetTransform(aModifyingTransform * aNewObjectTrans);
+
+ // fill and insert new object
+ pNewCompoundObj->SetModel(pDstScene->GetModel());
+ pNewCompoundObj->SetPage(pDstScene->GetPage());
+ pNewCompoundObj->NbcSetLayer(pCompoundObj->GetLayer());
+ pNewCompoundObj->NbcSetStyleSheet(pCompoundObj->GetStyleSheet(), sal_True);
+ pDstScene->Insert3DObj(pNewCompoundObj);
+ bRetval = TRUE;
// Undo anlegen
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pNew));
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pNewCompoundObj));
}
}
}
@@ -952,7 +854,7 @@ void E3dView::ConvertMarkedObjTo3D(BOOL bExtrude, basegfx::B2DPoint aPnt1, baseg
basegfx::B2DPoint aDiff(aPnt1 - aPnt2);
fRot3D = atan2(aDiff.getY(), aDiff.getX()) - F_PI2;
- if(fabs(fRot3D) < SMALL_DVALUE)
+ if(basegfx::fTools::equalZero(fabs(fRot3D)))
fRot3D = 0.0;
if(fRot3D != 0.0)
@@ -1034,7 +936,7 @@ void E3dView::ConvertMarkedObjTo3D(BOOL bExtrude, basegfx::B2DPoint aPnt1, baseg
DoDepthArrange(pScene, fDepth);
// 3D-Objekte auf die Mitte des Gesamtrechtecks zentrieren
- basegfx::B3DPoint aCenter(pScene->GetCenter());
+ basegfx::B3DPoint aCenter(pScene->GetBoundVolume().getCenter());
basegfx::B3DHomMatrix aMatrix;
aMatrix.translate(-aCenter.getX(), -aCenter.getY(), -aCenter.getZ());
@@ -1042,13 +944,9 @@ void E3dView::ConvertMarkedObjTo3D(BOOL bExtrude, basegfx::B2DPoint aPnt1, baseg
// Szene initialisieren
pScene->NbcSetSnapRect(aRect);
- Volume3D aBoundVol = pScene->GetBoundVolume();
+ basegfx::B3DRange aBoundVol = pScene->GetBoundVolume();
InitScene(pScene, (double)aRect.GetWidth(), (double)aRect.GetHeight(), aBoundVol.getDepth());
- // Transformationen initialisieren, damit bei RecalcSnapRect()
- // richtig gerechnet wird
- pScene->InitTransformationSet();
-
// Szene anstelle des ersten selektierten Objektes einfuegen
// und alle alten Objekte weghauen
SdrObject* pRepObj = GetMarkedObjectByIndex(0);
@@ -1059,17 +957,25 @@ void E3dView::ConvertMarkedObjTo3D(BOOL bExtrude, basegfx::B2DPoint aPnt1, baseg
MarkObj(pScene, pPV);
// Rotationskoerper um Rotationsachse drehen
+ basegfx::B3DHomMatrix aRotate;
+
if(!bExtrude && fRot3D != 0.0)
{
- pScene->RotateZ(fRot3D);
+ aRotate.rotate(0.0, 0.0, fRot3D);
}
// Default-Rotation setzen
- double XRotateDefault = 20;
- pScene->RotateX(DEG2RAD(XRotateDefault));
+ {
+ double XRotateDefault = 20;
+ aRotate.rotate(DEG2RAD(XRotateDefault), 0.0, 0.0);
+ }
+
+ if(!aRotate.isIdentity())
+ {
+ pScene->SetTransform(aRotate * pScene->GetTransform());
+ }
// SnapRects der Objekte ungueltig
- pScene->CorrectSceneDimensions();
pScene->SetSnapRect(aRect);
}
else
@@ -1454,11 +1360,8 @@ E3dScene* E3dView::SetCurrent3DObj(E3dObject* p3DObj)
E3dScene* pScene = NULL;
// get transformed BoundVolume of the object
- Volume3D aVolume;
- const Volume3D& rObjVol = p3DObj->GetBoundVolume();
- const basegfx::B3DHomMatrix& rObjTrans = p3DObj->GetTransform();
- aVolume.expand(rObjVol.GetTransformVolume(rObjTrans));
-
+ basegfx::B3DRange aVolume(p3DObj->GetBoundVolume());
+ aVolume.transform(p3DObj->GetTransform());
double fW(aVolume.getWidth());
double fH(aVolume.getHeight());
@@ -1554,17 +1457,17 @@ void E3dView::Start3DCreation()
for(sal_uInt32 nMark(0L); nMark < GetMarkedObjectCount(); nMark++)
{
SdrObject* pMark = GetMarkedObjectByIndex(nMark);
- basegfx::B2DPolyPolygon aXPP(pMark->TakeXorPoly(FALSE));
+ basegfx::B2DPolyPolygon aXPP(pMark->TakeXorPoly());
aR.expand(basegfx::tools::getRange(aXPP));
}
basegfx::B2DPoint aCenter(aR.getCenter());
- long nMarkHgt = FRound(aR.getHeight()) - 1;
+ long nMarkHgt = basegfx::fround(aR.getHeight()) - 1;
long nHgt = nMarkHgt + nObjDst * 2;
if (nHgt < nMinLen) nHgt = nMinLen;
- long nY1 = FRound(aCenter.getY()) - (nHgt + 1) / 2;
+ long nY1 = basegfx::fround(aCenter.getY()) - (nHgt + 1) / 2;
long nY2 = nY1 + nHgt;
if (pOut && (nMinLen > nOutHgt)) nMinLen = nOutHgt;
@@ -1582,7 +1485,7 @@ void E3dView::Start3DCreation()
}
}
- aRef1.X() = FRound(aR.getMinX()); // Initial Achse um 2/100mm nach links
+ aRef1.X() = basegfx::fround(aR.getMinX()); // Initial Achse um 2/100mm nach links
aRef1.Y() = nY1;
aRef2.X() = aRef1.X();
aRef2.Y() = nY2;
@@ -1844,7 +1747,7 @@ void E3dView::MergeScenes ()
ULONG nObj = 0;
SdrObject *pObj = GetMarkedObjectByIndex(nObj);
E3dScene *pScene = new E3dPolyScene(Get3DDefaultAttributes());
- Volume3D aBoundVol;
+ basegfx::B3DRange aBoundVol;
Rectangle aAllBoundRect (GetMarkedObjBoundRect ());
Point aCenter (aAllBoundRect.Center());
@@ -1924,8 +1827,6 @@ void E3dView::MergeScenes ()
Rectangle aRect(0,0, (long) fW, (long) fH);
InitScene(pScene, fW, fH, aBoundVol.getMaxZ() + + ((fW + fH) / 4.0));
-
- pScene->FitSnapRectToBoundVol();
pScene->NbcSetSnapRect(aRect);
Camera3D &aCamera = (Camera3D&) pScene->GetCamera ();
@@ -1942,10 +1843,6 @@ void E3dView::MergeScenes ()
// SnapRects der Objekte ungueltig
pScene->SetRectsDirty();
- // Transformationen initialisieren, damit bei RecalcSnapRect()
- // richtig gerechnet wird
- pScene->InitTransformationSet();
-
InsertObjectAtView(pScene, *(GetSdrPageViewOfMarkedByIndex(0)));
// SnapRects der Objekte ungueltig
diff --git a/svx/source/engine3d/view3d1.cxx b/svx/source/engine3d/view3d1.cxx
index 58c926a15f10..0b8d2c929edc 100644
--- a/svx/source/engine3d/view3d1.cxx
+++ b/svx/source/engine3d/view3d1.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: view3d1.cxx,v $
- * $Revision: 1.15 $
+ * $Revision: 1.15.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 <tools/shl.hxx>
#include "svditer.hxx"
#include <svx/svdpool.hxx>
@@ -54,6 +53,7 @@
#include <svx/cube3d.hxx>
#include <svx/xflclit.hxx>
#include <svx/svdogrp.hxx>
+#include <svx/e3dsceneupdater.hxx>
/*************************************************************************
|*
@@ -95,7 +95,7 @@ void E3dView::ConvertMarkedToPolyObj(BOOL bLineToArea)
|*
\************************************************************************/
-void Imp_E3dView_InorderRun3DObjects(const SdrObject* pObj, sal_uInt32& rMask, BOOL bCorrectScenes)
+void Imp_E3dView_InorderRun3DObjects(const SdrObject* pObj, sal_uInt32& rMask)
{
if(pObj->ISA(E3dLatheObj))
{
@@ -115,12 +115,9 @@ void Imp_E3dView_InorderRun3DObjects(const SdrObject* pObj, sal_uInt32& rMask, B
}
else if(pObj->IsGroupObject())
{
- if(bCorrectScenes && pObj->ISA(E3dScene))
- ((E3dScene*)pObj)->CorrectSceneDimensions();
-
SdrObjList* pList = pObj->GetSubList();
for(sal_uInt32 a(0); a < pList->GetObjCount(); a++)
- Imp_E3dView_InorderRun3DObjects(pList->GetObj(a), rMask, bCorrectScenes);
+ Imp_E3dView_InorderRun3DObjects(pList->GetObj(a), rMask);
}
}
@@ -152,7 +149,7 @@ SfxItemSet E3dView::Get3DAttributes(E3dScene* pInScene, BOOL /*bOnly3DAttr*/) co
for(sal_uInt32 a(0); a < nMarkCnt; a++)
{
SdrObject* pObj = GetMarkedObjectByIndex(a);
- Imp_E3dView_InorderRun3DObjects(pObj, nSelectedItems, FALSE);
+ Imp_E3dView_InorderRun3DObjects(pObj, nSelectedItems);
}
}
@@ -196,20 +193,38 @@ void E3dView::Set3DAttributes( const SfxItemSet& rAttr, E3dScene* pInScene, BOOL
}
else
{
+ const SdrMarkList& rMarkList = GetMarkedObjectList();
+ const sal_uInt32 nMarkCnt(rMarkList.GetMarkCount());
+ std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
+ sal_uInt32 a;
+
+ // create late modifiers for evtl. updatable scenes
+ for(a = 0; a < nMarkCnt; a++)
+ {
+ SdrObject* pObj = GetMarkedObjectByIndex(a);
+
+ if(dynamic_cast< E3dObject* >(pObj))
+ {
+ aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(GetMarkedObjectByIndex(a)));
+ }
+ }
+
// set at selected objects
SetAttrToMarked(rAttr, bReplaceAll);
- // Durchlauf mit Korrektur der veraenderten Szenen,
- // da die enthaltenen Objekte geometrisch veraendert sein koennen
- const SdrMarkList& rMarkList = GetMarkedObjectList();
- sal_uInt32 nMarkCnt(rMarkList.GetMarkCount());
-
- for(sal_uInt32 a(0); a < nMarkCnt; a++)
+ // old run
+ for(a = 0; a < nMarkCnt; a++)
{
SdrObject* pObj = GetMarkedObjectByIndex(a);
- Imp_E3dView_InorderRun3DObjects(pObj, nSelectedItems, TRUE);
+ Imp_E3dView_InorderRun3DObjects(pObj, nSelectedItems);
}
+ // fire scene updaters
+ while(aUpdaters.size())
+ {
+ delete aUpdaters.back();
+ aUpdaters.pop_back();
+ }
}
// DefaultValues pflegen
diff --git a/svx/source/engine3d/viewpt3d.cxx b/svx/source/engine3d/viewpt3d.cxx
index 1f1b4f90ec3f..93ed2f429a8b 100644
--- a/svx/source/engine3d/viewpt3d.cxx
+++ b/svx/source/engine3d/viewpt3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewpt3d.cxx,v $
- * $Revision: 1.10 $
+ * $Revision: 1.10.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,29 +31,5 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
#include <svx/viewpt3d.hxx>
-#include <svx/volume3d.hxx>
-
-/*************************************************************************
-|*
-|* View-Window genau um das mit rTransform transformierte Volumen legen
-|*
-\************************************************************************/
-
-void Viewport3D::FitViewToVolume(const basegfx::B3DRange& rVolume, const basegfx::B3DHomMatrix& rTransform)
-{
- basegfx::B3DHomMatrix aTransform(rTransform);
- basegfx::B3DPoint aTfVec;
- Volume3D aFitVol;
-
- aTransform *= GetViewTransform();
- Vol3DPointIterator aIter(rVolume, &aTransform);
-
- while ( aIter.Next(aTfVec) )
- {
- aTfVec = DoProjection(aTfVec);
- aFitVol.expand(aTfVec);
- }
- SetViewWindow(aFitVol.getMinX(), aFitVol.getMinY(), aFitVol.getWidth(), aFitVol.getHeight());
-}
// eof
diff --git a/svx/source/engine3d/volume3d.cxx b/svx/source/engine3d/volume3d.cxx
index 62188a31641e..8695b59f1a0b 100644
--- a/svx/source/engine3d/volume3d.cxx
+++ b/svx/source/engine3d/volume3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: volume3d.cxx,v $
- * $Revision: 1.7 $
+ * $Revision: 1.7.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,238 +31,5 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
#include <svx/volume3d.hxx>
-#include <basegfx/polygon/b3dpolygon.hxx>
-#include <tools/debug.hxx>
-
-/*************************************************************************
-|*
-|* Konstruktor 1: |
-|* rPos: Zentrum oder minimale Koordinate links, unten, hinten |__
-|* (abhaengig von bPosIsCenter) /
-|*
-\************************************************************************/
-
-Volume3D::Volume3D(const basegfx::B3DPoint& rPos, const basegfx::B3DPoint& r3DSize, bool bPosIsCenter)
-: basegfx::B3DRange()
-{
- if(bPosIsCenter)
- {
- expand(rPos - r3DSize / 2.0);
- }
- else
- {
- expand(rPos);
- }
-
- expand(getMinimum() + r3DSize);
-}
-
-Volume3D::Volume3D(const basegfx::B3DRange& rVol)
-: basegfx::B3DRange(rVol)
-{
-}
-
-/*************************************************************************
-|*
-|* Konstruktor 2 - leeres Volumen, Werte als ungueltig markieren
-|*
-\************************************************************************/
-
-Volume3D::Volume3D()
-: basegfx::B3DRange()
-{
-}
-
-/*************************************************************************
-|*
-|* Transformation des Volumens berechnen und als neues Volumen
-|* zurueckgeben
-|*
-\************************************************************************/
-
-Volume3D Volume3D::GetTransformVolume(const basegfx::B3DHomMatrix& rTfMatrix) const
-{
- Volume3D aTfVol;
-
- if(!isEmpty())
- {
- basegfx::B3DPoint aTfVec;
- Vol3DPointIterator aIter(*this, &rTfMatrix);
-
- while(aIter.Next(aTfVec))
- {
- aTfVol.expand(aTfVec);
- }
- }
- return aTfVol;
-}
-
-/*************************************************************************
-|*
-|* Drahtgitter-Linien fuer das Volumen berechnen und in rPoly3D ablegen
-|*
-\************************************************************************/
-
-void Volume3D::CreateWireframe(basegfx::B3DPolygon& rPoly3D, const basegfx::B3DHomMatrix* pTf) const
-{
- if(isEmpty())
- return;
-
- basegfx::B3DVector aDiff(getRange());
- basegfx::B3DPolygon aVolPnts;
- sal_uInt32 nZeroCnt(0L);
-
- // Alle Punkte holen
- Vol3DPointIterator aIter(*this, pTf);
- basegfx::B3DPoint aTfVec;
-
- while(aIter.Next(aTfVec))
- {
- aVolPnts.append(aTfVec);
- }
-
- // 0-Ausmasse des BoundVolumes zaehlen
- if(0.0 == aDiff.getX())
- nZeroCnt++;
- if(0.0 == aDiff.getY())
- nZeroCnt++;
- if(0.0 == aDiff.getZ())
- nZeroCnt++;
-
- // Die drei Ecksegemente des Volumens mit je drei Linien ausgeben;
- // falls Koordinatenanteile 0 sind, nicht alle Segmente verwenden,
- // um das gegenseitige Ausloeschen bei XOR-Ausgabe zu verhindern
- // 4
- // | Dieses Segment immer
- // |
- // 0---1
- // /
- // 3
- // Die Liniensegmente eines Segments werden immer in der Reihenfolge
- // X-, Y- und dann Z-Richtung ausgegeben (gilt natuerlich nur fuer
- // untransformierte Koordinaten)
-
- rPoly3D.append(aVolPnts.getB3DPoint(0));
-
- if(nZeroCnt < 3L)
- {
- // wenn keine Ausdehnung, dann nur den ersten Punkt einfuegen
- rPoly3D.append(aVolPnts.getB3DPoint(1L));
- rPoly3D.append(aVolPnts.getB3DPoint(0L));
- rPoly3D.append(aVolPnts.getB3DPoint(4L));
- rPoly3D.append(aVolPnts.getB3DPoint(0L));
- rPoly3D.append(aVolPnts.getB3DPoint(3L));
- }
- if(nZeroCnt < 2L)
- {
- if(nZeroCnt == 0L || aDiff.getX() == 0.0)
- {
- // 4
- // /
- // 7---6
- // |
- // |
- // 3
- rPoly3D.append(aVolPnts.getB3DPoint(7L));
- rPoly3D.append(aVolPnts.getB3DPoint(6L));
- rPoly3D.append(aVolPnts.getB3DPoint(7L));
- rPoly3D.append(aVolPnts.getB3DPoint(3L));
- rPoly3D.append(aVolPnts.getB3DPoint(7L));
- rPoly3D.append(aVolPnts.getB3DPoint(4L));
- }
- if(nZeroCnt == 0L || (aDiff.getY() == 0.0))
- {
- // 6
- // | 1
- // |/
- // 3---2
- rPoly3D.append(aVolPnts.getB3DPoint(2L));
- rPoly3D.append(aVolPnts.getB3DPoint(3L));
- rPoly3D.append(aVolPnts.getB3DPoint(2L));
- rPoly3D.append(aVolPnts.getB3DPoint(6L));
- rPoly3D.append(aVolPnts.getB3DPoint(2L));
- rPoly3D.append(aVolPnts.getB3DPoint(1L));
- }
- if(nZeroCnt == 0L || (aDiff.getZ() == 0.0))
- {
- // 4---5
- // /|
- // 6 |
- // 1
- rPoly3D.append(aVolPnts.getB3DPoint(5L));
- rPoly3D.append(aVolPnts.getB3DPoint(4L));
- rPoly3D.append(aVolPnts.getB3DPoint(5L));
- rPoly3D.append(aVolPnts.getB3DPoint(1L));
- rPoly3D.append(aVolPnts.getB3DPoint(5L));
- rPoly3D.append(aVolPnts.getB3DPoint(6L));
- }
- }
-}
-
-/*************************************************************************
-|*
-|* Konstruktor des Point-Iterators
-|*
-\************************************************************************/
-
-Vol3DPointIterator::Vol3DPointIterator(const basegfx::B3DRange& rVol, const basegfx::B3DHomMatrix* pTf)
-: rVolume(rVol),
- pTransform(pTf),
- nIndex(0)
-{
- // #i72532# Assert not needed, nothing bad happens when the volume is empty.
- // DBG_ASSERT(!rVol.isEmpty(), "Vol3DPointIterator-Aufruf mit ungueltigem Volume3D!");
- a3DExtent = rVolume.getMaximum() - rVolume.getMinimum();
-}
-
-/*************************************************************************
-|*
-|* Gibt die einzelnen Punkte des (ggf. transformierten) Volumens zurueck
-|*
-|* 4---5 -> Reihenfolge der Punktausgabe (untransformiert)
-|* /| /|
-|* 7---6 |
-|* | 0-|-1
-|* |/ |/
-|* 3---2
-|*
-\************************************************************************/
-
-bool Vol3DPointIterator::Next(basegfx::B3DPoint& rVec)
-{
- if(nIndex > 7)
- {
- return false;
- }
- else
- {
- rVec = rVolume.getMinimum();
-
- if(nIndex >= 4)
- {
- rVec.setY(rVec.getY() + a3DExtent.getY());
- }
-
- switch(nIndex)
- {
- case 6:
- case 2: rVec.setZ(rVec.getZ() + a3DExtent.getZ());
- case 5:
- case 1: rVec.setX(rVec.getX() + a3DExtent.getX());
- break;
- case 7:
- case 3: rVec.setZ(rVec.getZ() + a3DExtent.getZ());
- break;
- }
- nIndex++;
-
- if(pTransform)
- {
- rVec *= *pTransform;
- }
-
- return true;
- }
-}
// eof
diff --git a/svx/source/msfilter/msashape3d.cxx b/svx/source/msfilter/msashape3d.cxx
index 508d863fcf0b..7d8b81edf31e 100644
--- a/svx/source/msfilter/msashape3d.cxx
+++ b/svx/source/msfilter/msashape3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: msashape3d.cxx,v $
- * $Revision: 1.13 $
+ * $Revision: 1.13.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -324,8 +324,7 @@ SdrObject* SvxMSDffCustomShape3D::Create3DObject( const SdrObject* pObj, const D
// Kameraeinstellungen, Perspektive ...
Camera3D& rCamera = (Camera3D&)pScene->GetCamera();
- const Volume3D& rVolume = pScene->GetBoundVolume();
- pScene->CorrectSceneDimensions();
+ const basegfx::B3DRange& rVolume = pScene->GetBoundVolume();
pScene->NbcSetSnapRect( rSnapRect );
// InitScene replacement
@@ -406,7 +405,6 @@ SdrObject* SvxMSDffCustomShape3D::Create3DObject( const SdrObject* pObj, const D
pScene->SetCamera( rCamera );
}
pScene->NbcSetTransform( aNewTransform );
- pScene->FitSnapRectToBoundVol();
///////////
// light //
@@ -480,7 +478,6 @@ SdrObject* SvxMSDffCustomShape3D::Create3DObject( const SdrObject* pObj, const D
pScene->SetMergedItem( Svx3DMaterialSpecularIntensityItem( nItensity ) );
pScene->SetModel( pObj->GetModel() );
- pScene->InitTransformationSet();
pRet->SetSnapRect( CalculateNewSnapRect( rSnapRect, rPropSet ) );
// removing placeholder objects
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index c1d47f73380a..c550593f6f75 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: objectcontactofpageview.cxx,v $
- * $Revision: 1.20 $
+ * $Revision: 1.20.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -194,7 +194,7 @@ namespace sdr
{
// use visible pixels, but transform to world coordinates
const Size aOutputSizePixel(rTargetOutDev.GetOutputSizePixel());
- aViewRange = ::basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight());
+ aViewRange = basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight());
// if a clip region is set, use it
if(!rDisplayInfo.GetRedrawArea().IsEmpty())
@@ -238,7 +238,11 @@ namespace sdr
// and may use the MapMode from the Target OutDev in the DisplayInfo
drawinglayer::primitive2d::Primitive2DSequence xPrimitiveSequence(rDrawPageVOContact.getPrimitive2DSequenceHierarchy(rDisplayInfo));
- // if there is something to show, use a vclProcessor to render it
+ // if there is something to show, use a primitive processor to render it. There
+ // is a choice between VCL and Canvas processors currently. The decision is made in
+ // createBaseProcessor2DFromOutputDevice and takes into accout things like the
+ // Target is a MetaFile, a VDev or something else. The Canvas renderer is triggered
+ // currently using the shown boolean. Canvas is not yet the default.
if(xPrimitiveSequence.hasElements())
{
// prepare OutputDevice (historical stuff, maybe soon removed)
diff --git a/svx/source/sdr/contact/objectcontacttools.cxx b/svx/source/sdr/contact/objectcontacttools.cxx
index 2ca190e8ddb8..379d263058b3 100644
--- a/svx/source/sdr/contact/objectcontacttools.cxx
+++ b/svx/source/sdr/contact/objectcontacttools.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: objectcontacttools.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -71,7 +71,7 @@ namespace sdr
if(bTryToTestCanvas)
{
// create test-cancas-Processor
- return new drawinglayer::processor2d::canvasProcessor2D(rViewInformation2D, rTargetOutDev.GetCanvas());
+ return new drawinglayer::processor2d::canvasProcessor2D(rViewInformation2D, rTargetOutDev);
}
else
{
diff --git a/svx/source/sdr/contact/viewcontactofe3d.cxx b/svx/source/sdr/contact/viewcontactofe3d.cxx
index 1bc2d1acb422..f8d2558baf90 100644
--- a/svx/source/sdr/contact/viewcontactofe3d.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3d.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: viewcontactofe3d.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -39,6 +39,45 @@
#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
#include <drawinglayer/attribute/sdrattribute.hxx>
#include <drawinglayer/attribute/sdrattribute3d.hxx>
+#include <svx/scene3d.hxx>
+#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ const sdr::contact::ViewContactOfE3dScene* tryToFindVCOfE3DScene(
+ const sdr::contact::ViewContact& rCandidate,
+ basegfx::B3DHomMatrix& o_rInBetweenObjectTransform)
+ {
+ const sdr::contact::ViewContactOfE3dScene* pSceneParent =
+ dynamic_cast< const sdr::contact::ViewContactOfE3dScene* >(rCandidate.GetParentContact());
+
+ if(pSceneParent)
+ {
+ // each 3d object (including in-between scenes) should have a scene as parent
+ const sdr::contact::ViewContactOfE3dScene* pSceneParentParent =
+ dynamic_cast< const sdr::contact::ViewContactOfE3dScene* >(pSceneParent->GetParentContact());
+
+ if(pSceneParentParent)
+ {
+ // the parent scene of rCandidate is a in-between scene, call recursively and collect
+ // the in-between scene's object transformation part in o_rInBetweenObjectTransform
+ const basegfx::B3DHomMatrix& rSceneParentTransform = pSceneParent->GetE3dScene().GetTransform();
+ o_rInBetweenObjectTransform = rSceneParentTransform * o_rInBetweenObjectTransform;
+ return tryToFindVCOfE3DScene(*pSceneParent, o_rInBetweenObjectTransform);
+ }
+ else
+ {
+ // the parent scene is the outmost scene
+ return pSceneParent;
+ }
+ }
+
+ // object hierarchy structure is incorrect; no result
+ return 0;
+ }
+} // end of anonymous namespace
//////////////////////////////////////////////////////////////////////////////
@@ -53,14 +92,19 @@ namespace sdr
if(rxContent3D.hasElements())
{
- // try to get the ViewObjectContactOfE3dScene for this single 3d object
- const ViewContactOfE3dScene* pVCOfE3DScene = tryToFindVCOfE3DScene();
+ // try to get the outmost ViewObjectContactOfE3dScene for this single 3d object,
+ // the ones on the way there are grouping scenes. Collect the in-between scene's
+ // transformations to build a correct object transformation for the embedded
+ // object
+ basegfx::B3DHomMatrix aInBetweenObjectTransform;
+ const ViewContactOfE3dScene* pVCOfE3DScene = tryToFindVCOfE3DScene(*this, aInBetweenObjectTransform);
if(pVCOfE3DScene)
{
basegfx::B3DVector aLightNormal;
const double fShadowSlant(pVCOfE3DScene->getSdrSceneAttribute().getShadowSlant());
const basegfx::B3DRange& rAllContentRange = pVCOfE3DScene->getAllContentRange3D();
+ drawinglayer::geometry::ViewInformation3D aViewInformation3D(pVCOfE3DScene->getViewInformation3D());
if(pVCOfE3DScene->getSdrLightingAttribute().getLightVector().size())
{
@@ -69,12 +113,25 @@ namespace sdr
aLightNormal.normalize();
}
+ if(!aInBetweenObjectTransform.isIdentity())
+ {
+ // if aInBetweenObjectTransform is used, create combined ViewInformation3D which
+ // contains the correct object transformation for the embedded 3d object
+ aViewInformation3D = drawinglayer::geometry::ViewInformation3D(
+ aViewInformation3D.getObjectTransformation() * aInBetweenObjectTransform,
+ aViewInformation3D.getOrientation(),
+ aViewInformation3D.getProjection(),
+ aViewInformation3D.getDeviceToView(),
+ aViewInformation3D.getViewTime(),
+ aViewInformation3D.getExtendedInformationSequence());
+ }
+
// create embedded 2d primitive and add. LightNormal and ShadowSlant are needed for evtl.
// 3D shadow extraction for correct B2DRange calculation (shadow is part of the object)
const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::Embedded3DPrimitive2D(
rxContent3D,
pVCOfE3DScene->getObjectTransformation(),
- pVCOfE3DScene->getViewInformation3D(),
+ aViewInformation3D,
aLightNormal,
fShadowSlant,
rAllContentRange));
@@ -95,10 +152,10 @@ namespace sdr
{
}
- drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3d::getViewIndependentPrimitive3DSequence() const
+ drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3d::getVIP3DSWithoutObjectTransform() const
{
// local up-to-date checks. Create new list and compare.
- const drawinglayer::primitive3d::Primitive3DSequence xNew(createViewIndependentPrimitive3DSequence());
+ drawinglayer::primitive3d::Primitive3DSequence xNew(createViewIndependentPrimitive3DSequence());
if(!drawinglayer::primitive3d::arePrimitive3DSequencesEqual(mxViewIndependentPrimitive3DSequence, xNew))
{
@@ -110,38 +167,34 @@ namespace sdr
return mxViewIndependentPrimitive3DSequence;
}
- drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3d::createViewIndependentPrimitive2DSequence() const
- {
- // also need to create a 2D embedding when the view-independent part is requested,
- // see view-dependent part in ViewObjectContactOfE3d::createPrimitive2DSequence
- // get 3d primitive vector, isPrimitiveVisible() is done in 3d creator
- return impCreateWithGivenPrimitive3DSequence(getViewIndependentPrimitive3DSequence());
- }
-
- const ViewContactOfE3dScene* ViewContactOfE3d::tryToFindVCOfE3DScene() const
+ drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3d::getViewIndependentPrimitive3DSequence() const
{
- const ViewContact* pParent = GetParentContact();
+ // get sequence without object transform
+ drawinglayer::primitive3d::Primitive3DSequence xRetval(getVIP3DSWithoutObjectTransform());
- if(pParent)
+ if(xRetval.hasElements())
{
- const ViewContactOfE3dScene* pSceneParent = dynamic_cast< const ViewContactOfE3dScene* >(pParent);
+ // add object transform if it's used
+ const basegfx::B3DHomMatrix& rObjectTransform(GetE3dObject().GetTransform());
- if(pSceneParent)
+ if(!rObjectTransform.isIdentity())
{
- return pSceneParent;
- }
- else
- {
- const ViewContactOfE3d* p3dParent = dynamic_cast< const ViewContactOfE3d* >(pParent);
-
- if(p3dParent)
- {
- return p3dParent->tryToFindVCOfE3DScene();
- }
+ const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::TransformPrimitive3D(
+ rObjectTransform, xRetval));
+ return drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
}
}
- return 0L;
+ // return current Primitive2DSequence
+ return xRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3d::createViewIndependentPrimitive2DSequence() const
+ {
+ // also need to create a 2D embedding when the view-independent part is requested,
+ // see view-dependent part in ViewObjectContactOfE3d::createPrimitive2DSequence
+ // get 3d primitive vector, isPrimitiveVisible() is done in 3d creator
+ return impCreateWithGivenPrimitive3DSequence(getViewIndependentPrimitive3DSequence());
}
ViewObjectContact& ViewContactOfE3d::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
diff --git a/svx/source/sdr/contact/viewcontactofe3dcube.cxx b/svx/source/sdr/contact/viewcontactofe3dcube.cxx
index 5b1d862b95d2..8626296cb42a 100644
--- a/svx/source/sdr/contact/viewcontactofe3dcube.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dcube.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: viewcontactofe3dcube.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -92,9 +92,6 @@ namespace sdr
aWorldTransform.scale(abjectRange.getX(), abjectRange.getY(), abjectRange.getZ());
aWorldTransform.translate(aCubeRange.getMinX(), aCubeRange.getMinY(), aCubeRange.getMinZ());
- // add object to world transformation
- aWorldTransform *= GetE3dCubeObj().GetTransform();
-
// get 3D Object Attributes
drawinglayer::attribute::Sdr3DObjectAttribute* pSdr3DObjectAttribute = drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
diff --git a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
index e3441aa5df37..815a9416c7de 100644
--- a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: viewcontactofe3dextrude.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -70,14 +70,8 @@ namespace sdr
}
// get extrude geometry
- basegfx::B3DHomMatrix aWorldTransform;
-
- // get polygon (2d)
const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dExtrudeObj().GetExtrudePolygon());
- // add object to world transformation
- aWorldTransform *= GetE3dExtrudeObj().GetTransform();
-
// get 3D Object Attributes
drawinglayer::attribute::Sdr3DObjectAttribute* pSdr3DObjectAttribute = drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
@@ -98,6 +92,7 @@ namespace sdr
const bool bCloseBack(GetE3dExtrudeObj().GetCloseBack());
// create primitive and add
+ const basegfx::B3DHomMatrix aWorldTransform;
const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrExtrudePrimitive3D(
aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute,
aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids,
diff --git a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
index 65366539ecc7..877ffaca2117 100644
--- a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: viewcontactofe3dlathe.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -70,14 +70,8 @@ namespace sdr
}
// get extrude geometry
- basegfx::B3DHomMatrix aWorldTransform;
-
- // get polygon (2d)
const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dLatheObj().GetPolyPoly2D());
- // add object to world transformation
- aWorldTransform *= GetE3dLatheObj().GetTransform();
-
// get 3D Object Attributes
drawinglayer::attribute::Sdr3DObjectAttribute* pSdr3DObjectAttribute = drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
@@ -112,6 +106,7 @@ namespace sdr
const bool bCloseBack(GetE3dLatheObj().GetCloseBack());
// create primitive and add
+ const basegfx::B3DHomMatrix aWorldTransform;
const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrLathePrimitive3D(
aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute,
aPolyPolygon, nHorizontalSegments, nVerticalSegments,
diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
index eec84c534771..fbe39a6f3034 100644
--- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: viewcontactofe3dpolygon.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -112,9 +112,6 @@ namespace sdr
}
}
- // add object to world transformation
- basegfx::B3DHomMatrix aWorldTransform(GetE3dPolygonObj().GetTransform());
-
// get 3D Object Attributes
drawinglayer::attribute::Sdr3DObjectAttribute* pSdr3DObjectAttribute = drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
@@ -129,6 +126,7 @@ namespace sdr
}
// create primitive and add
+ const basegfx::B3DHomMatrix aWorldTransform;
const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D(
aPolyPolygon3D, aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute));
xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
diff --git a/svx/source/sdr/contact/viewcontactofe3dscene.cxx b/svx/source/sdr/contact/viewcontactofe3dscene.cxx
index 1d306a47c018..9c5885d2bf95 100644
--- a/svx/source/sdr/contact/viewcontactofe3dscene.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dscene.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewcontactofe3dscene.cxx,v $
- * $Revision: 1.10 $
+ * $Revision: 1.10.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -289,7 +289,7 @@ namespace sdr
void ViewContactOfE3dScene::createSdrLightingAttribute()
{
const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet();
- mpSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet, GetE3dScene().GetLightGroup());
+ mpSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet);
}
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createScenePrimitive2DSequence(const SetOfByte* pLayerVisibility) const
@@ -303,7 +303,7 @@ namespace sdr
drawinglayer::primitive3d::Primitive3DSequence aAllSequence;
drawinglayer::primitive3d::Primitive3DSequence aVisibleSequence;
const bool bTestLayerVisibility(0 != pLayerVisibility);
- const bool bTestSelectedVisibility(GetE3dScene().DoDrawOnlySelected());
+ const bool bTestSelectedVisibility(GetE3dScene().GetDrawOnlySelected());
const bool bTestVisibility(bTestLayerVisibility || bTestSelectedVisibility);
// add children recursively. Do NOT start with (*this), this would create
diff --git a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
index d5e6aa4b3893..e175416d7552 100644
--- a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: viewcontactofe3dsphere.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -78,9 +78,6 @@ namespace sdr
aWorldTransform.scale(aSphereSize.getX(), aSphereSize.getY(), aSphereSize.getZ());
aWorldTransform.translate(aSpherePosition.getX(), aSpherePosition.getY(), aSpherePosition.getZ());
- // add object to world transformation
- aWorldTransform *= GetE3dSphereObj().GetTransform();
-
// get 3D Object Attributes
drawinglayer::attribute::Sdr3DObjectAttribute* pSdr3DObjectAttribute = drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index 1e8b6424a4b2..aae01c5d24ff 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewcontactofgraphic.cxx,v $
- * $Revision: 1.14 $
+ * $Revision: 1.14.18.2 $
*
* This file is part of OpenOffice.org.
*
@@ -51,6 +51,7 @@
#include <svx/sdr/primitive2d/sdrgrafprimitive2d.hxx>
#include "svdstr.hrc"
#include <svdglob.hxx>
+#include <vcl/svapp.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -166,6 +167,9 @@ namespace sdr
aObjectMatrix.rotate(fRotate);
aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY());
+ // get the current, unchenged graphic obect from SdrGrafObj
+ const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
+
if(GetGrafObject().IsEmptyPresObj())
{
// it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one
@@ -182,20 +186,37 @@ namespace sdr
// SdrGrafPrimitive2D with content (which is the preview graphic) scaled to smaller size and
// without attributes
basegfx::B2DHomMatrix aSmallerMatrix;
- const Size& rGrafPrefSize = GetGrafObject().GetGrafPrefSize();
- const double fOffsetX((aObjectRange.getWidth() - rGrafPrefSize.getWidth()) / 2.0);
- const double fOffsetY((aObjectRange.getHeight() - rGrafPrefSize.getHeight()) / 2.0);
+
+ // #i94431# for some reason, i forgot to take the PrefMapMode of the graphic
+ // into account. Since EmptyPresObj's are only used in Draw/Impress, it is
+ // safe to assume 100th mm as target.
+ Size aPrefSize(GetGrafObject().GetGrafPrefSize());
+
+ if(MAP_PIXEL == GetGrafObject().GetGrafPrefMapMode().GetMapUnit())
+ {
+ aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MAP_100TH_MM);
+ }
+ else
+ {
+ aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, GetGrafObject().GetGrafPrefMapMode(), MAP_100TH_MM);
+ }
+
+ const double fOffsetX((aObjectRange.getWidth() - aPrefSize.getWidth()) / 2.0);
+ const double fOffsetY((aObjectRange.getHeight() - aPrefSize.getHeight()) / 2.0);
if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0))
{
- aSmallerMatrix.scale(rGrafPrefSize.getWidth(), rGrafPrefSize.getHeight());
+ aSmallerMatrix.scale(aPrefSize.getWidth(), aPrefSize.getHeight());
aSmallerMatrix.translate(fOffsetX, fOffsetY);
aSmallerMatrix.shearX(fShearX);
aSmallerMatrix.rotate(fRotate);
aSmallerMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY());
const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
- aSmallerMatrix, aEmptyAttributes, GetGrafObject().GetGraphicObject(), aLocalGrafInfo));
+ aSmallerMatrix,
+ aEmptyAttributes,
+ rGraphicObject,
+ aLocalGrafInfo));
drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReferenceB);
}
@@ -204,7 +225,11 @@ namespace sdr
{
// create primitive
const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
- aObjectMatrix, *pAttribute, GetGrafObject().GetGraphicObject(), aLocalGrafInfo));
+ aObjectMatrix,
+ *pAttribute,
+ rGraphicObject,
+ aLocalGrafInfo));
+
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
}
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index 5df24c87c8f3..2e83b3829e06 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewcontactofsdrobjcustomshape.cxx,v $
- * $Revision: 1.7 $
+ * $Revision: 1.7.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -84,6 +84,7 @@ namespace sdr
{
// prepare text box geometry
::basegfx::B2DHomMatrix aTextBoxMatrix;
+ bool bWordWrap(false);
if(bHasText)
{
@@ -135,6 +136,9 @@ namespace sdr
}
aTextBoxMatrix.translate(aTextBoxRange.getMinX(), aTextBoxRange.getMinY());
+
+ // check if SdrTextWordWrapItem is set
+ bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue();
}
// make sure a (even empty) SdrShadowTextAttribute exists for
@@ -146,7 +150,7 @@ namespace sdr
// create primitive
const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrCustomShapePrimitive2D(
- *pAttribute, xGroup, aTextBoxMatrix));
+ *pAttribute, xGroup, aTextBoxMatrix, bWordWrap));
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
index 0f2e089a5f59..e1b2867b0d66 100644
--- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: viewcontactofsdrole2obj.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -44,6 +44,7 @@
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
#include <svtools/colorcfg.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <vcl/svapp.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -111,7 +112,20 @@ namespace sdr
if(bScaleContent)
{
// Create outline and placeholder graphic with some scaling
- const Size aPrefSize(rOLEGraphic.GetPrefSize());
+ // #i94431# for some reason, i forgot to take the PrefMapMode of the graphic
+ // into account. Since EmptyPresObj's are only used in Draw/Impress, it is
+ // safe to assume 100th mm as target.
+ Size aPrefSize(rOLEGraphic.GetPrefSize());
+
+ if(MAP_PIXEL == rOLEGraphic.GetPrefMapMode().GetMapUnit())
+ {
+ aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MAP_100TH_MM);
+ }
+ else
+ {
+ aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, rOLEGraphic.GetPrefMapMode(), MAP_100TH_MM);
+ }
+
const double fOffsetX((aObjectRange.getWidth() - aPrefSize.getWidth()) / 2.0);
const double fOffsetY((aObjectRange.getHeight() - aPrefSize.getHeight()) / 2.0);
diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
index c60429b54ba4..99710ca308c9 100644
--- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewcontactofunocontrol.cxx,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.18.2 $
*
* This file is part of OpenOffice.org.
*
@@ -180,9 +180,9 @@ namespace sdr { namespace contact {
}
else
{
- // Use parent implementation. This should never be needed, see documentation in
- // ViewContact::createViewIndependentPrimitive2DSequence()
- return ViewContactOfSdrObj::createViewIndependentPrimitive2DSequence();
+ // #i93161# This UnoControl does not yet have a xControlModel (can happen
+ // during diverse creations). Without a model, create no visualisation.
+ return drawinglayer::primitive2d::Primitive2DSequence();
}
}
diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx
index 31932fb6169e..af222889a253 100644
--- a/svx/source/sdr/contact/viewobjectcontact.cxx
+++ b/svx/source/sdr/contact/viewobjectcontact.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewobjectcontact.cxx,v $
- * $Revision: 1.17 $
+ * $Revision: 1.17.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -335,8 +335,8 @@ namespace sdr
// handle ghosted
if(isPrimitiveGhosted(rDisplayInfo))
{
- const ::basegfx::BColor aRGBWhite(1.0, 1.0, 1.0);
- const ::basegfx::BColorModifier aBColorModifier(aRGBWhite, 0.5, ::basegfx::BCOLORMODIFYMODE_INTERPOLATE);
+ const basegfx::BColor aRGBWhite(1.0, 1.0, 1.0);
+ const basegfx::BColorModifier aBColorModifier(aRGBWhite, 0.5, basegfx::BCOLORMODIFYMODE_INTERPOLATE);
const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ModifiedColorPrimitive2D(xRetval, aBColorModifier));
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
@@ -405,7 +405,7 @@ namespace sdr
{
// get ranges
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
- const ::basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
+ const basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
// check geometrical visibility
diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
index 351a0dfec734..394ae3141182 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: viewobjectcontactofgraphic.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -37,6 +37,7 @@
#include <svx/sdr/event/eventhandler.hxx>
#include <svx/svdograf.hxx>
#include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/svdmodel.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -87,7 +88,7 @@ namespace sdr
{
// Test graphics state and eventually trigger a SwapIn event or an Asynchronous
// load event. Return value gives info if SwapIn was triggered or not
- bool ViewObjectContactOfGraphic::impPrepareForPaint()
+ bool ViewObjectContactOfGraphic::impPrepareGraphicWithAsynchroniousLoading()
{
bool bRetval(false);
SdrGrafObj& rGrafObj = getSdrGrafObj();
@@ -167,6 +168,46 @@ namespace sdr
return bRetval;
}
+ // Test graphics state and eventually trigger a SwapIn event. Return value
+ // gives info if SwapIn was triggered or not
+ bool ViewObjectContactOfGraphic::impPrepareGraphicWithSynchroniousLoading()
+ {
+ bool bRetval(false);
+ SdrGrafObj& rGrafObj = getSdrGrafObj();
+
+ if(rGrafObj.IsSwappedOut())
+ {
+ if(rGrafObj.IsLinkedGraphic())
+ {
+ // update graphic link
+ rGrafObj.ImpUpdateGraphicLink();
+ }
+ else
+ {
+ ObjectContact& rObjectContact = GetObjectContact();
+
+ if(rObjectContact.isOutputToPrinter())
+ {
+ // #i76395# preview mechanism is only active if
+ // swapin is called from inside paint preparation, so mbInsidePaint
+ // has to be false to be able to print with high resolution
+ rGrafObj.ForceSwapIn();
+ }
+ else
+ {
+ // SwapIn direct
+ rGrafObj.mbInsidePaint = sal_True;
+ rGrafObj.ForceSwapIn();
+ rGrafObj.mbInsidePaint = sal_False;
+ }
+
+ bRetval = true;
+ }
+ }
+
+ return bRetval;
+ }
+
// This is the call from the asynch graphic loading. This may only be called from
// AsynchGraphicLoadingEvent::ExecuteEvent(). Do load the graphics. The event will
// be deleted (consumed) and forgetAsynchGraphicLoadingEvent will be called.
@@ -203,17 +244,29 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGraphic::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
{
// prepare primitive generation with evtl. loading the graphic when it's swapped out
- static bool bDoAsyncLoading(false); // ATM taken out
- bool bSwapInDone(bDoAsyncLoading ? const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareForPaint() : false);
- bool bSwapInExclusiveForPrinting(bSwapInDone && GetObjectContact().isOutputToPrinter());
+ SdrGrafObj& rGrafObj = const_cast< ViewObjectContactOfGraphic* >(this)->getSdrGrafObj();
+ const bool bDoAsynchronGraphicLoading(rGrafObj.GetModel() && rGrafObj.GetModel()->IsSwapGraphics());
+ static bool bSuppressAsynchLoading(false);
+ bool bSwapInDone(false);
+
+ if(bDoAsynchronGraphicLoading && !bSuppressAsynchLoading)
+ {
+ bSwapInDone = const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithAsynchroniousLoading();
+ }
+ else
+ {
+ bSwapInDone = const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithSynchroniousLoading();
+ }
// get return value by calling parent
drawinglayer::primitive2d::Primitive2DSequence xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo);
// if swap in was forced only for printing, swap out again
+ const bool bSwapInExclusiveForPrinting(bSwapInDone && GetObjectContact().isOutputToPrinter());
+
if(bSwapInExclusiveForPrinting)
{
- const_cast< ViewObjectContactOfGraphic* >(this)->getSdrGrafObj().ForceSwapOut();
+ rGrafObj.ForceSwapOut();
}
return xRetval;
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index 59ed4cc289d9..f2e632e9fd2e 100644
--- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: viewobjectcontactofpageobj.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -51,149 +51,151 @@ using namespace com::sun::star;
//////////////////////////////////////////////////////////////////////////////
-namespace
+namespace sdr
{
- class PagePrimitiveExtractor : public sdr::contact::ObjectContactOfPagePainter, public Timer
- {
- private:
- // the ViewObjectContactOfPageObj using this painter
- sdr::contact::ViewObjectContactOfPageObj& mrViewObjectContactOfPageObj;
-
- public:
- // basic constructor/destructor
- PagePrimitiveExtractor(
- sdr::contact::ViewObjectContactOfPageObj& rVOC);
- virtual ~PagePrimitiveExtractor();
-
- // LazyInvalidate request. Supported here to not automatically
- // invalidate the second interaction state all the time at the
- // original OC
- virtual void setLazyInvalidate(sdr::contact::ViewObjectContact& rVOC);
-
- // From baseclass Timer, the timeout call triggered by te LazyInvalidate mechanism
- virtual void Timeout();
-
- // get primitive visualization
- drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceForPage(const sdr::contact::DisplayInfo& rDisplayInfo);
-
- // Own reaction on changes which will be forwarded to the OC of the owner-VOC
- virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const;
-
- // forward access to SdrPageView of ViewObjectContactOfPageObj
- virtual bool isOutputToPrinter() const;
- virtual bool isOutputToWindow() const;
- virtual bool isOutputToVirtualDevice() const;
- virtual bool isOutputToRecordingMetaFile() const;
- virtual bool isDrawModeGray() const;
- virtual bool isDrawModeBlackWhite() const;
- virtual bool isDrawModeHighContrast() const;
- virtual SdrPageView* TryToGetSdrPageView() const;
- virtual OutputDevice* TryToGetOutputDevice() const;
- };
-
- PagePrimitiveExtractor::PagePrimitiveExtractor(
- sdr::contact::ViewObjectContactOfPageObj& rVOC)
- : sdr::contact::ObjectContactOfPagePainter(0, rVOC.GetObjectContact()),
- mrViewObjectContactOfPageObj(rVOC)
+ namespace contact
{
- // make this renderer a preview renderer
- setPreviewRenderer(true);
+ class PagePrimitiveExtractor : public ObjectContactOfPagePainter, public Timer
+ {
+ private:
+ // the ViewObjectContactOfPageObj using this painter
+ ViewObjectContactOfPageObj& mrViewObjectContactOfPageObj;
+
+ public:
+ // basic constructor/destructor
+ PagePrimitiveExtractor(ViewObjectContactOfPageObj& rVOC);
+ virtual ~PagePrimitiveExtractor();
+
+ // LazyInvalidate request. Supported here to not automatically
+ // invalidate the second interaction state all the time at the
+ // original OC
+ virtual void setLazyInvalidate(ViewObjectContact& rVOC);
+
+ // From baseclass Timer, the timeout call triggered by te LazyInvalidate mechanism
+ virtual void Timeout();
+
+ // get primitive visualization
+ drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceForPage(const DisplayInfo& rDisplayInfo);
+
+ // Own reaction on changes which will be forwarded to the OC of the owner-VOC
+ virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const;
+
+ // forward access to SdrPageView of ViewObjectContactOfPageObj
+ virtual bool isOutputToPrinter() const;
+ virtual bool isOutputToWindow() const;
+ virtual bool isOutputToVirtualDevice() const;
+ virtual bool isOutputToRecordingMetaFile() const;
+ virtual bool isDrawModeGray() const;
+ virtual bool isDrawModeBlackWhite() const;
+ virtual bool isDrawModeHighContrast() const;
+ virtual SdrPageView* TryToGetSdrPageView() const;
+ virtual OutputDevice* TryToGetOutputDevice() const;
+ };
+
+ PagePrimitiveExtractor::PagePrimitiveExtractor(
+ ViewObjectContactOfPageObj& rVOC)
+ : ObjectContactOfPagePainter(0, rVOC.GetObjectContact()),
+ mrViewObjectContactOfPageObj(rVOC)
+ {
+ // make this renderer a preview renderer
+ setPreviewRenderer(true);
- // init timer
- SetTimeout(1);
- Stop();
- }
+ // init timer
+ SetTimeout(1);
+ Stop();
+ }
- PagePrimitiveExtractor::~PagePrimitiveExtractor()
- {
- // execute missing LazyInvalidates and stop timer
- Timeout();
- }
+ PagePrimitiveExtractor::~PagePrimitiveExtractor()
+ {
+ // execute missing LazyInvalidates and stop timer
+ Timeout();
+ }
- void PagePrimitiveExtractor::setLazyInvalidate(sdr::contact::ViewObjectContact& /*rVOC*/)
- {
- // do NOT call parent, but remember that something is to do by
- // starting the LazyInvalidateTimer
- Start();
- }
+ void PagePrimitiveExtractor::setLazyInvalidate(ViewObjectContact& /*rVOC*/)
+ {
+ // do NOT call parent, but remember that something is to do by
+ // starting the LazyInvalidateTimer
+ Start();
+ }
- // From baseclass Timer, the timeout call triggered by te LazyInvalidate mechanism
- void PagePrimitiveExtractor::Timeout()
- {
- // stop the timer
- Stop();
+ // From baseclass Timer, the timeout call triggered by te LazyInvalidate mechanism
+ void PagePrimitiveExtractor::Timeout()
+ {
+ // stop the timer
+ Stop();
- // invalidate all LazyInvalidate VOCs new situations
- const sal_uInt32 nVOCCount(getViewObjectContactCount());
+ // invalidate all LazyInvalidate VOCs new situations
+ const sal_uInt32 nVOCCount(getViewObjectContactCount());
- for(sal_uInt32 a(0); a < nVOCCount; a++)
- {
- sdr::contact::ViewObjectContact* pCandidate = getViewObjectContact(a);
- pCandidate->triggerLazyInvalidate();
+ for(sal_uInt32 a(0); a < nVOCCount; a++)
+ {
+ ViewObjectContact* pCandidate = getViewObjectContact(a);
+ pCandidate->triggerLazyInvalidate();
+ }
}
- }
-
- drawinglayer::primitive2d::Primitive2DSequence PagePrimitiveExtractor::createPrimitive2DSequenceForPage(const sdr::contact::DisplayInfo& /*rDisplayInfo*/)
- {
- drawinglayer::primitive2d::Primitive2DSequence xRetval;
- const SdrPage* pStartPage = GetStartPage();
- if(pStartPage)
+ drawinglayer::primitive2d::Primitive2DSequence PagePrimitiveExtractor::createPrimitive2DSequenceForPage(const DisplayInfo& /*rDisplayInfo*/)
{
- // update own ViewInformation2D for visualized page
- const drawinglayer::geometry::ViewInformation2D& rOriginalViewInformation = mrViewObjectContactOfPageObj.GetObjectContact().getViewInformation2D();
- const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D(
- rOriginalViewInformation.getObjectTransformation(),
- rOriginalViewInformation.getViewTransformation(),
- rOriginalViewInformation.getViewport(),
- GetXDrawPageForSdrPage(const_cast< SdrPage* >(pStartPage)),
- 0.0, // no time; page previews are not animated
- rOriginalViewInformation.getExtendedInformationSequence());
- updateViewInformation2D(aNewViewInformation2D);
-
- // create copy of DisplayInfo to set PagePainting
- sdr::contact::DisplayInfo aDisplayInfo;
-
- // get page's VOC
- sdr::contact::ViewObjectContact& rDrawPageVOContact = pStartPage->GetViewContact().GetViewObjectContact(*this);
-
- // get whole Primitive2DSequence
- xRetval = rDrawPageVOContact.getPrimitive2DSequenceHierarchy(aDisplayInfo);
- }
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const SdrPage* pStartPage = GetStartPage();
- return xRetval;
- }
+ if(pStartPage)
+ {
+ // update own ViewInformation2D for visualized page
+ const drawinglayer::geometry::ViewInformation2D& rOriginalViewInformation = mrViewObjectContactOfPageObj.GetObjectContact().getViewInformation2D();
+ const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D(
+ rOriginalViewInformation.getObjectTransformation(),
+ rOriginalViewInformation.getViewTransformation(),
+ rOriginalViewInformation.getViewport(),
+ GetXDrawPageForSdrPage(const_cast< SdrPage* >(pStartPage)),
+ 0.0, // no time; page previews are not animated
+ rOriginalViewInformation.getExtendedInformationSequence());
+ updateViewInformation2D(aNewViewInformation2D);
+
+ // create copy of DisplayInfo to set PagePainting
+ DisplayInfo aDisplayInfo;
+
+ // get page's VOC
+ ViewObjectContact& rDrawPageVOContact = pStartPage->GetViewContact().GetViewObjectContact(*this);
+
+ // get whole Primitive2DSequence
+ xRetval = rDrawPageVOContact.getPrimitive2DSequenceHierarchy(aDisplayInfo);
+ }
- void PagePrimitiveExtractor::InvalidatePartOfView(const basegfx::B2DRange& rRange) const
- {
- // an invalidate is called at this view, this needs to be translated to an invalidate
- // for the using VOC. Coordinates are in page coordinate system.
- const SdrPage* pStartPage = GetStartPage();
+ return xRetval;
+ }
- if(pStartPage && !rRange.isEmpty())
+ void PagePrimitiveExtractor::InvalidatePartOfView(const basegfx::B2DRange& rRange) const
{
- const basegfx::B2DRange aPageRange(0.0, 0.0, (double)pStartPage->GetWdt(), (double)pStartPage->GetHgt());
+ // an invalidate is called at this view, this needs to be translated to an invalidate
+ // for the using VOC. Coordinates are in page coordinate system.
+ const SdrPage* pStartPage = GetStartPage();
- if(rRange.overlaps(aPageRange))
+ if(pStartPage && !rRange.isEmpty())
{
- // if object on the page is inside or overlapping with page, create ActionChanged() for
- // involved VOC
- mrViewObjectContactOfPageObj.ActionChanged();
+ const basegfx::B2DRange aPageRange(0.0, 0.0, (double)pStartPage->GetWdt(), (double)pStartPage->GetHgt());
+
+ if(rRange.overlaps(aPageRange))
+ {
+ // if object on the page is inside or overlapping with page, create ActionChanged() for
+ // involved VOC
+ mrViewObjectContactOfPageObj.ActionChanged();
+ }
}
}
- }
-
- // forward access to SdrPageView to VOCOfPageObj
- bool PagePrimitiveExtractor::isOutputToPrinter() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToPrinter(); }
- bool PagePrimitiveExtractor::isOutputToWindow() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToWindow(); }
- bool PagePrimitiveExtractor::isOutputToVirtualDevice() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToVirtualDevice(); }
- bool PagePrimitiveExtractor::isOutputToRecordingMetaFile() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToRecordingMetaFile(); }
- bool PagePrimitiveExtractor::isDrawModeGray() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeGray(); }
- bool PagePrimitiveExtractor::isDrawModeBlackWhite() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeBlackWhite(); }
- bool PagePrimitiveExtractor::isDrawModeHighContrast() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeHighContrast(); }
- SdrPageView* PagePrimitiveExtractor::TryToGetSdrPageView() const { return mrViewObjectContactOfPageObj.GetObjectContact().TryToGetSdrPageView(); }
- OutputDevice* PagePrimitiveExtractor::TryToGetOutputDevice() const { return mrViewObjectContactOfPageObj.GetObjectContact().TryToGetOutputDevice(); }
-} // end of anonymous namespace
+
+ // forward access to SdrPageView to VOCOfPageObj
+ bool PagePrimitiveExtractor::isOutputToPrinter() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToPrinter(); }
+ bool PagePrimitiveExtractor::isOutputToWindow() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToWindow(); }
+ bool PagePrimitiveExtractor::isOutputToVirtualDevice() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToVirtualDevice(); }
+ bool PagePrimitiveExtractor::isOutputToRecordingMetaFile() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToRecordingMetaFile(); }
+ bool PagePrimitiveExtractor::isDrawModeGray() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeGray(); }
+ bool PagePrimitiveExtractor::isDrawModeBlackWhite() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeBlackWhite(); }
+ bool PagePrimitiveExtractor::isDrawModeHighContrast() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeHighContrast(); }
+ SdrPageView* PagePrimitiveExtractor::TryToGetSdrPageView() const { return mrViewObjectContactOfPageObj.GetObjectContact().TryToGetSdrPageView(); }
+ OutputDevice* PagePrimitiveExtractor::TryToGetOutputDevice() const { return mrViewObjectContactOfPageObj.GetObjectContact().TryToGetOutputDevice(); }
+ } // end of namespace contact
+} // end of namespace sdr
//////////////////////////////////////////////////////////////////////////////
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx
index aa1851522d7f..c33db4128ec2 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewobjectcontactofsdrmediaobj.cxx,v $
- * $Revision: 1.16 $
+ * $Revision: 1.16.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -44,6 +44,8 @@
#include <svx/sdrpagewindow.hxx>
#include <sdrpaintwindow.hxx>
+//////////////////////////////////////////////////////////////////////////////
+
namespace sdr { namespace contact {
// ----------------------------------
@@ -61,13 +63,7 @@ ViewObjectContactOfSdrMediaObj::ViewObjectContactOfSdrMediaObj( ObjectContact& r
if( pWindow )
{
mpMediaWindow = new SdrMediaWindow( pWindow, *this );
-
- // #i72701#
- // To avoid popping up of a window on a non-initialized position, the
- // window will be invisible now as initial state. It will be made visible
- // in paint
mpMediaWindow->hide();
-
executeMediaItem( rMediaItem );
}
}
@@ -136,7 +132,27 @@ Size ViewObjectContactOfSdrMediaObj::getPreferredSize() const
void ViewObjectContactOfSdrMediaObj::updateMediaItem( ::avmedia::MediaItem& rItem ) const
{
if( mpMediaWindow )
+ {
mpMediaWindow->updateMediaItem( rItem );
+
+ // show/hide is now dependent of play state
+ if(avmedia::MEDIASTATE_STOP == rItem.getState())
+ {
+ mpMediaWindow->hide();
+ }
+ else
+ {
+ basegfx::B2DRange aViewRange(getObjectRange());
+ aViewRange.transform(GetObjectContact().getViewInformation2D().getViewTransformation());
+
+ const Rectangle aViewRectangle(
+ (sal_Int32)floor(aViewRange.getMinX()), (sal_Int32)floor(aViewRange.getMinY()),
+ (sal_Int32)ceil(aViewRange.getMaxX()), (sal_Int32)ceil(aViewRange.getMaxY()));
+
+ mpMediaWindow->setPosSize(aViewRectangle);
+ mpMediaWindow->show();
+ }
+ }
}
// ------------------------------------------------------------------------------
@@ -160,50 +176,4 @@ void ViewObjectContactOfSdrMediaObj::executeMediaItem( const ::avmedia::MediaIte
}} // end of namespace sdr::contact
//////////////////////////////////////////////////////////////////////////////
-// primitive stuff
-
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
-#include <basegfx/tools/canvastools.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-using namespace com::sun::star;
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace contact
- {
- drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfSdrMediaObj::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
- {
- // call parent and get Primitive2D. This includes visibility test already
- drawinglayer::primitive2d::Primitive2DSequence xRetval(ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo));
-
- // if mpMediaWindow is used, make sure position and size is correct. Also test visibility
- // to detect invisible objects (e.g. control layer painting (!))
- if(mpMediaWindow && xRetval.hasElements())
- {
- // get range
- const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
- const ::basegfx::B2DRange aRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
-
- // create view rectangle
- ::basegfx::B2DRange aViewRange(aRange);
- aViewRange.transform(rViewInformation2D.getViewTransformation());
-
- const Rectangle aViewRectangle(
- (sal_Int32)floor(aViewRange.getMinX()), (sal_Int32)floor(aViewRange.getMinY()),
- (sal_Int32)ceil(aViewRange.getMaxX()), (sal_Int32)ceil(aViewRange.getMaxY()));
-
- mpMediaWindow->setPosSize(aViewRectangle);
- }
-
- return xRetval;
- }
- } // end of namespace contact
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
// eof
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index a042fcf45061..e2a3b4a9120a 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrattributecreator.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -73,7 +73,6 @@
#include <com/sun/star/drawing/ProjectionMode.hpp>
#include <com/sun/star/drawing/ShadeMode.hpp>
#include <drawinglayer/attribute/sdrattribute3d.hxx>
-#include <goodies/b3dlight.hxx>
#include <drawinglayer/attribute/sdrallattribute3d.hxx>
#include <svx/rectenum.hxx>
@@ -877,27 +876,71 @@ namespace drawinglayer
return new attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting);
}
- attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet, const B3dLightGroup& rLightGroup)
+ attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet)
{
- // get ambient color
- const Color aAmbientValue(((const Svx3DAmbientcolorItem&)rSet.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue());
- const basegfx::BColor aAmbientLight(aAmbientValue.getBColor());
-
- // extract lights from base3d stuff
+ // extract lights from given SfxItemSet (from scene)
::std::vector< attribute::Sdr3DLightAttribute > aLightVector;
- for(sal_uInt32 a(0L); a < BASE3D_MAX_NUMBER_LIGHTS; a++)
+ if(((const Svx3DLightOnOff1Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue())
{
- B3dLight& rLight = ((B3dLightGroup&)rLightGroup).GetLightObject((Base3DLightNumber)a);
+ const basegfx::BColor aColor(((const Svx3DLightcolor1Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection1Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, true));
+ }
- if(rLight.IsEnabled())
- {
- const basegfx::BColor aColor(rLight.GetIntensity(Base3DMaterialDiffuse).getBColor());
- const basegfx::B3DVector aDirection(rLight.GetPosition());
- aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, rLight.IsSpecular()));
- }
+ if(((const Svx3DLightOnOff2Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor2Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection2Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
+ }
+
+ if(((const Svx3DLightOnOff3Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor3Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection3Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
+ }
+
+ if(((const Svx3DLightOnOff4Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor4Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection4Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
+ }
+
+ if(((const Svx3DLightOnOff5Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor5Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection5Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
+ }
+
+ if(((const Svx3DLightOnOff6Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor6Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection6Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
+ }
+
+ if(((const Svx3DLightOnOff7Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor7Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection7Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
}
+ if(((const Svx3DLightOnOff8Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor8Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection8Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
+ }
+
+ // get ambient color
+ const Color aAmbientValue(((const Svx3DAmbientcolorItem&)rSet.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue());
+ const basegfx::BColor aAmbientLight(aAmbientValue.getBColor());
+
return new attribute::SdrLightingAttribute(aAmbientLight, aLightVector);
}
diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx
index 34fdd58d5eda..506792cb185d 100644
--- a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrcaptionprimitive2d.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -68,7 +68,7 @@ namespace drawinglayer
// add text
if(getSdrLFSTAttribute().getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false));
}
// add shadow
diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx
index 6bccd9494f90..f560ddf2f73e 100644
--- a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrconnectorprimitive2d.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -61,7 +61,7 @@ namespace drawinglayer
// add text
if(getSdrLSTAttribute().getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(getUnitPolygon()), aEmptyMatrix, *getSdrLSTAttribute().getText(), getSdrLSTAttribute().getLine(), false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(getUnitPolygon()), aEmptyMatrix, *getSdrLSTAttribute().getText(), getSdrLSTAttribute().getLine(), false, false));
}
// add shadow
diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
index 30a98e6450ec..269f7b258e2d 100644
--- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrcustomshapeprimitive2d.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -53,8 +53,9 @@ namespace drawinglayer
// add text
if(getSdrSTAttribute().getText())
{
- const ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromRect(::basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTextBox(), *getSdrSTAttribute().getText(), 0, false));
+ const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline), getTextBox(), *getSdrSTAttribute().getText(), 0, false, getWordWrap()));
}
// add shadow
@@ -78,11 +79,13 @@ namespace drawinglayer
SdrCustomShapePrimitive2D::SdrCustomShapePrimitive2D(
const attribute::SdrShadowTextAttribute& rSdrSTAttribute,
const Primitive2DSequence& rSubPrimitives,
- const ::basegfx::B2DHomMatrix& rTextBox)
+ const basegfx::B2DHomMatrix& rTextBox,
+ bool bWordWrap)
: BasePrimitive2D(),
maSdrSTAttribute(rSdrSTAttribute),
maSubPrimitives(rSubPrimitives),
- maTextBox(rTextBox)
+ maTextBox(rTextBox),
+ mbWordWrap(bWordWrap)
{
}
@@ -94,7 +97,8 @@ namespace drawinglayer
return (getSdrSTAttribute() == rCompare.getSdrSTAttribute()
&& getSubPrimitives() == rCompare.getSubPrimitives()
- && getTextBox() == rCompare.getTextBox());
+ && getTextBox() == rCompare.getTextBox()
+ && getWordWrap() == rCompare.getWordWrap());
}
return false;
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index 853b1073dfd4..79c9d5a4cb00 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrdecompositiontools.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -170,7 +170,8 @@ namespace drawinglayer
const ::basegfx::B2DHomMatrix& rObjectTransform,
const attribute::SdrTextAttribute& rText,
const attribute::SdrLineAttribute* pStroke,
- bool bCellText)
+ bool bCellText,
+ bool bWordWrap)
{
::basegfx::B2DHomMatrix aAnchorTransform(rObjectTransform);
SdrTextPrimitive2D* pNew = 0L;
@@ -269,7 +270,7 @@ namespace drawinglayer
else // text in range
{
// build new primitive
- pNew = new SdrBlockTextPrimitive2D(rText.getSdrText(), aAnchorTransform, rText.isScroll(), bCellText);
+ pNew = new SdrBlockTextPrimitive2D(rText.getSdrText(), aAnchorTransform, rText.isScroll(), bCellText, bWordWrap);
}
}
diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
index 88950759211c..4f99a2bce348 100644
--- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrellipseprimitive2d.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -81,7 +81,7 @@ namespace drawinglayer
// add text
if(getSdrLFSTAttribute().getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false));
}
// add shadow
@@ -178,7 +178,7 @@ namespace drawinglayer
// add text
if(getSdrLFSTAttribute().getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false));
}
// add shadow
diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
index da6adbf1345a..7122918aaed2 100644
--- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrgrafprimitive2d.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -93,7 +93,7 @@ namespace drawinglayer
// add text
if(getSdrLFSTAttribute().getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false));
}
// add shadow
diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
index 2217398ef878..b21757b26620 100644
--- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrmeasureprimitive2d.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -124,7 +124,7 @@ namespace drawinglayer
}
// create primitive and get text range
- pBlockText = new SdrBlockTextPrimitive2D(pTextAttribute->getSdrText(), aTextMatrix, pTextAttribute->isScroll(), false);
+ pBlockText = new SdrBlockTextPrimitive2D(pTextAttribute->getSdrText(), aTextMatrix, pTextAttribute->isScroll(), false, false);
aTextRange = pBlockText->getB2DRange(aViewInformation);
}
diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
index e5db0beae158..84dc238eb7e6 100644
--- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrole2primitive2d.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -97,7 +97,7 @@ namespace drawinglayer
// always supported by the old paints, too
if(getSdrLFSTAttribute().getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false));
}
// add shadow
diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx
index 88ceef63512c..7409100e9f7e 100644
--- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrpathprimitive2d.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -74,7 +74,7 @@ namespace drawinglayer
// add text
if(maSdrLFSTAttribute.getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(maUnitPolyPolygon, maTransform, *maSdrLFSTAttribute.getText(), maSdrLFSTAttribute.getLine(), false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(maUnitPolyPolygon, maTransform, *maSdrLFSTAttribute.getText(), maSdrLFSTAttribute.getLine(), false, false));
}
// add shadow
diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
index 014031de4db6..6ffb9f9f08fd 100644
--- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrrectangleprimitive2d.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -67,7 +67,7 @@ namespace drawinglayer
// add text
if(maSdrLFSTAttribute.getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), maTransform, *maSdrLFSTAttribute.getText(), maSdrLFSTAttribute.getLine(), false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), maTransform, *maSdrLFSTAttribute.getText(), maSdrLFSTAttribute.getLine(), false, false));
}
// add shadow
diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
index 401e7b455d99..7fbc02d964d9 100644
--- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: sdrtextprimitive2d.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -262,11 +262,13 @@ namespace drawinglayer
const SdrText& rSdrText,
const ::basegfx::B2DHomMatrix& rTextRangeTransform,
bool bUnlimitedPage,
- bool bCellText)
+ bool bCellText,
+ bool bWordWrap)
: SdrTextPrimitive2D(rSdrText),
maTextRangeTransform(rTextRangeTransform),
mbUnlimitedPage(bUnlimitedPage),
- mbCellText(bCellText)
+ mbCellText(bCellText),
+ mbWordWrap(bWordWrap)
{
}
@@ -278,7 +280,8 @@ namespace drawinglayer
return (getTextRangeTransform() == rCompare.getTextRangeTransform()
&& getUnlimitedPage() == rCompare.getUnlimitedPage()
- && getCellText() == rCompare.getCellText());
+ && getCellText() == rCompare.getCellText()
+ && getWordWrap() == rCompare.getWordWrap());
}
return false;
@@ -286,7 +289,7 @@ namespace drawinglayer
SdrTextPrimitive2D* SdrBlockTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const
{
- return new SdrBlockTextPrimitive2D(getSdrText(), rTransform * getTextRangeTransform(), getUnlimitedPage(), getCellText());
+ return new SdrBlockTextPrimitive2D(getSdrText(), rTransform * getTextRangeTransform(), getUnlimitedPage(), getCellText(), getWordWrap());
}
// provide unique ID
diff --git a/svx/source/sdr/properties/e3dcompoundproperties.cxx b/svx/source/sdr/properties/e3dcompoundproperties.cxx
index 9cbbd9b37ce0..55f485c9f41a 100644
--- a/svx/source/sdr/properties/e3dcompoundproperties.cxx
+++ b/svx/source/sdr/properties/e3dcompoundproperties.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: e3dcompoundproperties.cxx,v $
- * $Revision: 1.9 $
+ * $Revision: 1.9.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -131,32 +131,32 @@ namespace sdr
// Added extra Item (Bool) for chart2 to be able to show reduced line geometry
case SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
case SDRATTR_3DOBJ_DOUBLE_SIDED:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
case SDRATTR_3DOBJ_NORMALS_KIND:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
case SDRATTR_3DOBJ_NORMALS_INVERT:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
case SDRATTR_3DOBJ_TEXTURE_PROJ_X:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
case SDRATTR_3DOBJ_TEXTURE_PROJ_Y:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
}
diff --git a/svx/source/sdr/properties/e3dextrudeproperties.cxx b/svx/source/sdr/properties/e3dextrudeproperties.cxx
index a0ae177bc63f..3d25f5d79ee4 100644
--- a/svx/source/sdr/properties/e3dextrudeproperties.cxx
+++ b/svx/source/sdr/properties/e3dextrudeproperties.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: e3dextrudeproperties.cxx,v $
- * $Revision: 1.7 $
+ * $Revision: 1.7.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -71,17 +71,17 @@ namespace sdr
{
case SDRATTR_3DOBJ_PERCENT_DIAGONAL:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
case SDRATTR_3DOBJ_BACKSCALE:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
case SDRATTR_3DOBJ_DEPTH:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
}
diff --git a/svx/source/sdr/properties/e3dlatheproperties.cxx b/svx/source/sdr/properties/e3dlatheproperties.cxx
index c2b34b0464ad..5b6b19581710 100644
--- a/svx/source/sdr/properties/e3dlatheproperties.cxx
+++ b/svx/source/sdr/properties/e3dlatheproperties.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: e3dlatheproperties.cxx,v $
- * $Revision: 1.7 $
+ * $Revision: 1.7.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -71,27 +71,27 @@ namespace sdr
{
case SDRATTR_3DOBJ_HORZ_SEGS:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
case SDRATTR_3DOBJ_VERT_SEGS:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
case SDRATTR_3DOBJ_PERCENT_DIAGONAL:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
case SDRATTR_3DOBJ_BACKSCALE:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
case SDRATTR_3DOBJ_END_ANGLE:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
}
diff --git a/svx/source/sdr/properties/e3dproperties.cxx b/svx/source/sdr/properties/e3dproperties.cxx
index 65a60698dbf0..8fa772d7158a 100644
--- a/svx/source/sdr/properties/e3dproperties.cxx
+++ b/svx/source/sdr/properties/e3dproperties.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: e3dproperties.cxx,v $
- * $Revision: 1.7 $
+ * $Revision: 1.7.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -85,7 +85,7 @@ namespace sdr
AttributeProperties::ItemSetChanged(rSet);
// local changes
- rObj.StructureChanged(&rObj);
+ rObj.StructureChanged();
}
void E3dProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
diff --git a/svx/source/sdr/properties/e3dsceneproperties.cxx b/svx/source/sdr/properties/e3dsceneproperties.cxx
index ac61d0398094..c55b3839f804 100644
--- a/svx/source/sdr/properties/e3dsceneproperties.cxx
+++ b/svx/source/sdr/properties/e3dsceneproperties.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: e3dsceneproperties.cxx,v $
- * $Revision: 1.11 $
+ * $Revision: 1.11.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -198,7 +198,7 @@ namespace sdr
// local changes
E3dScene& rObj = (E3dScene&)GetSdrObject();
- rObj.StructureChanged(&((E3dScene&)GetSdrObject()));
+ rObj.StructureChanged();
switch(nWhich)
{
@@ -246,145 +246,6 @@ namespace sdr
break;
}
- case SDRATTR_3DSCENE_TWO_SIDED_LIGHTING :
- {
- rObj.GetLightGroup().SetModelTwoSide(rObj.GetTwoSidedLighting());
- break;
- }
- case SDRATTR_3DSCENE_LIGHTCOLOR_1 :
- {
- rObj.GetLightGroup().SetIntensity( rObj.GetLightColor1(), Base3DMaterialDiffuse, Base3DLight0);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTCOLOR_2 :
- {
- rObj.GetLightGroup().SetIntensity( rObj.GetLightColor2(), Base3DMaterialDiffuse, Base3DLight1);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTCOLOR_3 :
- {
- rObj.GetLightGroup().SetIntensity( rObj.GetLightColor3(), Base3DMaterialDiffuse, Base3DLight2);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTCOLOR_4 :
- {
- rObj.GetLightGroup().SetIntensity( rObj.GetLightColor4(), Base3DMaterialDiffuse, Base3DLight3);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTCOLOR_5 :
- {
- rObj.GetLightGroup().SetIntensity( rObj.GetLightColor5(), Base3DMaterialDiffuse, Base3DLight4);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTCOLOR_6 :
- {
- rObj.GetLightGroup().SetIntensity( rObj.GetLightColor6(), Base3DMaterialDiffuse, Base3DLight5);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTCOLOR_7 :
- {
- rObj.GetLightGroup().SetIntensity( rObj.GetLightColor7(), Base3DMaterialDiffuse, Base3DLight6);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTCOLOR_8 :
- {
- rObj.GetLightGroup().SetIntensity( rObj.GetLightColor8(), Base3DMaterialDiffuse, Base3DLight7);
- break;
- }
- case SDRATTR_3DSCENE_AMBIENTCOLOR :
- {
- rObj.GetLightGroup().SetGlobalAmbientLight(rObj.GetGlobalAmbientColor());
- break;
- }
- case SDRATTR_3DSCENE_LIGHTON_1 :
- {
- rObj.GetLightGroup().Enable( rObj.GetLightOnOff1(), Base3DLight0);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTON_2 :
- {
- rObj.GetLightGroup().Enable( rObj.GetLightOnOff2(), Base3DLight1);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTON_3 :
- {
- rObj.GetLightGroup().Enable( rObj.GetLightOnOff3(), Base3DLight2);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTON_4 :
- {
- rObj.GetLightGroup().Enable( rObj.GetLightOnOff4(), Base3DLight3);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTON_5 :
- {
- rObj.GetLightGroup().Enable( rObj.GetLightOnOff5(), Base3DLight4);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTON_6 :
- {
- rObj.GetLightGroup().Enable( rObj.GetLightOnOff6(), Base3DLight5);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTON_7 :
- {
- rObj.GetLightGroup().Enable( rObj.GetLightOnOff7(), Base3DLight6);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTON_8 :
- {
- rObj.GetLightGroup().Enable( rObj.GetLightOnOff8(), Base3DLight7);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTDIRECTION_1 :
- {
- rObj.GetLightGroup().SetDirection( rObj.GetLightDirection1(), Base3DLight0);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTDIRECTION_2 :
- {
- rObj.GetLightGroup().SetDirection( rObj.GetLightDirection2(), Base3DLight1);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTDIRECTION_3 :
- {
- rObj.GetLightGroup().SetDirection( rObj.GetLightDirection3(), Base3DLight2);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTDIRECTION_4 :
- {
- rObj.GetLightGroup().SetDirection( rObj.GetLightDirection4(), Base3DLight3);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTDIRECTION_5 :
- {
- rObj.GetLightGroup().SetDirection( rObj.GetLightDirection5(), Base3DLight4);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTDIRECTION_6 :
- {
- rObj.GetLightGroup().SetDirection( rObj.GetLightDirection6(), Base3DLight5);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTDIRECTION_7 :
- {
- rObj.GetLightGroup().SetDirection( rObj.GetLightDirection7(), Base3DLight6);
- break;
- }
- case SDRATTR_3DSCENE_LIGHTDIRECTION_8 :
- {
- rObj.GetLightGroup().SetDirection( rObj.GetLightDirection8(), Base3DLight7);
- break;
- }
-
- // these are Item changes which may shrink/expand the object, e.g. line
- // size and line on/off
- case XATTR_LINESTYLE :
- case XATTR_LINEWIDTH :
- {
- rObj.CorrectSceneDimensions();
- break;
- }
}
}
@@ -452,48 +313,6 @@ namespace sdr
}
}
- void E3dSceneProperties::SetLightItemsFromLightGroup(B3dLightGroup& rLightGroup)
- {
- // force ItemSet
- GetObjectItemSet();
-
- // TwoSidedLighting
- mpItemSet->Put(Svx3DTwoSidedLightingItem(rLightGroup.GetModelTwoSide()));
-
- // LightColors
- mpItemSet->Put(Svx3DLightcolor1Item(rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight0)));
- mpItemSet->Put(Svx3DLightcolor2Item(rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight1)));
- mpItemSet->Put(Svx3DLightcolor3Item(rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight2)));
- mpItemSet->Put(Svx3DLightcolor4Item(rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight3)));
- mpItemSet->Put(Svx3DLightcolor5Item(rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight4)));
- mpItemSet->Put(Svx3DLightcolor6Item(rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight5)));
- mpItemSet->Put(Svx3DLightcolor7Item(rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight6)));
- mpItemSet->Put(Svx3DLightcolor8Item(rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight7)));
-
- // AmbientColor
- mpItemSet->Put(Svx3DAmbientcolorItem(rLightGroup.GetGlobalAmbientLight()));
-
- // LightOn
- mpItemSet->Put(Svx3DLightOnOff1Item(rLightGroup.IsEnabled(Base3DLight0)));
- mpItemSet->Put(Svx3DLightOnOff2Item(rLightGroup.IsEnabled(Base3DLight1)));
- mpItemSet->Put(Svx3DLightOnOff3Item(rLightGroup.IsEnabled(Base3DLight2)));
- mpItemSet->Put(Svx3DLightOnOff4Item(rLightGroup.IsEnabled(Base3DLight3)));
- mpItemSet->Put(Svx3DLightOnOff5Item(rLightGroup.IsEnabled(Base3DLight4)));
- mpItemSet->Put(Svx3DLightOnOff6Item(rLightGroup.IsEnabled(Base3DLight5)));
- mpItemSet->Put(Svx3DLightOnOff7Item(rLightGroup.IsEnabled(Base3DLight6)));
- mpItemSet->Put(Svx3DLightOnOff8Item(rLightGroup.IsEnabled(Base3DLight7)));
-
- // LightDirection
- mpItemSet->Put(Svx3DLightDirection1Item(rLightGroup.GetDirection( Base3DLight0 )));
- mpItemSet->Put(Svx3DLightDirection2Item(rLightGroup.GetDirection( Base3DLight1 )));
- mpItemSet->Put(Svx3DLightDirection3Item(rLightGroup.GetDirection( Base3DLight2 )));
- mpItemSet->Put(Svx3DLightDirection4Item(rLightGroup.GetDirection( Base3DLight3 )));
- mpItemSet->Put(Svx3DLightDirection5Item(rLightGroup.GetDirection( Base3DLight4 )));
- mpItemSet->Put(Svx3DLightDirection6Item(rLightGroup.GetDirection( Base3DLight5 )));
- mpItemSet->Put(Svx3DLightDirection7Item(rLightGroup.GetDirection( Base3DLight6 )));
- mpItemSet->Put(Svx3DLightDirection8Item(rLightGroup.GetDirection( Base3DLight7 )));
- }
-
void E3dSceneProperties::SetSceneItemsFromCamera()
{
// force ItemSet
diff --git a/svx/source/sdr/properties/e3dsphereproperties.cxx b/svx/source/sdr/properties/e3dsphereproperties.cxx
index 55bd8ba8a49e..35f59f5126e3 100644
--- a/svx/source/sdr/properties/e3dsphereproperties.cxx
+++ b/svx/source/sdr/properties/e3dsphereproperties.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: e3dsphereproperties.cxx,v $
- * $Revision: 1.7 $
+ * $Revision: 1.7.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -71,12 +71,12 @@ namespace sdr
{
case SDRATTR_3DOBJ_HORZ_SEGS:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
case SDRATTR_3DOBJ_VERT_SEGS:
{
- rObj.InvalidateGeometry();
+ rObj.ActionChanged();
break;
}
}
diff --git a/svx/source/svdraw/gradtrns.cxx b/svx/source/svdraw/gradtrns.cxx
index b9df6db5b473..0e62aa9ed75f 100644
--- a/svx/source/svdraw/gradtrns.cxx
+++ b/svx/source/svdraw/gradtrns.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: gradtrns.cxx,v $
- * $Revision: 1.7 $
+ * $Revision: 1.7.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -33,7 +33,6 @@
#include "gradtrns.hxx"
#include <svx/svdobj.hxx>
-#include <goodies/b3dcolor.hxx>
#include <basegfx/range/b2drange.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <vcl/salbtype.hxx> // FRound
@@ -47,7 +46,7 @@ void GradTransformer::GradToVec(GradTransGradient& rG, GradTransVector& rV, cons
if(100 != rG.aGradient.GetStartIntens())
{
const double fFact((double)rG.aGradient.GetStartIntens() / 100.0);
- rV.aCol1 = (B3dColor)rV.aCol1 * fFact;
+ rV.aCol1 = Color(rV.aCol1.getBColor() * fFact);
}
// handle end color
@@ -55,7 +54,7 @@ void GradTransformer::GradToVec(GradTransGradient& rG, GradTransVector& rV, cons
if(100 != rG.aGradient.GetEndIntens())
{
const double fFact((double)rG.aGradient.GetEndIntens() / 100.0);
- rV.aCol2 = (B3dColor)rV.aCol2 * fFact;
+ rV.aCol2 = Color(rV.aCol2.getBColor() * fFact);
}
// calc the basic positions
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
index 1c835c93fc07..ebd596ac972d 100644
--- a/svx/source/svdraw/svdcrtv.cxx
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdcrtv.cxx,v $
- * $Revision: 1.29 $
+ * $Revision: 1.29.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -84,7 +84,7 @@ public:
ImplConnectMarkerOverlay::ImplConnectMarkerOverlay(const SdrCreateView& rView, SdrObject& rObject)
: mrObject(rObject)
{
- basegfx::B2DPolyPolygon aB2DPolyPolygon(rObject.TakeXorPoly(true));
+ basegfx::B2DPolyPolygon aB2DPolyPolygon(rObject.TakeXorPoly());
for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++)
{
@@ -291,12 +291,16 @@ void SdrCreateView::BrkAction()
void SdrCreateView::TakeActionRect(Rectangle& rRect) const
{
- if (pAktCreate!=NULL) {
+ if (pAktCreate!=NULL)
+ {
rRect=aDragStat.GetActionRect();
- if (rRect.IsEmpty()) {
+ if (rRect.IsEmpty())
+ {
rRect=Rectangle(aDragStat.GetPrev(),aDragStat.GetNow());
}
- } else {
+ }
+ else
+ {
SdrDragView::TakeActionRect(rRect);
}
}
@@ -305,7 +309,8 @@ BOOL SdrCreateView::CheckEdgeMode()
{
UINT32 nInv=nAktInvent;
UINT16 nIdn=nAktIdent;
- if (pAktCreate!=NULL) {
+ if (pAktCreate!=NULL)
+ {
nInv=pAktCreate->GetObjInventor();
nIdn=pAktCreate->GetObjIdentifier();
// wird vom EdgeObj gemanaged
@@ -388,7 +393,8 @@ BOOL SdrCreateView::IsMeasureTool() const
void SdrCreateView::SetCurrentObj(UINT16 nIdent, UINT32 nInvent)
{
- if (nAktInvent!=nInvent || nAktIdent!=nIdent) {
+ if (nAktInvent!=nInvent || nAktIdent!=nIdent)
+ {
nAktInvent=nInvent;
nAktIdent=nIdent;
SdrObject* pObj = SdrObjFactory::MakeNewObject(nInvent,nIdent,NULL,NULL);
@@ -473,7 +479,8 @@ BOOL SdrCreateView::ImpBegCreateObj(UINT32 nInvent, UINT16 nIdent, const Point&
nAktIdent!=USHORT(OBJ_FREEFILL) )) { // Kein Fang fuer Edge und Freihand!
aPnt=GetSnapPos(aPnt,pCreatePV);
}
- if (pAktCreate!=NULL) {
+ if (pAktCreate!=NULL)
+ {
BOOL bStartEdit=FALSE; // nach Ende von Create automatisch TextEdit starten
if (pDefaultStyleSheet!=NULL) pAktCreate->NbcSetStyleSheet(pDefaultStyleSheet, sal_False);
@@ -543,10 +550,13 @@ BOOL SdrCreateView::ImpBegCreateObj(UINT32 nInvent, UINT16 nIdent, const Point&
aDragStat.SetPageView(pCreatePV);
aDragStat.SetMinMove(ImpGetMinMovLogic(nMinMov,pOut));
pDragWin=pOut;
- if (pAktCreate->BegCreate(aDragStat)) {
+ if (pAktCreate->BegCreate(aDragStat))
+ {
ShowCreateObj(/*pOut,TRUE*/);
bRet=TRUE;
- } else {
+ }
+ else
+ {
SdrObject::Free( pAktCreate );
pAktCreate=NULL;
pCreatePV=NULL;
@@ -587,10 +597,12 @@ void SdrCreateView::MovCreateObj(const Point& rPnt)
{
if (pAktCreate!=NULL) {
Point aPnt(rPnt);
- if (!aDragStat.IsNoSnap()) {
+ if (!aDragStat.IsNoSnap())
+ {
aPnt=GetSnapPos(aPnt,pCreatePV);
}
- if (IsOrtho()) {
+ if (IsOrtho())
+ {
if (aDragStat.IsOrtho8Possible()) OrthoDistance8(aDragStat.GetPrev(),aPnt,IsBigOrtho());
else if (aDragStat.IsOrtho4Possible()) OrthoDistance4(aDragStat.GetPrev(),aPnt,IsBigOrtho());
}
@@ -608,7 +620,8 @@ void SdrCreateView::MovCreateObj(const Point& rPnt)
if (aPnt==aDragStat.GetNow()) return;
bool bMerk(aDragStat.IsMinMoved());
- if (aDragStat.CheckMinMoved(aPnt)) {
+ if (aDragStat.CheckMinMoved(aPnt))
+ {
Rectangle aBound;
if (!bMerk) aDragStat.NextPoint();
aDragStat.NextMove(aPnt);
@@ -718,7 +731,9 @@ BOOL SdrCreateView::EndCreateObj(SdrCreateCmd eCmd)
nAnz==0 || // keine Punkte da (kann eigentlich nicht vorkommen)
(nAnz<=1 && !aDragStat.IsMinMoved())) { // MinMove nicht erfuellt
BrkCreateObj();
- } else {
+ }
+ else
+ {
// replace for DrawCreateObjDiff
HideCreateObj();
ShowCreateObj();
@@ -726,7 +741,8 @@ BOOL SdrCreateView::EndCreateObj(SdrCreateCmd eCmd)
bRet=TRUE;
}
}
- if (bRet && pObjMerk!=NULL && IsTextEditAfterCreate()) {
+ if (bRet && pObjMerk!=NULL && IsTextEditAfterCreate())
+ {
SdrTextObj* pText=PTR_CAST(SdrTextObj,pObjMerk);
if (pText!=NULL && pText->IsTextFrame())
{
@@ -739,15 +755,22 @@ BOOL SdrCreateView::EndCreateObj(SdrCreateCmd eCmd)
void SdrCreateView::BckCreateObj()
{
- if (pAktCreate!=NULL) {
- if (aDragStat.GetPointAnz()<=2 ) {
+ if (pAktCreate!=NULL)
+ {
+ if (aDragStat.GetPointAnz()<=2 )
+ {
BrkCreateObj();
- } else {
+ }
+ else
+ {
HideCreateObj();
aDragStat.PrevPoint();
- if (pAktCreate->BckCreate(aDragStat)) {
+ if (pAktCreate->BckCreate(aDragStat))
+ {
ShowCreateObj();
- } else {
+ }
+ else
+ {
BrkCreateObj();
}
}
@@ -897,20 +920,26 @@ BOOL SdrCreateView::SetAttributes(const SfxItemSet& rSet, BOOL bReplaceAll)
SfxStyleSheet* SdrCreateView::GetStyleSheet() const // SfxStyleSheet* SdrCreateView::GetStyleSheet(BOOL& rOk) const
{
- if (pAktCreate!=NULL) {
+ if (pAktCreate!=NULL)
+ {
//rOk=TRUE;
return pAktCreate->GetStyleSheet();
- } else {
+ }
+ else
+ {
return SdrDragView::GetStyleSheet(); // SdrDragView::GetStyleSheet(rOk);
}
}
BOOL SdrCreateView::SetStyleSheet(SfxStyleSheet* pStyleSheet, BOOL bDontRemoveHardAttr)
{
- if (pAktCreate!=NULL) {
+ if (pAktCreate!=NULL)
+ {
pAktCreate->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
return TRUE;
- } else {
+ }
+ else
+ {
return SdrDragView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
}
}
diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx
index 3b663a8c945c..4d99598bed78 100644
--- a/svx/source/svdraw/svddrgv.cxx
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svddrgv.cxx,v $
- * $Revision: 1.27 $
+ * $Revision: 1.27.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -185,7 +185,8 @@ BOOL SdrDragView::IsAction() const
void SdrDragView::MovAction(const Point& rPnt)
{
SdrExchangeView::MovAction(rPnt);
- if (pDragBla!=NULL) {
+ if (pDragBla!=NULL)
+ {
MovDragObj(rPnt);
}
}
@@ -213,9 +214,11 @@ void SdrDragView::BrkAction()
void SdrDragView::TakeActionRect(Rectangle& rRect) const
{
- if (pDragBla!=NULL) {
+ if (pDragBla!=NULL)
+ {
rRect=aDragStat.GetActionRect();
- if (rRect.IsEmpty()) {
+ if (rRect.IsEmpty())
+ {
BOOL b1st=TRUE;
SdrPageView* pPV = GetSdrPageView();
@@ -224,21 +227,27 @@ void SdrDragView::TakeActionRect(Rectangle& rRect) const
if (pPV->HasMarkedObjPageView())
{
const basegfx::B2DRange aBoundRange(basegfx::tools::getRange(pPV->getDragPoly()));
- const Rectangle aR(FRound(aBoundRange.getMinX()), FRound(aBoundRange.getMinY()), FRound(aBoundRange.getMaxX()), FRound(aBoundRange.getMaxY()));
+ const Rectangle aR(basegfx::fround(aBoundRange.getMinX()), basegfx::fround(aBoundRange.getMinY()), basegfx::fround(aBoundRange.getMaxX()), basegfx::fround(aBoundRange.getMaxY()));
- if (b1st) {
+ if (b1st)
+ {
b1st=FALSE;
rRect=aR;
- } else {
+ }
+ else
+ {
rRect.Union(aR);
}
}
}
}
- if (rRect.IsEmpty()) {
+ if (rRect.IsEmpty())
+ {
rRect=Rectangle(aDragStat.GetNow(),aDragStat.GetNow());
}
- } else {
+ }
+ else
+ {
SdrExchangeView::TakeActionRect(rRect);
}
}
@@ -262,12 +271,16 @@ void SdrDragView::SetDragPolys(bool bReset)
if(pPV)
{
pPV->setDragPoly0(basegfx::B2DPolyPolygon());
- if (pPV->HasMarkedObjPageView()) {
- for (ULONG nm=0; nm<nMarkAnz; nm++) {
+ if (pPV->HasMarkedObjPageView())
+ {
+ for (ULONG nm=0; nm<nMarkAnz; nm++)
+ {
SdrMark* pM=GetSdrMarkByIndex(nm);
- if (pM->GetPageView()==pPV) {
+ if (pM->GetPageView()==pPV)
+ {
const SdrUShortCont* pPts=bGlue ? pM->GetMarkedGluePoints() : pM->GetMarkedPoints();
- if (pPts!=NULL && pPts->GetCount()!=0) {
+ if (pPts!=NULL && pPts->GetCount()!=0)
+ {
const SdrObject* pObj=pM->GetMarkedSdrObj();
const SdrPathObj* pPath=bGlue ? NULL : PTR_CAST(SdrPathObj,pObj);
const basegfx::B2DPolyPolygon aPathXPP = (pPath) ? pPath->GetPathPoly() : basegfx::B2DPolyPolygon();
@@ -343,7 +356,7 @@ void SdrDragView::SetDragPolys(bool bReset)
if(pM->GetPageView()==pPV)
{
- aDazuPP = pM->GetMarkedSdrObj()->TakeXorPoly(sal_False);
+ aDazuPP = pM->GetMarkedSdrObj()->TakeXorPoly();
const sal_uInt32 nDazuPolyAnz(aDazuPP.count());
nPolyCnt += nDazuPolyAnz;
@@ -400,14 +413,19 @@ BOOL SdrDragView::TakeDragObjAnchorPos(Point& rPos, BOOL bTR ) const
!pDragBla->ISA(SdrDragMovHdl)) // nicht beim Handlesschieben
{
SdrObject* pObj=GetMarkedObjectByIndex(0);
- if (pObj->ISA(SdrCaptionObj)) {
+ if (pObj->ISA(SdrCaptionObj))
+ {
Point aPt(((SdrCaptionObj*)pObj)->GetTailPos());
BOOL bTail=eDragHdl==HDL_POLY; // Schwanz wird gedraggt (nicht so ganz feine Abfrage hier)
BOOL bOwn=pDragBla->ISA(SdrDragObjOwn); // Objektspeziefisch
- if (!bTail) { // bei bTail liefert TakeActionRect schon das richtige
- if (bOwn) { // bOwn kann sein MoveTextFrame, ResizeTextFrame aber eben nicht mehr DragTail
+ if (!bTail)
+ { // bei bTail liefert TakeActionRect schon das richtige
+ if (bOwn)
+ { // bOwn kann sein MoveTextFrame, ResizeTextFrame aber eben nicht mehr DragTail
rPos=aPt;
- } else {
+ }
+ else
+ {
// hier nun dragging des gesamten Objekts (Move, Resize, ...)
pDragBla->MovPoint(aPt); // ,Point()); //GetSdrPageViewOfMarkedByIndex(0)->GetOffset());
}
@@ -482,11 +500,15 @@ BOOL SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl
}
else if(!bNotDraggable)
{
- switch (eDragMode) {
- case SDRDRAG_ROTATE: case SDRDRAG_SHEAR: case SDRDRAG_DISTORT: {
- switch (eDragHdl) {
+ switch (eDragMode)
+ {
+ case SDRDRAG_ROTATE: case SDRDRAG_SHEAR: case SDRDRAG_DISTORT:
+ {
+ switch (eDragHdl)
+ {
case HDL_LEFT: case HDL_RIGHT:
- case HDL_UPPER: case HDL_LOWER: {
+ case HDL_UPPER: case HDL_LOWER:
+ {
// Sind 3D-Objekte selektiert?
BOOL b3DObjSelected = FALSE;
for(UINT32 a=0;!b3DObjSelected && a<GetMarkedObjectCount();a++)
@@ -503,31 +525,43 @@ BOOL SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl
pDragBla=new SdrDragShear(*this,eDragMode==SDRDRAG_ROTATE);
} break;
case HDL_UPLFT: case HDL_UPRGT:
- case HDL_LWLFT: case HDL_LWRGT: {
- if (eDragMode==SDRDRAG_SHEAR || eDragMode==SDRDRAG_DISTORT) {
+ case HDL_LWLFT: case HDL_LWRGT:
+ {
+ if (eDragMode==SDRDRAG_SHEAR || eDragMode==SDRDRAG_DISTORT)
+ {
if (!IsDistortAllowed(TRUE) && !IsDistortAllowed(FALSE)) return FALSE;
pDragBla=new SdrDragDistort(*this);
- } else {
+ }
+ else
+ {
if (!IsRotateAllowed(TRUE)) return FALSE;
pDragBla=new SdrDragRotate(*this);
}
} break;
- default: {
- if (IsMarkedHitMovesAlways() && eDragHdl==HDL_MOVE) { // HDL_MOVE ist auch wenn Obj direkt getroffen
+ default:
+ {
+ if (IsMarkedHitMovesAlways() && eDragHdl==HDL_MOVE)
+ { // HDL_MOVE ist auch wenn Obj direkt getroffen
if (!IsMoveAllowed()) return FALSE;
pDragBla=new SdrDragMove(*this);
- } else {
+ }
+ else
+ {
if (!IsRotateAllowed(TRUE)) return FALSE;
pDragBla=new SdrDragRotate(*this);
}
}
}
} break;
- case SDRDRAG_MIRROR: {
- if (eDragHdl==HDL_MOVE && IsMarkedHitMovesAlways()) {
+ case SDRDRAG_MIRROR:
+ {
+ if (eDragHdl==HDL_MOVE && IsMarkedHitMovesAlways())
+ {
if (!IsMoveAllowed()) return FALSE;
pDragBla=new SdrDragMove(*this);
- } else {
+ }
+ else
+ {
if (!IsMirrorAllowed(TRUE,TRUE)) return FALSE;
pDragBla=new SdrDragMirror(*this);
}
@@ -585,11 +619,15 @@ BOOL SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl
break;
}
- case SDRDRAG_CROOK : {
- if (eDragHdl==HDL_MOVE && IsMarkedHitMovesAlways()) {
+ case SDRDRAG_CROOK :
+ {
+ if (eDragHdl==HDL_MOVE && IsMarkedHitMovesAlways())
+ {
if (!IsMoveAllowed()) return FALSE;
pDragBla=new SdrDragMove(*this);
- } else {
+ }
+ else
+ {
if (!IsCrookAllowed(TRUE) && !IsCrookAllowed(FALSE)) return FALSE;
pDragBla=new SdrDragCrook(*this);
}
@@ -628,15 +666,19 @@ BOOL SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl
}
}
}
- if (pForcedMeth!=NULL) {
+ if (pForcedMeth!=NULL)
+ {
delete pDragBla;
pDragBla=pForcedMeth;
}
aDragStat.SetDragMethod(pDragBla);
- if (pDragBla!=NULL) {
+ if (pDragBla!=NULL)
+ {
bRet=pDragBla->Beg();
- if (!bRet) {
- if (pHdl==NULL && IS_TYPE(SdrDragObjOwn,pDragBla)) {
+ if (!bRet)
+ {
+ if (pHdl==NULL && IS_TYPE(SdrDragObjOwn,pDragBla))
+ {
// Aha, Obj kann nicht Move SpecialDrag, also MoveFrameDrag versuchen
delete pDragBla;
pDragBla=NULL;
@@ -648,7 +690,8 @@ BOOL SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl
bRet=pDragBla->Beg();
}
}
- if (!bRet) {
+ if (!bRet)
+ {
delete pDragBla;
pDragBla=NULL;
aDragStat.SetDragMethod(pDragBla);
@@ -684,10 +727,12 @@ BOOL SdrDragView::EndDragObj(BOOL bCopy)
if(pDragBla && aDragStat.IsMinMoved() && (IsInsertGluePoint() || aDragStat.GetNow() != aDragStat.GetPrev()))
{
ULONG nHdlAnzMerk=0;
- if (bEliminatePolyPoints) { // IBM Special
+ if (bEliminatePolyPoints)
+ { // IBM Special
nHdlAnzMerk=GetMarkablePointCount();
}
- if (IsInsertGluePoint()) {
+ if (IsInsertGluePoint())
+ {
BegUndo(aInsPointUndoStr);
AddUndo(pInsPointUndo);
}
@@ -695,12 +740,15 @@ BOOL SdrDragView::EndDragObj(BOOL bCopy)
if (IsInsertGluePoint()) EndUndo();
delete pDragBla;
pDragBla=NULL;
- if (bEliminatePolyPoints) { // IBM Special
- if (nHdlAnzMerk!=GetMarkablePointCount()) {
+ if (bEliminatePolyPoints)
+ { // IBM Special
+ if (nHdlAnzMerk!=GetMarkablePointCount())
+ {
UnmarkAllPoints();
}
}
- if (bInsPolyPoint) {
+ if (bInsPolyPoint)
+ {
//HMHBOOL bVis=IsMarkHdlShown();
//HMHif (bVis) HideMarkHdl();
SetMarkHandles();
@@ -724,7 +772,9 @@ BOOL SdrDragView::EndDragObj(BOOL bCopy)
}
}
SetDragPolys(true);
- } else {
+ }
+ else
+ {
BrkDragObj();
}
bInsPolyPoint=FALSE;
@@ -735,11 +785,13 @@ BOOL SdrDragView::EndDragObj(BOOL bCopy)
void SdrDragView::BrkDragObj()
{
- if (pDragBla!=NULL) {
+ if (pDragBla!=NULL)
+ {
pDragBla->Brk();
delete pDragBla;
pDragBla=NULL;
- if (bInsPolyPoint) {
+ if (bInsPolyPoint)
+ {
//HMHBOOL bVis=IsMarkHdlShown();
//HMHif (bVis) HideMarkHdl();
pInsPointUndo->Undo(); // Den eingefuegten Punkt wieder raus
@@ -749,7 +801,8 @@ void SdrDragView::BrkDragObj()
bInsPolyPoint=FALSE;
//HMHif (bVis) ShowMarkHdl();
}
- if (IsInsertGluePoint()) {
+ if (IsInsertGluePoint())
+ {
pInsPointUndo->Undo(); // Den eingefuegten Klebepunkt wieder raus
delete pInsPointUndo;
pInsPointUndo=NULL;
@@ -857,7 +910,8 @@ BOOL SdrDragView::EndInsObjPoint(SdrCreateCmd eCmd)
sal_uInt32 nNextPnt(mnInsPointNum);
Point aPnt(aDragStat.GetNow());
BOOL bOk=EndDragObj(FALSE);
- if (bOk==TRUE && eCmd!=SDRCREATE_FORCEEND) {
+ if (bOk==TRUE && eCmd!=SDRCREATE_FORCEEND)
+ {
// Ret=True bedeutet: Action ist vorbei.
bOk=!(ImpBegInsObjPoint(sal_True, nNextPnt, aPnt, eCmd == SDRCREATE_NEXTOBJECT, pDragWin));
}
@@ -869,14 +923,19 @@ BOOL SdrDragView::EndInsObjPoint(SdrCreateCmd eCmd)
BOOL SdrDragView::IsInsGluePointPossible() const
{
BOOL bRet=FALSE;
- if (IsInsGluePointMode() && AreObjectsMarked()) {
- if (GetMarkedObjectCount()==1) {
+ if (IsInsGluePointMode() && AreObjectsMarked())
+ {
+ if (GetMarkedObjectCount()==1)
+ {
// FALSE liefern, wenn 1 Objekt und dieses ein Verbinder ist.
const SdrObject* pObj=GetMarkedObjectByIndex(0);
- if (!HAS_BASE(SdrEdgeObj,pObj)) {
+ if (!HAS_BASE(SdrEdgeObj,pObj))
+ {
bRet=TRUE;
}
- } else {
+ }
+ else
+ {
bRet=TRUE;
}
}
@@ -889,7 +948,8 @@ BOOL SdrDragView::BegInsGluePoint(const Point& rPnt)
SdrObject* pObj;
SdrPageView* pPV;
ULONG nMarkNum;
- if (PickMarkedObj(rPnt,pObj,pPV,&nMarkNum,SDRSEARCH_PASS2BOUND)) {
+ if (PickMarkedObj(rPnt,pObj,pPV,&nMarkNum,SDRSEARCH_PASS2BOUND))
+ {
BrkAction();
UnmarkAllGluePoints();
//SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
@@ -902,31 +962,41 @@ BOOL SdrDragView::BegInsGluePoint(const Point& rPnt)
aInsPointUndoStr=aStr;
SdrGluePointList* pGPL=pObj->ForceGluePointList();
- if (pGPL!=NULL) {
+ if (pGPL!=NULL)
+ {
USHORT nGlueIdx=pGPL->Insert(SdrGluePoint());
SdrGluePoint& rGP=(*pGPL)[nGlueIdx];
USHORT nGlueId=rGP.GetId();
rGP.SetAbsolutePos(rPnt,*pObj);
SdrHdl* pHdl=NULL;
- if (MarkGluePoint(pObj,nGlueId,pPV)) {
+ if (MarkGluePoint(pObj,nGlueId,pPV))
+ {
pHdl=GetGluePointHdl(pObj,nGlueId);
}
- if (pHdl!=NULL && pHdl->GetKind()==HDL_GLUE && pHdl->GetObj()==pObj && pHdl->GetObjHdlNum()==nGlueId) {
+ if (pHdl!=NULL && pHdl->GetKind()==HDL_GLUE && pHdl->GetObj()==pObj && pHdl->GetObjHdlNum()==nGlueId)
+ {
SetInsertGluePoint(TRUE);
bRet=BegDragObj(rPnt,NULL,pHdl,0);
- if (bRet) {
+ if (bRet)
+ {
aDragStat.SetMinMoved();
MovDragObj(rPnt);
- } else {
+ }
+ else
+ {
SetInsertGluePoint(FALSE);
delete pInsPointUndo;
pInsPointUndo=NULL;
}
- } else {
+ }
+ else
+ {
DBG_ERROR("BegInsGluePoint(): GluePoint-Handle nicht gefunden");
}
- } else {
+ }
+ else
+ {
// Keine Klebepunkte moeglich bei diesem Objekt (z.B. Edge)
SetInsertGluePoint(FALSE);
delete pInsPointUndo;
@@ -940,10 +1010,14 @@ BOOL SdrDragView::BegInsGluePoint(const Point& rPnt)
BOOL SdrDragView::IsMoveOnlyDragObj(BOOL bAskRTTI) const
{
bool bRet=false;
- if (pDragBla!=NULL && !IsDraggingPoints() && !IsDraggingGluePoints()) {
- if (bAskRTTI) {
+ if (pDragBla!=NULL && !IsDraggingPoints() && !IsDraggingGluePoints())
+ {
+ if (bAskRTTI)
+ {
bRet=IS_TYPE(SdrDragMove,pDragBla);
- } else {
+ }
+ else
+ {
bRet=pDragBla->IsMoveOnly();
}
}
@@ -982,26 +1056,32 @@ void SdrDragView::HideDragObj()
void SdrDragView::SetNoDragXorPolys(BOOL bOn)
{
- if (IsNoDragXorPolys()!=bOn) {
+ if (IsNoDragXorPolys()!=bOn)
+ {
BOOL bDragging=pDragBla!=NULL;
BOOL bShown=bDragging && aDragStat.IsShown();
if (bShown) HideDragObj();
bNoDragXorPolys=bOn;
- if (bDragging) {
+ if (bDragging)
+ {
SetDragPolys();
pDragBla->MovAllPoints(); // die gedraggten Polys neu berechnen
}
- if (bShown) ShowDragObj();
+ if (bShown)
+ ShowDragObj();
}
}
void SdrDragView::SetDragStripes(BOOL bOn)
{
- if (pDragBla!=NULL && aDragStat.IsShown()) {
+ if (pDragBla!=NULL && aDragStat.IsShown())
+ {
HideDragObj();
bDragStripes=bOn;
ShowDragObj();
- } else {
+ }
+ else
+ {
bDragStripes=bOn;
}
}
@@ -1018,7 +1098,8 @@ void SdrDragView::SetDragStripes(BOOL bOn)
BOOL SdrDragView::IsOrthoDesired() const
{
- if (pDragBla!=NULL && (IS_TYPE(SdrDragObjOwn,pDragBla) || IS_TYPE(SdrDragResize,pDragBla))) {
+ if (pDragBla!=NULL && (IS_TYPE(SdrDragObjOwn,pDragBla) || IS_TYPE(SdrDragResize,pDragBla)))
+ {
return bOrthoDesiredOnMarked;
}
return FALSE;
@@ -1028,49 +1109,61 @@ BOOL SdrDragView::IsOrthoDesired() const
void SdrDragView::SetRubberEdgeDragging(BOOL bOn)
{
- if (bOn!=IsRubberEdgeDragging()) {
+ if (bOn!=IsRubberEdgeDragging())
+ {
ULONG nAnz = GetEdgesOfMarkedNodes().GetMarkCount();
BOOL bShowHide=nAnz!=0 && IsDragObj() &&
(nRubberEdgeDraggingLimit>=nAnz);
- if (bShowHide) HideDragObj();
+ if (bShowHide)
+ HideDragObj();
bRubberEdgeDragging=bOn;
- if (bShowHide) ShowDragObj();
+ if (bShowHide)
+ ShowDragObj();
}
}
void SdrDragView::SetRubberEdgeDraggingLimit(USHORT nEdgeObjAnz)
{
- if (nEdgeObjAnz!=nRubberEdgeDraggingLimit) {
+ if (nEdgeObjAnz!=nRubberEdgeDraggingLimit)
+ {
ULONG nAnz = GetEdgesOfMarkedNodes().GetMarkCount();
BOOL bShowHide=IsRubberEdgeDragging() && nAnz!=0 && IsDragObj() &&
(nEdgeObjAnz>=nAnz)!=(nRubberEdgeDraggingLimit>=nAnz);
- if (bShowHide) HideDragObj();
+ if (bShowHide)
+ HideDragObj();
nRubberEdgeDraggingLimit=nEdgeObjAnz;
- if (bShowHide) ShowDragObj();
+ if (bShowHide)
+ ShowDragObj();
}
}
void SdrDragView::SetDetailedEdgeDragging(BOOL bOn)
{
- if (bOn!=IsDetailedEdgeDragging()) {
+ if (bOn!=IsDetailedEdgeDragging())
+ {
ULONG nAnz = GetEdgesOfMarkedNodes().GetMarkCount();
BOOL bShowHide=nAnz!=0 && IsDragObj() &&
(nDetailedEdgeDraggingLimit>=nAnz);
- if (bShowHide) HideDragObj();
+ if (bShowHide)
+ HideDragObj();
bDetailedEdgeDragging=bOn;
- if (bShowHide) ShowDragObj();
+ if (bShowHide)
+ ShowDragObj();
}
}
void SdrDragView::SetDetailedEdgeDraggingLimit(USHORT nEdgeObjAnz)
{
- if (nEdgeObjAnz!=nDetailedEdgeDraggingLimit) {
+ if (nEdgeObjAnz!=nDetailedEdgeDraggingLimit)
+ {
ULONG nAnz = GetEdgesOfMarkedNodes().GetMarkCount();
BOOL bShowHide=IsDetailedEdgeDragging() && nAnz!=0 && IsDragObj() &&
(nEdgeObjAnz>=nAnz)!=(nDetailedEdgeDraggingLimit>=nAnz);
- if (bShowHide) HideDragObj();
+ if (bShowHide)
+ HideDragObj();
nDetailedEdgeDraggingLimit=nEdgeObjAnz;
- if (bShowHide) ShowDragObj();
+ if (bShowHide)
+ ShowDragObj();
}
}
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index 4f5bc437d2bf..85292b417e60 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -45,6 +45,7 @@
#include <svx/svdpoev.hxx> // fuer die PolyPossiblities
#include "svdstr.hrc" // Namen aus der Resource
#include "svdglob.hxx" // StringCache
+#include <svx/e3dsceneupdater.hxx>
// #i13033#
#include <clonelist.hxx>
@@ -688,31 +689,54 @@ void SdrEditView::DeleteMarkedList(const SdrMarkList& rMark)
if (rMark.GetMarkCount()!=0) {
rMark.ForceSort();
BegUndo();
- ULONG nMarkAnz=rMark.GetMarkCount();
- ULONG nm;
- for (nm=nMarkAnz; nm>0;) {
- nm--;
- SdrMark* pM=rMark.GetMark(nm);
- SdrObject* pObj = pM->GetMarkedSdrObj();
- std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pObj ) );
- AddUndoActions( vConnectorUndoActions );
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
- }
- // Sicherstellen, dass die OrderNums stimmen:
- rMark.GetMark(0)->GetMarkedSdrObj()->GetOrdNum();
- for (nm=nMarkAnz; nm>0;) {
- nm--;
- SdrMark* pM=rMark.GetMark(nm);
- SdrObject* pObj=pM->GetMarkedSdrObj();
- //SdrPageView* pPV =pM->GetPageView();
- SdrObjList* pOL =pObj->GetObjList(); //#52680#
- UINT32 nOrdNum=pObj->GetOrdNumDirect();
-#ifdef DBG_UTIL
- SdrObject* pChkObj=
-#endif
- pOL->RemoveObject(nOrdNum);
- DBG_ASSERT(pChkObj==pObj,"DeleteMarkedList(MarkList): pChkObj!=pObj beim RemoveObject()");
+ const sal_uInt32 nMarkAnz(rMark.GetMarkCount());
+
+ if(nMarkAnz)
+ {
+ sal_uInt32 nm(0);
+ std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
+
+ for(nm = nMarkAnz; nm > 0;)
+ {
+ nm--;
+ SdrMark* pM = rMark.GetMark(nm);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+
+ // extra undo actions for changed connector which now may hold it's layouted path (SJ)
+ std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pObj ) );
+ AddUndoActions( vConnectorUndoActions );
+
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
+ }
+
+ // Sicherstellen, dass die OrderNums stimmen:
+ rMark.GetMark(0)->GetMarkedSdrObj()->GetOrdNum();
+
+ for(nm = nMarkAnz; nm > 0;)
+ {
+ nm--;
+ SdrMark* pM = rMark.GetMark(nm);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+ SdrObjList* pOL = pObj->GetObjList(); //#52680#
+ const sal_uInt32 nOrdNum(pObj->GetOrdNumDirect());
+
+ // set up a scene updater if object is a 3d object
+ if(dynamic_cast< E3dObject* >(pObj))
+ {
+ aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pObj));
+ }
+
+ pOL->RemoveObject(nOrdNum);
+ }
+
+ // fire scene updaters
+ while(aUpdaters.size())
+ {
+ delete aUpdaters.back();
+ aUpdaters.pop_back();
+ }
}
+
EndUndo();
}
}
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index ba828ed72dc3..632761bb819c 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -41,7 +41,6 @@
#include <svtools/itemiter.hxx>
#include <vcl/msgbox.hxx>
#include <svx/rectenum.hxx>
-
#include <svx/svxids.hrc> // fuer SID_ATTR_TRANSFORM_...
#include <svx/svdattr.hxx> // fuer Get/SetGeoAttr
#include "svditext.hxx"
@@ -60,9 +59,9 @@
#include <svtools/aeitem.hxx>
#include <svtools/whiter.hxx>
#include <svx/sdr/contact/objectcontact.hxx>
-
-// #i38495#
#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/e3dsceneupdater.hxx>
+#include <svx/obj3d.hxx>
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -240,15 +239,40 @@ void SdrEditView::RotateMarkedObj(const Point& rRef, long nWink, bool bCopy)
if (bCopy) CopyMarkedObj();
double nSin=sin(nWink*nPi180);
double nCos=cos(nWink*nPi180);
- ULONG nMarkAnz=GetMarkedObjectCount();
- for (ULONG nm=0; nm<nMarkAnz; nm++) {
- SdrMark* pM=GetSdrMarkByIndex(nm);
- SdrObject* pO=pM->GetMarkedSdrObj();
- std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
- AddUndoActions( vConnectorUndoActions );
- AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
- pO->Rotate(rRef,nWink,nSin,nCos);
+ const sal_uInt32 nMarkAnz(GetMarkedObjectCount());
+
+ if(nMarkAnz)
+ {
+ std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
+
+ for(sal_uInt32 nm(0); nm < nMarkAnz; nm++)
+ {
+ SdrMark* pM = GetSdrMarkByIndex(nm);
+ SdrObject* pO = pM->GetMarkedSdrObj();
+
+ // extra undo actions for changed connector which now may hold it's layouted path (SJ)
+ std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
+ AddUndoActions( vConnectorUndoActions );
+
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
+
+ // set up a scene updater if object is a 3d object
+ if(dynamic_cast< E3dObject* >(pO))
+ {
+ aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pO));
+ }
+
+ pO->Rotate(rRef,nWink,nSin,nCos);
+ }
+
+ // fire scene updaters
+ while(aUpdaters.size())
+ {
+ delete aUpdaters.back();
+ aUpdaters.pop_back();
+ }
}
+
EndUndo();
}
@@ -263,15 +287,40 @@ void SdrEditView::MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool b
if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
BegUndo(aStr);
if (bCopy) CopyMarkedObj();
- ULONG nMarkAnz=GetMarkedObjectCount();
- for (ULONG nm=0; nm<nMarkAnz; nm++) {
- SdrMark* pM=GetSdrMarkByIndex(nm);
- SdrObject* pO=pM->GetMarkedSdrObj();
- std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
- AddUndoActions( vConnectorUndoActions );
- AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
- pO->Mirror(rRef1,rRef2);
+ const sal_uInt32 nMarkAnz(GetMarkedObjectCount());
+
+ if(nMarkAnz)
+ {
+ std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
+
+ for(sal_uInt32 nm(0); nm < nMarkAnz; nm++)
+ {
+ SdrMark* pM = GetSdrMarkByIndex(nm);
+ SdrObject* pO = pM->GetMarkedSdrObj();
+
+ // extra undo actions for changed connector which now may hold it's layouted path (SJ)
+ std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
+ AddUndoActions( vConnectorUndoActions );
+
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
+
+ // set up a scene updater if object is a 3d object
+ if(dynamic_cast< E3dObject* >(pO))
+ {
+ aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pO));
+ }
+
+ pO->Mirror(rRef1,rRef2);
+ }
+
+ // fire scene updaters
+ while(aUpdaters.size())
+ {
+ delete aUpdaters.back();
+ aUpdaters.pop_back();
+ }
}
+
EndUndo();
}
@@ -816,7 +865,8 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, BOOL bReplaceAll)
}
BegUndo(aStr);
- ULONG nMarkAnz=GetMarkedObjectCount();
+ const sal_uInt32 nMarkAnz(GetMarkedObjectCount());
+ std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
// create ItemSet without SFX_ITEM_DONTCARE. Put()
// uses it's second parameter (bInvalidAsDefault) to
@@ -858,7 +908,13 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, BOOL bReplaceAll)
// add attribute undo
AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj,FALSE,bHasEEItems || bPossibleGeomChange || bRescueText));
- //pObj->SetItemSetAndBroadcast(aAttr, bReplaceAll);
+ // set up a scxene updater if object is a 3d object
+ if(dynamic_cast< E3dObject* >(pObj))
+ {
+ aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pObj));
+ }
+
+ // set attributes at object
pObj->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
if(pObj->ISA(SdrTextObj))
@@ -892,6 +948,13 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, BOOL bReplaceAll)
}
}
+ // fire scene updaters
+ while(aUpdaters.size())
+ {
+ delete aUpdaters.back();
+ aUpdaters.pop_back();
+ }
+
// #i38135#
if(bResetAnimationTimer)
{
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 7de04ebc55cb..4a3e37bfc0ee 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdetc.cxx,v $
- * $Revision: 1.35 $
+ * $Revision: 1.35.18.2 $
*
* This file is part of OpenOffice.org.
*
@@ -70,7 +70,6 @@
#include <svx/xflbckit.hxx>
#include <svx/extrusionbar.hxx>
#include <svx/fontworkbar.hxx>
-#include <goodies/b3dcolor.hxx>
#include <vcl/svapp.hxx> //add CHINA001
//#i80528#
@@ -468,7 +467,8 @@ FASTBOOL GetDraftFillColor(const SfxItemSet& rSet, Color& rCol)
aCol2 = ((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue();
}
- ((B3dColor&)rCol).CalcMiddle(aCol1, aCol2);
+ const basegfx::BColor aAverageColor(basegfx::average(aCol1.getBColor(), aCol2.getBColor()));
+ rCol = Color(aAverageColor);
bRetval = TRUE;
break;
@@ -477,7 +477,8 @@ FASTBOOL GetDraftFillColor(const SfxItemSet& rSet, Color& rCol)
const XGradient& rGrad=((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetGradientValue();
Color aCol1(rGrad.GetStartColor());
Color aCol2(rGrad.GetEndColor());
- ((B3dColor&)rCol).CalcMiddle(aCol1, aCol2);
+ const basegfx::BColor aAverageColor(basegfx::average(aCol1.getBColor(), aCol2.getBColor()));
+ rCol = Color(aAverageColor);
bRetval = TRUE;
break;
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 7c2bc3d6a17b..8ada8ace73fa 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdhdl.cxx,v $
- * $Revision: 1.34 $
+ * $Revision: 1.34.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,6 +31,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
+#include <algorithm>
+
#include <svx/svdhdl.hxx>
#include "svdtouch.hxx"
#include <svx/svdpagv.hxx>
@@ -41,7 +43,6 @@
#include <vcl/virdev.hxx>
#include <tools/poly.hxx>
#include <vcl/bmpacc.hxx>
-#include <goodies/b3dcolor.hxx>
#include <svx/sxekitm.hxx>
#include "svdstr.hrc"
@@ -67,6 +68,7 @@
#include <svx/sdrpagewindow.hxx>
#include <sdrpaintwindow.hxx>
#include <vcl/svapp.hxx>
+#include <svx/sdr/overlay/overlaypolypolygon.hxx>
////////////////////////////////////////////////////////////////////////////////////////////////////
// #i15222#
@@ -815,7 +817,8 @@ Pointer SdrHdl::GetPointer() const
PointerStyle ePtr=POINTER_MOVE;
BOOL bSize=eKind>=HDL_UPLFT && eKind<=HDL_LWRGT;
// Fuer Resize von gedrehten Rechtecken die Mauszeiger etwas mitdrehen
- if (bSize && nDrehWink!=0) {
+ if (bSize && nDrehWink!=0)
+ {
long nHdlWink=0;
switch (eKind) {
case HDL_UPLFT: nHdlWink=13500; break;
@@ -833,18 +836,22 @@ Pointer SdrHdl::GetPointer() const
while (nHdlWink<0) nHdlWink+=18000;
while (nHdlWink>=18000) nHdlWink-=18000;
nHdlWink/=4500;
- switch ((BYTE)nHdlWink) {
+ switch ((BYTE)nHdlWink)
+ {
case 0: ePtr=POINTER_ESIZE; break;
case 1: ePtr=POINTER_NESIZE; break;
case 2: ePtr=POINTER_SSIZE; break;
case 3: ePtr=POINTER_SESIZE; break;
} // switch
}
- if (ePtr==POINTER_MOVE) {
+ if (ePtr==POINTER_MOVE)
+ {
BOOL bRot=pHdlList!=NULL && pHdlList->IsRotateShear();
BOOL bDis=pHdlList!=NULL && pHdlList->IsDistortShear();
- if (bSize && pHdlList!=NULL && (bRot || bDis)) {
- switch (eKind) {
+ if (bSize && pHdlList!=NULL && (bRot || bDis))
+ {
+ switch (eKind)
+ {
case HDL_UPLFT: case HDL_UPRGT:
case HDL_LWLFT: case HDL_LWRGT: ePtr=bRot ? POINTER_ROTATE : POINTER_REFHAND; break;
case HDL_LEFT : case HDL_RIGHT: ePtr=POINTER_VSHEAR; break;
@@ -852,8 +859,11 @@ Pointer SdrHdl::GetPointer() const
default:
break;
}
- } else {
- switch (eKind) {
+ }
+ else
+ {
+ switch (eKind)
+ {
case HDL_UPLFT: ePtr=POINTER_NWSIZE; break;
case HDL_UPPER: ePtr=POINTER_NSIZE; break;
case HDL_UPRGT: ePtr=POINTER_NESIZE; break;
@@ -1023,17 +1033,20 @@ Bitmap SdrHdlColor::CreateColorDropper(Color aCol)
pWrite->DrawLine(Point(nWidth - 1, 1), Point(nWidth - 1, nHeight - 2));
// draw lighter UpperLeft
- B3dColor aMixCol(aCol);
- B3dColor aFactor(0x40, 0x40, 0x40);
- aMixCol += aFactor;
- pWrite->SetLineColor((Color)aMixCol);
+ const Color aLightColor(
+ (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetRed() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
+ (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetGreen() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
+ (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetBlue() + (sal_Int16)0x0040), (sal_Int16)0x00ff)));
+ pWrite->SetLineColor(aLightColor);
pWrite->DrawLine(Point(1, 1), Point(1, nHeight - 2));
pWrite->DrawLine(Point(2, 1), Point(nWidth - 2, 1));
// draw darker LowerRight
- aMixCol = aCol;
- aMixCol -= aFactor;
- pWrite->SetLineColor((Color)aMixCol);
+ const Color aDarkColor(
+ (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetRed() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
+ (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetGreen() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
+ (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetBlue() - (sal_Int16)0x0040), (sal_Int16)0x0000)));
+ pWrite->SetLineColor(aDarkColor);
pWrite->DrawLine(Point(2, nHeight - 2), Point(nWidth - 2, nHeight - 2));
pWrite->DrawLine(Point(nWidth - 2, 2), Point(nWidth - 2, nHeight - 3));
@@ -1421,21 +1434,10 @@ void E3dVolumeMarker::CreateB2dIAObject()
if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- if(rPageWindow.GetOverlayManager())
- {
- const sal_uInt32 nCnt(aWireframePoly.count());
-
- for(sal_uInt32 i(0L); i < nCnt; i++)
+ if(rPageWindow.GetOverlayManager() && aWireframePoly.count())
{
- const basegfx::B2DPolygon aPoly(aWireframePoly.getB2DPolygon(i));
- const basegfx::B2DPoint aPointA(aPoly.getB2DPoint(0L));
- const basegfx::B2DPoint aPointB(aPoly.getB2DPoint(1L));
-
::sdr::overlay::OverlayObject* pNewOverlayObject = new
- ::sdr::overlay::OverlayLineStriped(
- aPointA,
- aPointB
- );
+ ::sdr::overlay::OverlayPolyPolygonStriped(aWireframePoly);
DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
// OVERLAYMANAGER
@@ -1453,7 +1455,6 @@ void E3dVolumeMarker::CreateB2dIAObject()
}
}
}
-}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1542,27 +1543,38 @@ void ImpEdgeHdl::SetLineCode(SdrEdgeLineCode eCode)
Pointer ImpEdgeHdl::GetPointer() const
{
SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
- if (pEdge==NULL) return SdrHdl::GetPointer();
- if (nObjHdlNum<=1) return Pointer(POINTER_MOVEPOINT); //Pointer(POINTER_DRAW_CONNECT);
- if (IsHorzDrag()) return Pointer(POINTER_ESIZE);
- else return Pointer(POINTER_SSIZE);
+ if (pEdge==NULL)
+ return SdrHdl::GetPointer();
+ if (nObjHdlNum<=1)
+ return Pointer(POINTER_MOVEPOINT); //Pointer(POINTER_DRAW_CONNECT);
+ if (IsHorzDrag())
+ return Pointer(POINTER_ESIZE);
+ else
+ return Pointer(POINTER_SSIZE);
}
BOOL ImpEdgeHdl::IsHorzDrag() const
{
SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
- if (pEdge==NULL) return FALSE;
- if (nObjHdlNum<=1) return FALSE;
+ if (pEdge==NULL)
+ return FALSE;
+ if (nObjHdlNum<=1)
+ return FALSE;
SdrEdgeKind eEdgeKind = ((SdrEdgeKindItem&)(pEdge->GetObjectItem(SDRATTR_EDGEKIND))).GetValue();
const SdrEdgeInfoRec& rInfo=pEdge->aEdgeInfo;
- if (eEdgeKind==SDREDGE_ORTHOLINES || eEdgeKind==SDREDGE_BEZIER) {
+ if (eEdgeKind==SDREDGE_ORTHOLINES || eEdgeKind==SDREDGE_BEZIER)
+ {
return !rInfo.ImpIsHorzLine(eLineCode,*pEdge->pEdgeTrack);
- } else if (eEdgeKind==SDREDGE_THREELINES) {
+ }
+ else if (eEdgeKind==SDREDGE_THREELINES)
+ {
long nWink=nObjHdlNum==2 ? rInfo.nAngle1 : rInfo.nAngle2;
- if (nWink==0 || nWink==18000) return TRUE;
- else return FALSE;
+ if (nWink==0 || nWink==18000)
+ return TRUE;
+ else
+ return FALSE;
}
return FALSE;
}
@@ -1632,7 +1644,8 @@ void ImpMeasureHdl::CreateB2dIAObject()
Pointer ImpMeasureHdl::GetPointer() const
{
- switch (nObjHdlNum) {
+ switch (nObjHdlNum)
+ {
case 0: case 1: return Pointer(POINTER_HAND);
case 2: case 3: return Pointer(POINTER_MOVEPOINT);
case 4: case 5: return SdrHdl::GetPointer(); // wird dann entsprechend gedreht
@@ -1655,7 +1668,8 @@ int ImpSdrHdlListSorter::Compare(const void* pElem1, const void* pElem2) const
// Level 1: Erst normale Handles, dann Glue, dann User, dann Plushandles, dann Retpunkt-Handles
unsigned n1=1;
unsigned n2=1;
- if (eKind1!=eKind2) {
+ if (eKind1!=eKind2)
+ {
if (eKind1==HDL_REF1 || eKind1==HDL_REF2 || eKind1==HDL_MIRX) n1=5;
else if (eKind1==HDL_GLUE) n1=2;
else if (eKind1==HDL_USER) n1=3;
@@ -1667,29 +1681,41 @@ int ImpSdrHdlListSorter::Compare(const void* pElem1, const void* pElem2) const
}
if (((SdrHdl*)pElem1)->IsPlusHdl()) n1=4;
if (((SdrHdl*)pElem2)->IsPlusHdl()) n2=4;
- if (n1==n2) {
+ if (n1==n2)
+ {
// Level 2: PageView (Pointer)
SdrPageView* pPV1=((SdrHdl*)pElem1)->GetPageView();
SdrPageView* pPV2=((SdrHdl*)pElem2)->GetPageView();
- if (pPV1==pPV2) {
+ if (pPV1==pPV2)
+ {
// Level 3: Position (x+y)
SdrObject* pObj1=((SdrHdl*)pElem1)->GetObj();
SdrObject* pObj2=((SdrHdl*)pElem2)->GetObj();
- if (pObj1==pObj2) {
+ if (pObj1==pObj2)
+ {
sal_uInt32 nNum1=((SdrHdl*)pElem1)->GetObjHdlNum();
sal_uInt32 nNum2=((SdrHdl*)pElem2)->GetObjHdlNum();
- if (nNum1==nNum2) { // #48763#
+ if (nNum1==nNum2)
+ { // #48763#
if (eKind1==eKind2)
return (long)pElem1<(long)pElem2 ? -1 : 1; // Notloesung, um immer die gleiche Sortierung zu haben
return (USHORT)eKind1<(USHORT)eKind2 ? -1 : 1;
- } else return nNum1<nNum2 ? -1 : 1;
- } else {
+ }
+ else
+ return nNum1<nNum2 ? -1 : 1;
+ }
+ else
+ {
return (long)pObj1<(long)pObj2 ? -1 : 1;
}
- } else {
+ }
+ else
+ {
return (long)pPV1<(long)pPV2 ? -1 : 1;
}
- } else {
+ }
+ else
+ {
return n1<n2 ? -1 : 1;
}
}
@@ -2104,17 +2130,22 @@ void SdrHdlList::Sort()
ULONG SdrHdlList::GetHdlNum(const SdrHdl* pHdl) const
{
- if (pHdl==NULL) return CONTAINER_ENTRY_NOTFOUND;
+ if (pHdl==NULL)
+ return CONTAINER_ENTRY_NOTFOUND;
ULONG nPos=aList.GetPos(pHdl);
return nPos;
}
void SdrHdlList::AddHdl(SdrHdl* pHdl, BOOL bAtBegin)
{
- if (pHdl!=NULL) {
- if (bAtBegin) {
+ if (pHdl!=NULL)
+ {
+ if (bAtBegin)
+ {
aList.Insert(pHdl,ULONG(0));
- } else {
+ }
+ else
+ {
aList.Insert(pHdl,CONTAINER_APPEND);
}
pHdl->SetHdlList(this);
@@ -2126,15 +2157,23 @@ SdrHdl* SdrHdlList::IsHdlListHit(const Point& rPnt, BOOL bBack, BOOL bNext, SdrH
SdrHdl* pRet=NULL;
ULONG nAnz=GetHdlCount();
ULONG nNum=bBack ? 0 : nAnz;
- while ((bBack ? nNum<nAnz : nNum>0) && pRet==NULL) {
- if (!bBack) nNum--;
+ while ((bBack ? nNum<nAnz : nNum>0) && pRet==NULL)
+ {
+ if (!bBack)
+ nNum--;
SdrHdl* pHdl=GetHdl(nNum);
- if (bNext) {
- if (pHdl==pHdl0) bNext=FALSE;
- } else {
- if (pHdl->IsHdlHit(rPnt)) pRet=pHdl;
+ if (bNext)
+ {
+ if (pHdl==pHdl0)
+ bNext=FALSE;
+ }
+ else
+ {
+ if (pHdl->IsHdlHit(rPnt))
+ pRet=pHdl;
}
- if (bBack) nNum++;
+ if (bBack)
+ nNum++;
}
return pRet;
}
@@ -2142,9 +2181,11 @@ SdrHdl* SdrHdlList::IsHdlListHit(const Point& rPnt, BOOL bBack, BOOL bNext, SdrH
SdrHdl* SdrHdlList::GetHdl(SdrHdlKind eKind1) const
{
SdrHdl* pRet=NULL;
- for (ULONG i=0; i<GetHdlCount() && pRet==NULL; i++) {
+ for (ULONG i=0; i<GetHdlCount() && pRet==NULL; i++)
+ {
SdrHdl* pHdl=GetHdl(i);
- if (pHdl->GetKind()==eKind1) pRet=pHdl;
+ if (pHdl->GetKind()==eKind1)
+ pRet=pHdl;
}
return pRet;
}
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 42a27dc99e36..97793ffa769e 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -972,8 +972,8 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, pObj);
// build handles
- const Point aTmpPos1(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY()));
- const Point aTmpPos2(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY()));
+ const Point aTmpPos1(basegfx::fround(aGradTransVector.maPositionA.getX()), basegfx::fround(aGradTransVector.maPositionA.getY()));
+ const Point aTmpPos2(basegfx::fround(aGradTransVector.maPositionB.getX()), basegfx::fround(aGradTransVector.maPositionB.getY()));
SdrHdlColor* pColHdl1 = new SdrHdlColor(aTmpPos1, aGradTransVector.aCol1, SDR_HANDLE_COLOR_SIZE_NORMAL, TRUE);
SdrHdlColor* pColHdl2 = new SdrHdlColor(aTmpPos2, aGradTransVector.aCol2, SDR_HANDLE_COLOR_SIZE_NORMAL, TRUE);
SdrHdlGradient* pGradHdl = new SdrHdlGradient(aTmpPos1, aTmpPos2, FALSE);
@@ -1014,8 +1014,8 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, pObj);
// build handles
- const Point aTmpPos1(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY()));
- const Point aTmpPos2(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY()));
+ const Point aTmpPos1(basegfx::fround(aGradTransVector.maPositionA.getX()), basegfx::fround(aGradTransVector.maPositionA.getY()));
+ const Point aTmpPos2(basegfx::fround(aGradTransVector.maPositionB.getX()), basegfx::fround(aGradTransVector.maPositionB.getY()));
SdrHdlColor* pColHdl1 = new SdrHdlColor(aTmpPos1, aGradTransVector.aCol1, aHdlSize, FALSE);
SdrHdlColor* pColHdl2 = new SdrHdlColor(aTmpPos2, aGradTransVector.aCol2, aHdlSize, FALSE);
SdrHdlGradient* pGradHdl = new SdrHdlGradient(aTmpPos1, aTmpPos2, TRUE);
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 6cb515067c24..c4327a975e25 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -36,11 +36,7 @@
#include <ucbhelper/content.hxx>
#include <ucbhelper/contentbroker.hxx>
#include <unotools/datetime.hxx>
-#ifndef SVX_LIGHT
-#ifndef _LNKBASE_HXX //autogen
#include <sfx2/lnkbase.hxx>
-#endif
-#endif
#include <tools/urlobj.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/drawing/XShape.hpp>
@@ -82,18 +78,11 @@
#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
#include <svx/writingmodeitem.hxx>
-
-// textitem.hxx editdata.hxx
#include <svx/xlnclit.hxx>
-
-
-
#include <svx/svxids.hrc>
#include <svtools/whiter.hxx>
#include <svx/sdr/properties/customshapeproperties.hxx>
#include <svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx>
-
-// #i37011#
#include <svx/xlnclit.hxx>
#include <svx/xlntrit.hxx>
#include <svx/xfltrit.hxx>
@@ -102,8 +91,6 @@
#include <svx/xflhtit.hxx>
#include <svx/xbtmpit.hxx>
#include <vcl/bmpacc.hxx>
-
-// #i37448#
#include <svx/svdview.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
@@ -3360,7 +3347,7 @@ void SdrObjCustomShape::TakeObjNamePlural(XubString& rName) const
rName=ImpGetResStr(STR_ObjNamePluralCUSTOMSHAPE);
}
-basegfx::B2DPolyPolygon SdrObjCustomShape::TakeXorPoly(sal_Bool /*bDetail*/) const
+basegfx::B2DPolyPolygon SdrObjCustomShape::TakeXorPoly() const
{
return GetLineGeometry( (SdrObjCustomShape*)this, sal_False );
}
diff --git a/svx/source/svdraw/svdoattr.cxx b/svx/source/svdraw/svdoattr.cxx
index 546add85e862..f192221bd880 100644
--- a/svx/source/svdraw/svdoattr.cxx
+++ b/svx/source/svdraw/svdoattr.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdoattr.cxx,v $
- * $Revision: 1.53 $
+ * $Revision: 1.53.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -115,8 +115,9 @@ const Rectangle& SdrAttrObj::GetSnapRect() const
if(bSnapRectDirty)
{
((SdrAttrObj*)this)->RecalcSnapRect();
- ((SdrAttrObj*)this)->bSnapRectDirty = FALSE;
+ ((SdrAttrObj*)this)->bSnapRectDirty = false;
}
+
return maSnapRect;
}
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 6dca44b4811f..b68dddbd4637 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdobj.cxx,v $
- * $Revision: 1.99 $
+ * $Revision: 1.99.16.2 $
*
* This file is part of OpenOffice.org.
*
@@ -189,7 +189,7 @@ void SdrObjUserData::PaintMacro(OutputDevice& rOut, const Rectangle& /*rDirtyRec
return;
const RasterOp eRop(rOut.GetRasterOp());
- const basegfx::B2DPolyPolygon aPolyPolygon(pObj->TakeXorPoly(true));
+ const basegfx::B2DPolyPolygon aPolyPolygon(pObj->TakeXorPoly());
const sal_uInt32 nCount(aPolyPolygon.count());
rOut.SetLineColor(COL_BLACK);
@@ -913,27 +913,25 @@ const Rectangle& SdrObject::GetLastBoundRect() const
void SdrObject::RecalcBoundRect()
{
// central new method which will calculate the BoundRect using primitive geometry
- const drawinglayer::primitive2d::Primitive2DSequence xPrimitives(GetViewContact().getViewIndependentPrimitive2DSequence());
-
- if(xPrimitives.hasElements())
+ if(aOutRect.IsEmpty())
{
- // use neutral ViewInformation
- const drawinglayer::geometry::ViewInformation2D aViewInformation2D(0);
-
- // get the range of the primitives
- const basegfx::B2DRange aRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xPrimitives, aViewInformation2D));
+ const drawinglayer::primitive2d::Primitive2DSequence xPrimitives(GetViewContact().getViewIndependentPrimitive2DSequence());
- if(!aRange.isEmpty())
+ if(xPrimitives.hasElements())
{
- aOutRect = Rectangle(
- (sal_Int32)floor(aRange.getMinX()), (sal_Int32)floor(aRange.getMinY()),
- (sal_Int32)ceil(aRange.getMaxX()), (sal_Int32)ceil(aRange.getMaxY()));
+ // use neutral ViewInformation and get the range of the primitives
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D(0);
+ const basegfx::B2DRange aRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xPrimitives, aViewInformation2D));
+
+ if(!aRange.isEmpty())
+ {
+ aOutRect = Rectangle(
+ (sal_Int32)floor(aRange.getMinX()), (sal_Int32)floor(aRange.getMinY()),
+ (sal_Int32)ceil(aRange.getMaxX()), (sal_Int32)ceil(aRange.getMaxY()));
+ return;
+ }
}
}
- else
- {
- aOutRect = Rectangle();
- }
}
void SdrObject::BroadcastObjectChange() const
@@ -1127,7 +1125,7 @@ XubString SdrObject::GetMetrStr(long nVal, MapUnit /*eWantMap*/, FASTBOOL bNoUni
return aStr;
}
-basegfx::B2DPolyPolygon SdrObject::TakeXorPoly(sal_Bool /*bDetail*/) const
+basegfx::B2DPolyPolygon SdrObject::TakeXorPoly() const
{
basegfx::B2DPolyPolygon aRetval;
const Rectangle aR(GetCurrentBoundRect());
@@ -1140,26 +1138,80 @@ basegfx::B2DPolyPolygon SdrObject::TakeXorPoly(sal_Bool /*bDetail*/) const
basegfx::B2DPolyPolygon SdrObject::TakeContour() const
{
basegfx::B2DPolyPolygon aRetval;
- const sdr::contact::ViewContact& rVC(GetViewContact());
- const drawinglayer::primitive2d::Primitive2DSequence xSequence(rVC.getViewIndependentPrimitive2DSequence());
- if(xSequence.hasElements())
+ // create cloned object without text, but with XLINE_SOLID,
+ // COL_BLACK as line color and XFILL_NONE
+ SdrObject* pClone = Clone();
+
+ if(pClone)
{
- // use neutral ViewInformation
- const drawinglayer::geometry::ViewInformation2D aViewInformation2D(0);
+ const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(this);
+
+ if(pTextObj)
+ {
+ // no text and no text animation
+ pClone->SetMergedItem(SdrTextAniKindItem(SDRTEXTANI_NONE));
+ pClone->SetOutlinerParaObject(0);
+ }
+
+ const SdrEdgeObj* pEdgeObj = dynamic_cast< const SdrEdgeObj* >(this);
+
+ if(pEdgeObj)
+ {
+ // create connections if connector, will be cleaned up when
+ // deleting the connector again
+ SdrObject* pLeft = pEdgeObj->GetConnectedNode(TRUE);
+ SdrObject* pRight = pEdgeObj->GetConnectedNode(FALSE);
+
+ if(pLeft)
+ {
+ pClone->ConnectToNode(TRUE, pLeft);
+ }
+
+ if(pRight)
+ {
+ pClone->ConnectToNode(FALSE, pRight);
+ }
+ }
- // create extractor, process and get result
- drawinglayer::processor2d::ContourExtractor2D aExtractor(aViewInformation2D);
- aExtractor.process(xSequence);
- const std::vector< basegfx::B2DPolyPolygon >& rResult(aExtractor.getExtractedContour());
- const sal_uInt32 nSize(rResult.size());
+ SfxItemSet aNewSet(*GetObjectItemPool());
- // the topology for contour is correctly a vector of PolyPolygons; for
- // historical reasons cut it back to a single PolyPolygon here
- for(sal_uInt32 a(0); a < nSize; a++)
+ // solid black lines and no fill
+ aNewSet.Put(XLineStyleItem(XLINE_SOLID));
+ aNewSet.Put(XLineColorItem(String(), Color(COL_BLACK)));
+ aNewSet.Put(XFillStyleItem(XFILL_NONE));
+ pClone->SetMergedItemSet(aNewSet);
+
+ // get sequence from clone
+ const sdr::contact::ViewContact& rVC(pClone->GetViewContact());
+ const drawinglayer::primitive2d::Primitive2DSequence xSequence(rVC.getViewIndependentPrimitive2DSequence());
+
+ if(xSequence.hasElements())
{
- aRetval.append(rResult[a]);
+ // use neutral ViewInformation
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D(0);
+
+ // create extractor, process and get result
+ drawinglayer::processor2d::ContourExtractor2D aExtractor(aViewInformation2D);
+ aExtractor.process(xSequence);
+ const std::vector< basegfx::B2DPolyPolygon >& rResult(aExtractor.getExtractedContour());
+ const sal_uInt32 nSize(rResult.size());
+
+ // when count is one, it is implied that the object has only it's normal
+ // contour anyways and TakeCountour() is to return an empty PolyPolygon
+ // (see old implementation for historical reasons)
+ if(nSize > 1)
+ {
+ // the topology for contour is correctly a vector of PolyPolygons; for
+ // historical reasons cut it back to a single PolyPolygon here
+ for(sal_uInt32 a(0); a < nSize; a++)
+ {
+ aRetval.append(rResult[a]);
+ }
+ }
}
+
+ delete pClone;
}
return aRetval;
@@ -1782,7 +1834,7 @@ void SdrObject::PaintMacro(OutputDevice& rOut, const Rectangle& rDirtyRect, cons
else
{
const RasterOp eRop(rOut.GetRasterOp());
- const basegfx::B2DPolyPolygon aPolyPolygon(TakeXorPoly(true));
+ const basegfx::B2DPolyPolygon aPolyPolygon(TakeXorPoly());
const sal_uInt32 nCount(aPolyPolygon.count());
rOut.SetLineColor(COL_BLACK);
diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
index af09d0fd8ca5..9ff1416dbd2f 100644
--- a/svx/source/svdraw/svdocapt.cxx
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdocapt.cxx,v $
- * $Revision: 1.30 $
+ * $Revision: 1.30.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -303,9 +303,9 @@ void SdrCaptionObj::TakeObjNamePlural(XubString& rName) const
rName=ImpGetResStr(STR_ObjNamePluralCAPTION);
}
-basegfx::B2DPolyPolygon SdrCaptionObj::TakeXorPoly(sal_Bool bDetail) const
+basegfx::B2DPolyPolygon SdrCaptionObj::TakeXorPoly() const
{
- basegfx::B2DPolyPolygon aPolyPoly(SdrRectObj::TakeXorPoly(bDetail));
+ basegfx::B2DPolyPolygon aPolyPoly(SdrRectObj::TakeXorPoly());
aPolyPoly.append(aTailPoly.getB2DPolygon());
return aPolyPoly;
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index 4141c761bc53..d156071a858d 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdocirc.cxx,v $
- * $Revision: 1.37 $
+ * $Revision: 1.37.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -497,7 +497,7 @@ void SdrCircObj::operator=(const SdrObject& rObj)
aPnt2 = ((SdrCircObj&)rObj).aPnt2;
}
-basegfx::B2DPolyPolygon SdrCircObj::TakeXorPoly(sal_Bool /*bDetail*/) const
+basegfx::B2DPolyPolygon SdrCircObj::TakeXorPoly() const
{
const basegfx::B2DPolygon aCircPolygon(ImpCalcXPolyCirc(meCircleKind, aRect, nStartWink, nEndWink));
return basegfx::B2DPolyPolygon(aCircPolygon);
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index c65c5d4fc62f..f55424c75182 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdoedge.cxx,v $
- * $Revision: 1.45 $
+ * $Revision: 1.45.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -1675,7 +1675,7 @@ void SdrEdgeObj::TakeObjNamePlural(XubString& rName) const
rName=ImpGetResStr(STR_ObjNamePluralEDGE);
}
-basegfx::B2DPolyPolygon SdrEdgeObj::TakeXorPoly(sal_Bool /*bDetail*/) const
+basegfx::B2DPolyPolygon SdrEdgeObj::TakeXorPoly() const
{
basegfx::B2DPolyPolygon aPolyPolygon;
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 5b15013a7031..fd6d76f0b94b 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdograf.cxx,v $
- * $Revision: 1.84 $
+ * $Revision: 1.84.18.2 $
*
* This file is part of OpenOffice.org.
*
@@ -291,9 +291,13 @@ void SdrGrafObj::SetGraphicObject( const GraphicObject& rGrfObj )
// -----------------------------------------------------------------------------
-const GraphicObject& SdrGrafObj::GetGraphicObject() const
+const GraphicObject& SdrGrafObj::GetGraphicObject(bool bForceSwapIn) const
{
- ForceSwapIn();
+ if(bForceSwapIn)
+ {
+ ForceSwapIn();
+ }
+
return *pGraphic;
}
@@ -685,7 +689,7 @@ void SdrGrafObj::operator=( const SdrObject& rObj )
// -----------------------------------------------------------------------------
// #i25616#
-basegfx::B2DPolyPolygon SdrGrafObj::TakeXorPoly(sal_Bool bDetail) const
+basegfx::B2DPolyPolygon SdrGrafObj::TakeXorPoly() const
{
if(mbInsidePaint)
{
@@ -707,7 +711,7 @@ basegfx::B2DPolyPolygon SdrGrafObj::TakeXorPoly(sal_Bool bDetail) const
else
{
// call parent
- return SdrRectObj::TakeXorPoly(bDetail);
+ return SdrRectObj::TakeXorPoly();
}
}
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index 46fb9421d1c3..c2408bb42061 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdogrp.cxx,v $
- * $Revision: 1.38 $
+ * $Revision: 1.38.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -38,11 +38,7 @@
#include <svx/svdogrp.hxx>
-#ifndef SVX_LIGHT
-#ifndef _LNKBASE_HXX //autogen
#include <sfx2/lnkbase.hxx>
-#endif
-#endif
#include <tools/urlobj.hxx>
#include <svtools/urihelper.hxx>
@@ -386,7 +382,7 @@ void SdrObjGroup::RecalcSnapRect()
// nicht erforderlich, da die Rects von der SubList verwendet werden.
}
-basegfx::B2DPolyPolygon SdrObjGroup::TakeXorPoly(sal_Bool bDetail) const
+basegfx::B2DPolyPolygon SdrObjGroup::TakeXorPoly() const
{
basegfx::B2DPolyPolygon aRetval;
const sal_uInt32 nObjCount(pSub->GetObjCount());
@@ -394,7 +390,7 @@ basegfx::B2DPolyPolygon SdrObjGroup::TakeXorPoly(sal_Bool bDetail) const
for(sal_uInt32 a(0L); a < nObjCount; a++)
{
SdrObject* pObj = pSub->GetObj(a);
- aRetval.append(pObj->TakeXorPoly(bDetail));
+ aRetval.append(pObj->TakeXorPoly());
}
if(!aRetval.count())
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index 560f27549bb1..a446be3d0efe 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdomeas.cxx,v $
- * $Revision: 1.35 $
+ * $Revision: 1.35.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -823,7 +823,7 @@ void SdrMeasureObj::TakeObjNamePlural(XubString& rName) const
rName=ImpGetResStr(STR_ObjNamePluralMEASURE);
}
-basegfx::B2DPolyPolygon SdrMeasureObj::TakeXorPoly(sal_Bool /*bDetail*/) const
+basegfx::B2DPolyPolygon SdrMeasureObj::TakeXorPoly() const
{
ImpMeasureRec aRec;
ImpMeasurePoly aMPol;
@@ -1239,7 +1239,7 @@ void SdrMeasureObj::RestGeoData(const SdrObjGeoData& rGeo)
SdrObject* SdrMeasureObj::DoConvertToPolyObj(BOOL bBezier) const
{
// get XOR Poly as base
- XPolyPolygon aTmpPolyPolygon(TakeXorPoly(TRUE));
+ XPolyPolygon aTmpPolyPolygon(TakeXorPoly());
// get local ItemSet and StyleSheet
SfxItemSet aSet(GetObjectItemSet());
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 17a1025b536d..6dd5003ae2ef 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdopath.cxx,v $
- * $Revision: 1.51 $
+ * $Revision: 1.51.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -2043,7 +2043,7 @@ void SdrPathObj::TakeObjNamePlural(XubString& rName) const
}
}
-basegfx::B2DPolyPolygon SdrPathObj::TakeXorPoly(sal_Bool /*bDetail*/) const
+basegfx::B2DPolyPolygon SdrPathObj::TakeXorPoly() const
{
return GetPathPoly();
}
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index 44b71e5f7c16..a338889afa48 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdorect.cxx,v $
- * $Revision: 1.31 $
+ * $Revision: 1.31.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -364,7 +364,7 @@ void SdrRectObj::operator=(const SdrObject& rObj)
SdrTextObj::operator=(rObj);
}
-basegfx::B2DPolyPolygon SdrRectObj::TakeXorPoly(sal_Bool /*bDetail*/) const
+basegfx::B2DPolyPolygon SdrRectObj::TakeXorPoly() const
{
XPolyPolygon aXPP;
aXPP.Insert(ImpCalcXPoly(aRect,GetEckenradius()));
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 64e70427d076..56c8366368df 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdotext.cxx,v $
- * $Revision: 1.90 $
+ * $Revision: 1.90.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -736,7 +736,7 @@ FASTBOOL SdrTextObj::NbcSetFitToSize(SdrFitToSizeType eFit)
void SdrTextObj::ImpSetContourPolygon( SdrOutliner& rOutliner, Rectangle& rAnchorRect, BOOL bLineWidth ) const
{
- basegfx::B2DPolyPolygon aXorPolyPolygon(TakeXorPoly(FALSE));
+ basegfx::B2DPolyPolygon aXorPolyPolygon(TakeXorPoly());
basegfx::B2DPolyPolygon* pContourPolyPolygon = 0L;
basegfx::B2DHomMatrix aMatrix;
@@ -1347,7 +1347,7 @@ void SdrTextObj::operator=(const SdrObject& rObj)
}
}
-basegfx::B2DPolyPolygon SdrTextObj::TakeXorPoly(sal_Bool /*bDetail*/) const
+basegfx::B2DPolyPolygon SdrTextObj::TakeXorPoly() const
{
Polygon aPol(aRect);
if (aGeo.nShearWink!=0) ShearPoly(aPol,aRect.TopLeft(),aGeo.nTan);
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 8ebdb320e4de..25c743850bf2 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: svdotextdecomposition.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.18.2 $
*
* This file is part of OpenOffice.org.
*
@@ -90,6 +90,9 @@ namespace
basegfx::B2DHomMatrix maNewTransformA;
basegfx::B2DHomMatrix maNewTransformB;
+ // the visible area for contour text decomposition
+ basegfx::B2DVector maScale;
+
DECL_LINK(decomposeContourTextPrimitive, DrawPortionInfo* );
DECL_LINK(decomposeBlockTextPrimitive, DrawPortionInfo* );
DECL_LINK(decomposeStretchTextPrimitive, DrawPortionInfo* );
@@ -112,8 +115,9 @@ namespace
{
}
- void decomposeContourTextPrimitive(const basegfx::B2DHomMatrix& rNewTransformA, const basegfx::B2DHomMatrix& rNewTransformB)
+ void decomposeContourTextPrimitive(const basegfx::B2DHomMatrix& rNewTransformA, const basegfx::B2DHomMatrix& rNewTransformB, const basegfx::B2DVector& rScale)
{
+ maScale = rScale;
maNewTransformA = rNewTransformA;
maNewTransformB = rNewTransformB;
mrOutliner.SetDrawPortionHdl(LINK(this, impTextBreakupHandler, decomposeContourTextPrimitive));
@@ -511,7 +515,9 @@ namespace
IMPL_LINK(impTextBreakupHandler, decomposeContourTextPrimitive, DrawPortionInfo*, pInfo)
{
- if(pInfo)
+ // for contour text, ignore (clip away) all portions which are below
+ // the visible area given by maScale
+ if(pInfo && (double)pInfo->mrStartPos.Y() < maScale.getY())
{
impHandleDrawPortionInfo(*pInfo);
}
@@ -641,7 +647,7 @@ bool SdrTextObj::impDecomposeContourTextPrimitive(
// now break up text primitives.
impTextBreakupHandler aConverter(rOutliner);
- aConverter.decomposeContourTextPrimitive(aNewTransformA, aNewTransformB);
+ aConverter.decomposeContourTextPrimitive(aNewTransformA, aNewTransformB, aScale);
// cleanup outliner
rOutliner.Clear();
@@ -705,7 +711,7 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive(
}
else
{
- if(IsTextFrame() && !rSdrBlockTextPrimitive.getUnlimitedPage())
+ if((rSdrBlockTextPrimitive.getWordWrap() || IsTextFrame()) && !rSdrBlockTextPrimitive.getUnlimitedPage())
{
rOutliner.SetMaxAutoPaperSize(aAnchorTextSize);
}
diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx
index 3d191cfa78a8..aea0523c895b 100644
--- a/svx/source/svdraw/svdovirt.cxx
+++ b/svx/source/svdraw/svdovirt.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdovirt.cxx,v $
- * $Revision: 1.21 $
+ * $Revision: 1.21.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -215,9 +215,9 @@ void operator +=(PolyPolygon& rPoly, const Point& rOfs)
}
}
-basegfx::B2DPolyPolygon SdrVirtObj::TakeXorPoly(sal_Bool bDetail) const
+basegfx::B2DPolyPolygon SdrVirtObj::TakeXorPoly() const
{
- basegfx::B2DPolyPolygon aPolyPolygon(rRefObj.TakeXorPoly(bDetail));
+ basegfx::B2DPolyPolygon aPolyPolygon(rRefObj.TakeXorPoly());
if(aAnchor.X() || aAnchor.Y())
{
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index d851e3f4bb33..976f48c82194 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdundo.cxx,v $
- * $Revision: 1.31 $
+ * $Revision: 1.31.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -43,17 +43,12 @@
#include "svdglob.hxx" // StringCache
#include <svx/scene3d.hxx>
#include <svx/outlobj.hxx>
-
-// #i11426#
#include <svx/svdogrp.hxx>
#include <svx/sdr/properties/itemsettools.hxx>
#include <svx/sdr/properties/properties.hxx>
-
-// #109587#
#include <svx/svdocapt.hxx>
-
-// #109587#
#include <svtools/whiter.hxx>
+#include <svx/e3dsceneupdater.hxx>
#include "svdviter.hxx"
@@ -386,6 +381,7 @@ void SdrUndoAttrObj::SetRepeatAttr(const SfxItemSet& rSet)
void SdrUndoAttrObj::Undo()
{
+ E3DModifySceneSnapRectUpdater aUpdater(pObj);
BOOL bIs3DScene(pObj && pObj->ISA(E3dScene));
// #94278# Trigger PageChangeCall
@@ -486,6 +482,7 @@ void SdrUndoAttrObj::Undo()
void SdrUndoAttrObj::Redo()
{
+ E3DModifySceneSnapRectUpdater aUpdater(pObj);
BOOL bIs3DScene(pObj && pObj->ISA(E3dScene));
if(!pUndoGroup || bIs3DScene)
@@ -777,6 +774,7 @@ void SdrUndoRemoveObj::Undo()
aOwnerAnchorPos = pObjList->GetOwnerObj()->GetAnchorPos();
}
+ E3DModifySceneSnapRectUpdater aUpdater(pObjList->GetOwnerObj());
SdrInsertReason aReason(SDRREASON_UNDO);
pObjList->InsertObject(pObj,nOrdNum,&aReason);
@@ -785,13 +783,6 @@ void SdrUndoRemoveObj::Undo()
{
pObj->NbcSetAnchorPos(aOwnerAnchorPos);
}
-
- if(pObjList->GetOwnerObj() && pObjList->GetOwnerObj()->ISA(E3dObject) && pObj->ISA(E3dObject))
- {
- E3dScene* pScene = ((E3dObject*)pObjList->GetOwnerObj())->GetScene();
- if(pScene)
- pScene->CorrectSceneDimensions();
- }
}
}
@@ -801,18 +792,8 @@ void SdrUndoRemoveObj::Redo()
if (pObj->IsInserted())
{
ImplUnmarkObject( pObj );
-
-#ifdef DBG_UTIL
- SdrObject* pChkObj=
-#endif
+ E3DModifySceneSnapRectUpdater aUpdater(pObj);
pObjList->RemoveObject(nOrdNum);
- DBG_ASSERT(pChkObj==pObj,"RedoRemoveObj: RemoveObjNum!=pObj");
- if(pObjList->GetOwnerObj() && pObjList->GetOwnerObj()->ISA(E3dObject) && pObj->ISA(E3dObject))
- {
- E3dScene* pScene = ((E3dObject*)pObjList->GetOwnerObj())->GetScene();
- if(pScene)
- pScene->CorrectSceneDimensions();
- }
}
// #94278# Trigger PageChangeCall
@@ -836,12 +817,6 @@ void SdrUndoInsertObj::Undo()
#endif
pObjList->RemoveObject(nOrdNum);
DBG_ASSERT(pChkObj==pObj,"UndoInsertObj: RemoveObjNum!=pObj");
- if(pObjList->GetOwnerObj() && pObjList->GetOwnerObj()->ISA(E3dObject) && pObj->ISA(E3dObject))
- {
- E3dScene* pScene = ((E3dObject*)pObjList->GetOwnerObj())->GetScene();
- if(pScene)
- pScene->CorrectSceneDimensions();
- }
}
}
@@ -871,13 +846,6 @@ void SdrUndoInsertObj::Redo()
pObj->NbcSetAnchorPos( aAnchorPos );
}
// <--
-
- if(pObjList->GetOwnerObj() && pObjList->GetOwnerObj()->ISA(E3dObject) && pObj->ISA(E3dObject))
- {
- E3dScene* pScene = ((E3dObject*)pObjList->GetOwnerObj())->GetScene();
- if(pScene)
- pScene->CorrectSceneDimensions();
- }
}
// #94278# Trigger PageChangeCall
diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index 355f0a261615..465b5be209c3 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdview.cxx,v $
- * $Revision: 1.29 $
+ * $Revision: 1.29.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -123,7 +123,7 @@ void SdrDropMarkerOverlay::ImplCreateOverlays(const SdrView& rView, const basegf
SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject)
{
- ImplCreateOverlays(rView, rObject.TakeXorPoly(true));
+ ImplCreateOverlays(rView, rObject.TakeXorPoly());
}
SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const Rectangle& rRectangle)
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index d5cb7f8951a4..207faa7d78ea 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdxcgv.cxx,v $
- * $Revision: 1.34 $
+ * $Revision: 1.34.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -665,8 +665,9 @@ Graphic SdrExchangeView::GetObjGraphic( SdrModel* pModel, SdrObject* pObj )
aMtf.Record( &aOut );
// aXOut.SetOffset( Point( -aBoundRect.Left(), -aBoundRect.Top() ) );
+ // #i92760# offset set in wrong direction, corrected
MapMode aOffsetMapMode(aOut.GetMapMode());
- aOffsetMapMode.SetOrigin(aBoundRect.TopLeft());
+ aOffsetMapMode.SetOrigin(Point(-aBoundRect.Left(), -aBoundRect.Top()));
aOut.SetMapMode(aOffsetMapMode);
pObj->SingleObjectPainter( aOut ); // #110094#-17
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 77185b060099..dabbe9f9a741 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdotable.cxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -1997,9 +1997,9 @@ void SdrTableObj::operator=(const SdrObject& rObj)
// --------------------------------------------------------------------
-basegfx::B2DPolyPolygon SdrTableObj::TakeXorPoly(sal_Bool bDetail ) const
+basegfx::B2DPolyPolygon SdrTableObj::TakeXorPoly() const
{
- return SdrTextObj::TakeXorPoly( bDetail );
+ return SdrTextObj::TakeXorPoly();
}
// --------------------------------------------------------------------
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
index 3607982a60e5..c1c58977be64 100644
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewcontactoftableobj.cxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -123,7 +123,7 @@ namespace drawinglayer
getTransform(),
*getSdrFTAttribute().getText(),
0,
- true));
+ true, false));
}
}
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index 9cb9f4533a56..8690fa97c0bf 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: unopage.cxx,v $
- * $Revision: 1.50 $
+ * $Revision: 1.50.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -618,7 +618,6 @@ SdrObject *SvxDrawPage::_CreateSdrObject( const Reference< drawing::XShape > & x
pScene->SetCamera(aCam);
pScene->SetRectsDirty();
- pScene->InitTransformationSet();
}
else if(pNewObj->ISA(E3dExtrudeObj))
{
@@ -627,10 +626,6 @@ SdrObject *SvxDrawPage::_CreateSdrObject( const Reference< drawing::XShape > & x
aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0));
aNewPolygon.append(basegfx::B2DPoint(0.0, 1.0));
aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0));
-
- // #87922#
- // To avoid that CreateGeometry(...) sets the DoubleSided
- // item at once, use a closed poylgon.
aNewPolygon.setClosed(true);
pObj->SetExtrudePolygon(basegfx::B2DPolyPolygon(aNewPolygon));
@@ -644,10 +639,6 @@ SdrObject *SvxDrawPage::_CreateSdrObject( const Reference< drawing::XShape > & x
aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0));
aNewPolygon.append(basegfx::B2DPoint(0.0, 1.0));
aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0));
-
- // #87922#
- // To avoid that CreateGeometry(...) sets the DoubleSided
- // item at once, use a closed poylgon.
aNewPolygon.setClosed(true);
pObj->SetPolyPoly2D(basegfx::B2DPolyPolygon(aNewPolygon));
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
index 35c69b4dc31d..3792e98641e1 100644
--- a/svx/source/unodraw/unoshap3.cxx
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: unoshap3.cxx,v $
- * $Revision: 1.32 $
+ * $Revision: 1.32.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -378,15 +378,15 @@ bool Svx3DSceneObject::setPropertyValueImpl( const SfxItemPropertyMap* pProperty
while(aIter.IsMore())
{
E3dObject* p3DObj = (E3dObject*)aIter.Next();
- p3DObj->NbcResetTransform();
+ p3DObj->NbcSetTransform(basegfx::B3DHomMatrix());
}
// reset scene transformation and make a complete recalc
- pScene->NbcResetTransform();
+ pScene->NbcSetTransform(basegfx::B3DHomMatrix());
// fill old camera from new parameters
Camera3D aCam(pScene->GetCamera());
- const Volume3D& rVolume = pScene->GetBoundVolume();
+ const basegfx::B3DRange& rVolume = pScene->GetBoundVolume();
double fW = rVolume.getWidth();
double fH = rVolume.getHeight();
@@ -431,12 +431,8 @@ bool Svx3DSceneObject::setPropertyValueImpl( const SfxItemPropertyMap* pProperty
// set scene transformation again at scene
pScene->NbcSetTransform(aSceneTAR.maMat);
- pScene->FitSnapRectToBoundVol();
pScene->NbcSetSnapRect(aSceneTAR.maRect);
- // #86559# init transformation set to allow correct
- // calculation of BoundRect
- pScene->InitTransformationSet();
return true;
}
break;
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index bdc71d13572a..1cc33d2560aa 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: unoshape.cxx,v $
- * $Revision: 1.178 $
+ * $Revision: 1.178.104.1 $
*
* This file is part of OpenOffice.org.
*
@@ -2292,8 +2292,8 @@ bool SvxShape::setPropertyValueImpl( const SfxItemPropertyMap* pProperty, const
basegfx::B2DHomMatrix aNewHomogenMatrix;
mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
- aVclPoint.X() += FRound(aNewHomogenMatrix.get(0, 2));
- aVclPoint.Y() += FRound(aNewHomogenMatrix.get(1, 2));
+ aVclPoint.X() += basegfx::fround(aNewHomogenMatrix.get(0, 2));
+ aVclPoint.Y() += basegfx::fround(aNewHomogenMatrix.get(1, 2));
// #88657# metric of pool maybe twips (writer)
ForceMetricToItemPoolMetric(aVclPoint);
@@ -2716,8 +2716,8 @@ bool SvxShape::getPropertyValueImpl( const SfxItemPropertyMap* pProperty, ::com:
basegfx::B2DHomMatrix aNewHomogenMatrix;
mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
- aVclPoint.X() -= FRound(aNewHomogenMatrix.get(0, 2));
- aVclPoint.Y() -= FRound(aNewHomogenMatrix.get(1, 2));
+ aVclPoint.X() -= basegfx::fround(aNewHomogenMatrix.get(0, 2));
+ aVclPoint.Y() -= basegfx::fround(aNewHomogenMatrix.get(1, 2));
awt::Point aPnt( aVclPoint.X(), aVclPoint.Y() );
rValue <<= aPnt;