summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.cxx25
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.hxx6
-rw-r--r--svx/source/dialog/dlgctl3d.cxx1810
-rw-r--r--svx/source/engine3d/cube3d.cxx185
-rw-r--r--svx/source/engine3d/deflt3d.cxx6
-rw-r--r--svx/source/engine3d/dragmt3d.cxx630
-rw-r--r--svx/source/engine3d/e3dsceneupdater.cxx133
-rw-r--r--svx/source/engine3d/e3dundo.cxx25
-rw-r--r--svx/source/engine3d/extrud3d.cxx254
-rw-r--r--svx/source/engine3d/float3d.cxx247
-rw-r--r--svx/source/engine3d/helperhittest3d.cxx443
-rw-r--r--svx/source/engine3d/helperminimaldepth3d.cxx215
-rw-r--r--svx/source/engine3d/helperminimaldepth3d.hxx63
-rw-r--r--svx/source/engine3d/lathe3d.cxx316
-rw-r--r--svx/source/engine3d/makefile.mk5
-rw-r--r--svx/source/engine3d/obj3d.cxx2400
-rw-r--r--svx/source/engine3d/polygn3d.cxx78
-rw-r--r--svx/source/engine3d/polysc3d.cxx4
-rw-r--r--svx/source/engine3d/scene3d.cxx607
-rw-r--r--svx/source/engine3d/sphere3d.cxx252
-rw-r--r--svx/source/engine3d/view3d.cxx479
-rw-r--r--svx/source/engine3d/view3d1.cxx45
-rw-r--r--svx/source/engine3d/viewpt3d.cxx26
-rw-r--r--svx/source/engine3d/volume3d.cxx235
-rw-r--r--svx/source/msfilter/msashape3d.cxx7
-rw-r--r--svx/source/sdr/contact/objectcontactofpageview.cxx10
-rw-r--r--svx/source/sdr/contact/objectcontacttools.cxx4
-rw-r--r--svx/source/sdr/contact/viewcontactofe3d.cxx113
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dcube.cxx5
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dextrude.cxx9
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dlathe.cxx9
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dpolygon.cxx6
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dscene.cxx6
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dsphere.cxx5
-rw-r--r--svx/source/sdr/contact/viewcontactofgraphic.cxx39
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx8
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrole2obj.cxx18
-rw-r--r--svx/source/sdr/contact/viewcontactofunocontrol.cxx8
-rw-r--r--svx/source/sdr/contact/viewobjectcontact.cxx8
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofgraphic.cxx65
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofpageobj.cxx254
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx76
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx77
-rw-r--r--svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx16
-rw-r--r--svx/source/sdr/primitive2d/sdrdecompositiontools.cxx7
-rw-r--r--svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx6
-rw-r--r--svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrole2primitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx13
-rw-r--r--svx/source/sdr/properties/e3dcompoundproperties.cxx14
-rw-r--r--svx/source/sdr/properties/e3dextrudeproperties.cxx8
-rw-r--r--svx/source/sdr/properties/e3dlatheproperties.cxx12
-rw-r--r--svx/source/sdr/properties/e3dproperties.cxx4
-rw-r--r--svx/source/sdr/properties/e3dsceneproperties.cxx185
-rw-r--r--svx/source/sdr/properties/e3dsphereproperties.cxx6
-rw-r--r--svx/source/svdraw/gradtrns.cxx7
-rw-r--r--svx/source/svdraw/svdcrtv.cxx77
-rw-r--r--svx/source/svdraw/svddrgv.cxx257
-rw-r--r--svx/source/svdraw/svdedtv.cxx72
-rw-r--r--svx/source/svdraw/svdedtv1.cxx105
-rw-r--r--svx/source/svdraw/svdetc.cxx9
-rw-r--r--svx/source/svdraw/svdhdl.cxx167
-rw-r--r--svx/source/svdraw/svdmrkv.cxx8
-rw-r--r--svx/source/svdraw/svdoashp.cxx15
-rw-r--r--svx/source/svdraw/svdoattr.cxx5
-rw-r--r--svx/source/svdraw/svdobj.cxx120
-rw-r--r--svx/source/svdraw/svdocapt.cxx6
-rw-r--r--svx/source/svdraw/svdocirc.cxx4
-rw-r--r--svx/source/svdraw/svdoedge.cxx4
-rw-r--r--svx/source/svdraw/svdograf.cxx14
-rw-r--r--svx/source/svdraw/svdogrp.cxx10
-rw-r--r--svx/source/svdraw/svdomeas.cxx6
-rw-r--r--svx/source/svdraw/svdopath.cxx4
-rw-r--r--svx/source/svdraw/svdorect.cxx4
-rw-r--r--svx/source/svdraw/svdotext.cxx6
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx16
-rw-r--r--svx/source/svdraw/svdovirt.cxx6
-rw-r--r--svx/source/svdraw/svdundo.cxx44
-rw-r--r--svx/source/svdraw/svdview.cxx4
-rw-r--r--svx/source/svdraw/svdxcgv.cxx5
-rw-r--r--svx/source/table/svdotable.cxx6
-rw-r--r--svx/source/table/viewcontactoftableobj.cxx4
-rw-r--r--svx/source/unodraw/unopage.cxx11
-rw-r--r--svx/source/unodraw/unoshap3.cxx12
-rw-r--r--svx/source/unodraw/unoshape.cxx10
90 files changed, 3930 insertions, 6603 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index 93ede44e8e..f2b603281d 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: EnhancedCustomShape3d.cxx,v $
- * $Revision: 1.19 $
+ * $Revision: 1.19.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -33,18 +33,14 @@
#include "EnhancedCustomShape3d.hxx"
#include <svx/svdetc.hxx>
#include <svx/svdmodel.hxx>
-#ifndef _SV_POLY_HXX
#include <tools/poly.hxx>
-#endif
#include <svditer.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdoashp.hxx>
#include <svtools/poolitem.hxx>
#include <svtools/itemset.hxx>
#include <svx/xfillit0.hxx>
-#ifndef SVX_XSFLCLIT_HXX
#include <svx/xsflclit.hxx>
-#endif
#include <svx/xit.hxx>
#include <svx/xbtmpit.hxx>
#include <svx/xflclit.hxx>
@@ -64,9 +60,7 @@
#include <com/sun/star/drawing/Direction3D.hpp>
#include <com/sun/star/drawing/ShadeMode.hpp>
#include <svx/sdr/properties/properties.hxx>
-#ifndef _COM_SUN_STAR_DRAWING_ENHANCEDCUSTOMSHAPEPARAMETERPARIR_HPP_
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
-#endif
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/range/b2drange.hxx>
@@ -87,6 +81,7 @@ void GetOrigin( SdrCustomShapeGeometryItem& rItem, double& rOriginX, double& rOr
rOriginY =-0.50;
}
}
+
void GetRotateAngle( SdrCustomShapeGeometryItem& rItem, double& rAngleX, double& rAngleY )
{
::com::sun::star::drawing::EnhancedCustomShapeParameterPair aRotateAngleParaPair;
@@ -100,6 +95,7 @@ void GetRotateAngle( SdrCustomShapeGeometryItem& rItem, double& rAngleX, double&
rAngleX *= F_PI180;
rAngleY *= F_PI180;
}
+
void GetSkew( SdrCustomShapeGeometryItem& rItem, double& rSkewAmount, double& rSkewAngle )
{
::com::sun::star::drawing::EnhancedCustomShapeParameterPair aSkewParaPair;
@@ -112,6 +108,7 @@ void GetSkew( SdrCustomShapeGeometryItem& rItem, double& rSkewAmount, double& rS
}
rSkewAngle *= F_PI180;
}
+
void GetExtrusionDepth( SdrCustomShapeGeometryItem& rItem, const double* pMap, double& rBackwardDepth, double& rForwardDepth )
{
::com::sun::star::drawing::EnhancedCustomShapeParameterPair aDepthParaPair;
@@ -135,6 +132,7 @@ void GetExtrusionDepth( SdrCustomShapeGeometryItem& rItem, const double* pMap, d
rForwardDepth *= fMap;
}
}
+
double GetDouble( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, double fDefault, const double* pMap )
{
double fRetValue = fDefault;
@@ -145,6 +143,7 @@ double GetDouble( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPrope
fRetValue *= *pMap;
return fRetValue;
}
+
drawing::ShadeMode GetShadeMode( SdrCustomShapeGeometryItem& rItem, const drawing::ShadeMode eDefault )
{
drawing::ShadeMode eRet( eDefault );
@@ -154,6 +153,7 @@ drawing::ShadeMode GetShadeMode( SdrCustomShapeGeometryItem& rItem, const drawin
*pAny >>= eRet;
return eRet;
}
+
sal_Int32 GetInt32( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, const sal_Int32 nDefault )
{
sal_Int32 nRetValue = nDefault;
@@ -162,6 +162,7 @@ sal_Int32 GetInt32( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPro
*pAny >>= nRetValue;
return nRetValue;
}
+
sal_Bool GetBool( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, const sal_Bool bDefault )
{
sal_Bool bRetValue = bDefault;
@@ -170,6 +171,7 @@ sal_Bool GetBool( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPrope
*pAny >>= bRetValue;
return bRetValue;
}
+
awt::Point GetPoint( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, const awt::Point& rDefault )
{
awt::Point aRetValue( rDefault );
@@ -178,6 +180,7 @@ awt::Point GetPoint( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPr
*pAny >>= aRetValue;
return aRetValue;
}
+
drawing::Position3D GetPosition3D( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName,
const drawing::Position3D& rDefault, const double* pMap )
{
@@ -410,7 +413,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
if( aPolyPoly.count() )
{
const basegfx::B2DRange aTempRange(basegfx::tools::getRange(aPolyPoly));
- const Rectangle aBoundRect(FRound(aTempRange.getMinX()), FRound(aTempRange.getMinY()), FRound(aTempRange.getMaxX()), FRound(aTempRange.getMaxY()));
+ const Rectangle aBoundRect(basegfx::fround(aTempRange.getMinX()), basegfx::fround(aTempRange.getMinY()), basegfx::fround(aTempRange.getMaxX()), basegfx::fround(aTempRange.getMaxY()));
aBoundRect2d.Union( aBoundRect );
E3dCompoundObject* p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, bUseTwoFillStyles ? 10 : fDepth );
@@ -499,8 +502,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
// Kameraeinstellungen, Perspektive ...
Camera3D& rCamera = (Camera3D&)pScene->GetCamera();
- const Volume3D& rVolume = pScene->GetBoundVolume();
- pScene->CorrectSceneDimensions();
+ const basegfx::B3DRange& rVolume = pScene->GetBoundVolume();
pScene->NbcSetSnapRect( aSnapRect );
// InitScene replacement
@@ -573,8 +575,8 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
rCamera.SetPosAndLookAt( aNewCamPos, _aLookAt );
pScene->SetCamera( rCamera );
}
+
pScene->NbcSetTransform( aNewTransform );
- pScene->FitSnapRectToBoundVol();
///////////
// light //
@@ -663,7 +665,6 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
// SJ: not setting model, so we save a lot of broadcasting and the model is not modified any longer
// pScene->SetModel( pModel );
- pScene->InitTransformationSet();
pRet->SetSnapRect( CalculateNewSnapRect( pCustomShape, aBoundRect2d, pMap ) );
// removing placeholder objects
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.hxx b/svx/source/customshapes/EnhancedCustomShape3d.hxx
index 0bb4738512..dc6a6d77c0 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.hxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: EnhancedCustomShape3d.hxx,v $
- * $Revision: 1.7 $
+ * $Revision: 1.7.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -70,13 +70,9 @@ class EnhancedCustomShape3d
friend class Transformation2D;
protected :
-
-// static void Rotate( Vector3D& rPoint, const double x, const double y, const double z );
-// static void Rotate( basegfx::B3DPolyPolygon&, const Point3D& rRotateCenter, const double x, const double y, const double z );
static Rectangle CalculateNewSnapRect( const SdrObject* pCustomShape, const Rectangle& rBoundRect, const double* pMap );
public :
-
static SdrObject* Create3DObject( const SdrObject* pShape2d, const SdrObject* pCustomShape );
};
diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx
index 000fdc997c..fe75592b6e 100644
--- a/svx/source/dialog/dlgctl3d.cxx
+++ b/svx/source/dialog/dlgctl3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dlgctl3d.cxx,v $
- * $Revision: 1.20 $
+ * $Revision: 1.20.226.2 $
*
* This file is part of OpenOffice.org.
*
@@ -31,101 +31,93 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
+#include <svx/dlgctl3d.hxx>
#include <svx/dialogs.hrc>
-#include <svx/xflclit.hxx>
+#include <svx/view3d.hxx>
#include <svx/fmmodel.hxx>
+#include <svtools/itempool.hxx>
#include <svx/fmpage.hxx>
-#include <svx/view3d.hxx>
#include <svx/polysc3d.hxx>
-#include <svx/obj3d.hxx>
-#include <svx/camera3d.hxx>
-#include <svx/volume3d.hxx>
#include <svx/sphere3d.hxx>
#include <svx/cube3d.hxx>
-#include <vcl/event.hxx>
-#include <svtools/itempool.hxx>
-#include <svtools/style.hxx>
-
-#include <svx/dlgctl3d.hxx>
-#include <goodies/base3d.hxx>
-#include <tools/link.hxx>
-
-// #i58240#
-#ifndef _SVX_HELPID_HRC
+#include <vcl/svapp.hxx>
+#include <svx/helperhittest3d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/polygn3d.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnwtit.hxx>
#include "helpid.hrc"
-#endif
+#include <algorithm>
-/*************************************************************************
-|* 3D Preview Control
-|* Ctor
-\************************************************************************/
-Svx3DPreviewControl::Svx3DPreviewControl( Window* pParent, const ResId& rResId ) :
- Control ( pParent, rResId ),
- pModel ( NULL ),
- pFmPage ( NULL ),
- p3DView ( NULL ),
- pScene ( NULL ),
- p3DObj ( NULL ),
- nObjectType ( PREVIEW_OBJECTTYPE_SPHERE )
+//////////////////////////////////////////////////////////////////////////////
+
+Svx3DPreviewControl::Svx3DPreviewControl(Window* pParent, const ResId& rResId)
+: Control(pParent, rResId),
+ mpModel(0),
+ mpFmPage(0),
+ mp3DView(0),
+ mpScene(0),
+ mp3DObj(0),
+ mnObjectType(PREVIEW_OBJECTTYPE_SPHERE)
{
Construct();
+
+ // do not paint background self, DrawingLayer paints this buffered and as page
+ SetControlBackground();
+ SetBackground();
}
-/*************************************************************************
-|* Ctor
-\************************************************************************/
-Svx3DPreviewControl::Svx3DPreviewControl( Window* pParent, WinBits nStyle ) :
- Control ( pParent, nStyle ),
- pModel ( NULL ),
- pFmPage ( NULL ),
- p3DView ( NULL ),
- pScene ( NULL ),
- p3DObj ( NULL ),
- nObjectType ( PREVIEW_OBJECTTYPE_SPHERE )
+Svx3DPreviewControl::Svx3DPreviewControl(Window* pParent, WinBits nStyle)
+: Control(pParent, nStyle),
+ mpModel(0),
+ mpFmPage(0),
+ mp3DView(0),
+ mpScene(0),
+ mp3DObj(0),
+ mnObjectType(PREVIEW_OBJECTTYPE_SPHERE)
{
Construct();
+
+ // do not paint background self, DrawingLayer paints this buffered and as page
+ SetControlBackground();
+ SetBackground();
}
-/*************************************************************************
-|* Dtor
-\************************************************************************/
Svx3DPreviewControl::~Svx3DPreviewControl()
{
- delete p3DView;
- delete pModel;
+ delete mp3DView;
+ delete mpModel;
}
-/*************************************************************************
-|* Svx3DPreviewControl::Construct
-\************************************************************************/
void Svx3DPreviewControl::Construct()
{
// Do never mirror the preview window. This explicitly includes right
// to left writing environments.
EnableRTL (FALSE);
-
SetMapMode( MAP_100TH_MM );
// Model
- pModel = new FmFormModel();
- pModel->GetItemPool().FreezeIdRanges();
+ mpModel = new FmFormModel();
+ mpModel->GetItemPool().FreezeIdRanges();
// Page
- pFmPage = new FmFormPage( *pModel, NULL );
- pModel->InsertPage( pFmPage, 0 );
+ mpFmPage = new FmFormPage( *mpModel, NULL );
+ mpModel->InsertPage( mpFmPage, 0 );
// 3D View
- p3DView = new E3dView( pModel, this );
+ mp3DView = new E3dView( mpModel, this );
+ mp3DView->SetBufferedOutputAllowed(true);
+ mp3DView->SetBufferedOverlayAllowed(true);
// 3D Scene
- pScene = new E3dPolyScene(p3DView->Get3DDefaultAttributes());
+ mpScene = new E3dPolyScene(mp3DView->Get3DDefaultAttributes());
- // Objekt
+ // initially create object
SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
- // Kameraeinstellungen, Perspektive ...
- Camera3D& rCamera = (Camera3D&) pScene->GetCamera();
- const Volume3D& rVolume = pScene->GetBoundVolume();
+ // camera and perspective
+ Camera3D& rCamera = (Camera3D&) mpScene->GetCamera();
+ const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
double fW = rVolume.getWidth();
double fH = rVolume.getHeight();
double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
@@ -133,27 +125,25 @@ void Svx3DPreviewControl::Construct()
rCamera.SetAutoAdjustProjection(FALSE);
rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
basegfx::B3DPoint aLookAt;
- double fDefaultCamPosZ = p3DView->GetDefaultCamPosZ();
+ double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
rCamera.SetPosAndLookAt(aCamPos, aLookAt);
- double fDefaultCamFocal = p3DView->GetDefaultCamFocal();
+ double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
rCamera.SetFocalLength(fDefaultCamFocal);
rCamera.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt, fDefaultCamFocal);
- pScene->SetCamera( rCamera );
- pFmPage->InsertObject( pScene );
-
- pScene->RotateX( DEG2RAD( 25 ) );
- pScene->RotateY( DEG2RAD( 40 ) ); // Weil es auch ein Wuerfel sein kann
+ mpScene->SetCamera( rCamera );
+ mpFmPage->InsertObject( mpScene );
- // SnapRects der Objekte ungueltig
- pScene->SetRectsDirty();
+ basegfx::B3DHomMatrix aRotation;
+ aRotation.rotate(DEG2RAD( 25 ), 0.0, 0.0);
+ aRotation.rotate(0.0, DEG2RAD( 40 ), 0.0);
+ mpScene->SetTransform(aRotation * mpScene->GetTransform());
- // Transformationen initialisieren, damit bei RecalcSnapRect()
- // richtig gerechnet wird
- pScene->InitTransformationSet();
+ // invalidate SnapRects of objects
+ mpScene->SetRectsDirty();
- SfxItemSet aSet( pModel->GetItemPool(),
+ SfxItemSet aSet( mpModel->GetItemPool(),
XATTR_LINESTYLE, XATTR_LINESTYLE,
XATTR_FILL_FIRST, XATTR_FILLBITMAP,
0, 0 );
@@ -161,94 +151,74 @@ void Svx3DPreviewControl::Construct()
aSet.Put( XFillStyleItem( XFILL_SOLID ) );
aSet.Put( XFillColorItem( String(), Color( COL_WHITE ) ) );
-//-/ pScene->NbcSetAttributes( aSet, FALSE );
- pScene->SetMergedItemSet(aSet);
-
- // Default-Attribute holen (ohne markiertes Objekt)
-// SfxItemSet aDefaultSet = p3DView->Get3DAttributes();
+ mpScene->SetMergedItemSet(aSet);
// PageView
- SdrPageView* pPageView = p3DView->ShowSdrPage( pFmPage );
-// SdrPageView* pPageView = p3DView->ShowPage( pFmPage, Point() );
- p3DView->hideMarkHandles();
-
- // Szene markieren
- p3DView->MarkObj( pScene, pPageView );
+ SdrPageView* pPageView = mp3DView->ShowSdrPage( mpFmPage );
+ mp3DView->hideMarkHandles();
- // Initiale Groesse
- pScene->FitSnapRectToBoundVol();
-// Set3DAttributes(aDefaultSet);
+ // mark scene
+ mp3DView->MarkObj( mpScene, pPageView );
}
-/*************************************************************************
-|* Svx3DPreviewControl::Resize
-\************************************************************************/
void Svx3DPreviewControl::Resize()
{
- // Seite der Page
+ // size of page
Size aSize( GetSizePixel() );
aSize = PixelToLogic( aSize );
- pFmPage->SetSize( aSize );
+ mpFmPage->SetSize( aSize );
- // Groesse setzen
+ // set size
Size aObjSize( aSize.Width()*5/6, aSize.Height()*5/6 );
Point aObjPoint( (aSize.Width() - aObjSize.Width()) / 2,
(aSize.Height() - aObjSize.Height()) / 2);
Rectangle aRect( aObjPoint, aObjSize);
- pScene->SetSnapRect( aRect );
+ mpScene->SetSnapRect( aRect );
}
-/*************************************************************************
-|* Svx3DPreviewControl::Paint
-\************************************************************************/
-void Svx3DPreviewControl::Paint( const Rectangle& rRect )
+void Svx3DPreviewControl::Paint(const Rectangle& rRect)
{
- p3DView->CompleteRedraw( this, Region( rRect ) );
+ mp3DView->CompleteRedraw(this, Region(rRect));
}
-/*************************************************************************
-|* Svx3DPreviewControl::MouseButtonDown
-\************************************************************************/
-void Svx3DPreviewControl::MouseButtonDown( const MouseEvent& rMEvt )
+void Svx3DPreviewControl::MouseButtonDown(const MouseEvent& rMEvt)
{
- Control::MouseButtonDown( rMEvt );
+ Control::MouseButtonDown(rMEvt);
+
if( rMEvt.IsShift() && rMEvt.IsMod1() )
{
- SetObjectType( (nObjectType+1) % 2 );
+ if(PREVIEW_OBJECTTYPE_SPHERE == GetObjectType())
+ {
+ SetObjectType(PREVIEW_OBJECTTYPE_CUBE);
+ }
+ else
+ {
+ SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
+ }
}
}
-/*************************************************************************
-|* Svx3DPreviewControl::SetObjectType
-\************************************************************************/
-void Svx3DPreviewControl::SetObjectType( UINT16 nType )
+void Svx3DPreviewControl::SetObjectType(sal_uInt16 nType)
{
- if( nObjectType != nType || !p3DObj)
+ if( mnObjectType != nType || !mp3DObj)
{
- SfxItemSet aSet(
- pModel->GetItemPool(),
- SDRATTR_START, SDRATTR_END,
- 0, 0);
-
- nObjectType = nType;
+ SfxItemSet aSet(mpModel->GetItemPool(), SDRATTR_START, SDRATTR_END, 0, 0);
+ mnObjectType = nType;
- if( p3DObj )
+ if( mp3DObj )
{
-//-/ p3DObj->TakeAttributes( aSet, FALSE, FALSE );
- aSet.Put(p3DObj->GetMergedItemSet());
-
- pScene->Remove3DObj( p3DObj );
- delete p3DObj;
- p3DObj = NULL;
+ aSet.Put(mp3DObj->GetMergedItemSet());
+ mpScene->Remove3DObj( mp3DObj );
+ delete mp3DObj;
+ mp3DObj = NULL;
}
switch( nType )
{
case PREVIEW_OBJECTTYPE_SPHERE:
{
- // Kugel erzeugen
- p3DObj = new E3dSphereObj(
- p3DView->Get3DDefaultAttributes(),
+ mp3DObj = new E3dSphereObj(
+ mp3DView->Get3DDefaultAttributes(),
basegfx::B3DPoint( 0, 0, 0 ),
basegfx::B3DVector( 5000, 5000, 5000 ));
}
@@ -256,702 +226,356 @@ void Svx3DPreviewControl::SetObjectType( UINT16 nType )
case PREVIEW_OBJECTTYPE_CUBE:
{
- // Wuerfel erzeugen
- p3DObj = new E3dCubeObj(
- p3DView->Get3DDefaultAttributes(),
+ mp3DObj = new E3dCubeObj(
+ mp3DView->Get3DDefaultAttributes(),
basegfx::B3DPoint( -2500, -2500, -2500 ),
basegfx::B3DVector( 5000, 5000, 5000 ));
}
break;
}
- // Rein in die Szene
- pScene->Insert3DObj( p3DObj );
-
-//-/ p3DObj->NbcSetAttributes( aSet, FALSE );
- p3DObj->SetMergedItemSet(aSet);
+ mpScene->Insert3DObj( mp3DObj );
+ mp3DObj->SetMergedItemSet(aSet);
- // Refresh
Resize();
}
}
-/*************************************************************************
-|* Svx3DPreviewControl::Get3DAttributes
-\************************************************************************/
SfxItemSet Svx3DPreviewControl::Get3DAttributes() const
{
- return( p3DView->Get3DAttributes( pScene ) );
+ return mp3DObj->GetMergedItemSet();
}
-/*************************************************************************
-|* Svx3DPreviewControl::Set3DAttributes
-\************************************************************************/
+
void Svx3DPreviewControl::Set3DAttributes( const SfxItemSet& rAttr )
{
- p3DView->Set3DAttributes( rAttr, pScene, TRUE );
+ mp3DObj->SetMergedItemSet(rAttr, true);
Resize();
}
-/*************************************************************************
-|* Svx3DPreviewControl::SetObjectType
-\************************************************************************/
-void Svx3DPreviewControl::Set3DObject( const E3dObject* pObj )
-{
- if( pObj->ISA( E3dCompoundObject ) )
- {
- pScene->Remove3DObj( p3DObj );
- delete p3DObj;
- p3DObj = (E3dCompoundObject*)pObj->Clone();
- pScene->Insert3DObj( p3DObj );
- Resize();
- }
- else if( pObj->ISA( E3dPolyScene ) )
- {
- SdrObject* pObject = pFmPage->RemoveObject( pScene->GetOrdNum() );
- SdrObject::Free( pObject );
- p3DObj = NULL;
- pScene = (E3dPolyScene*)pObj->Clone();
- pFmPage->InsertObject( pScene );
- Resize();
- }
-}
-
-/*************************************************************************
-|*
-|* 3D Preview Control
-|*
-\************************************************************************/
-
-SvxPreviewCtl3D::SvxPreviewCtl3D( Window* pParent, const ResId& rResId)
-: Control( pParent, rResId )
-{
- // Members initialisieren
- Init();
-}
-
-SvxPreviewCtl3D::SvxPreviewCtl3D( Window* pParent, WinBits nStyle)
-: Control( pParent, nStyle)
-{
- // Members initialisieren
- Init();
-}
-
-void SvxPreviewCtl3D::Init()
-{
- // Members mit Defaults fuellen
- bGeometryCube=FALSE;
- fRotateX=-20.0;
- fRotateY=45.0;
- fRotateZ=0.0;
- fDistance=10.0;
- fDeviceSize=1.5;
-
- // MapMode waehlen
- SetMapMode( MAP_100TH_MM );
-
- // Hintergrund in einem schoenen neutralen Grau
-// SetBackground( Wallpaper( Color( COL_GRAY ) ) );
-
- // Segmente
- nHorSegs = 24;
- nVerSegs = 12;
-
- // Normalenmodus
- nNormalMode = PREVIEW_NORMAL_MODE_OBJECT;
-
- // ShadeMode
- nShadeMode = PREVIEW_SHADEMODE_GOURAUD;
-
- // Geometrie erzeugen
- CreateGeometry();
-
- // Material initialisieren
- Color aColWhite(COL_WHITE);
- Color aColBlack(COL_BLACK);
-
- aObjectMaterial.SetMaterial(aColWhite, Base3DMaterialAmbient);
- aObjectMaterial.SetMaterial(aColWhite, Base3DMaterialDiffuse);
- aObjectMaterial.SetMaterial(aColWhite, Base3DMaterialSpecular);
- aObjectMaterial.SetMaterial(aColBlack, Base3DMaterialEmission);
- aObjectMaterial.SetShininess(32);
-}
-
-SvxPreviewCtl3D::~SvxPreviewCtl3D()
-{
-}
-
-void SvxPreviewCtl3D::Paint( const Rectangle& )
-{
- // Base3D anfordern
- Base3D* pBase3D = Base3D::Create(this, nShadeMode == PREVIEW_SHADEMODE_DRAFT);
-
- Rectangle aVisible(Point(0,0), GetOutputSizePixel());
- aVisible = PixelToLogic(aVisible);
-
- // Orientierung
- basegfx::B3DHomMatrix mOrient;
- aCameraSet.SetObjectTrans(mOrient);
- aCameraSet.SetOrientation(
- basegfx::B3DPoint(0.0, 0.0, fDistance),
- basegfx::B3DVector(0.0, 0.0, 1.0),
- basegfx::B3DVector(0.0, 1.0, 0.0));
-// aCameraSet.SetOrientation(mOrient);
-
- // Matritzen setzen
- pBase3D->SetTransformationSet(&aCameraSet);
-
- // Licht setzen
- pBase3D->SetLightGroup(&aLights);
-
- // ShadeMode setzen
- if(nShadeMode == PREVIEW_SHADEMODE_FLAT || nShadeMode == PREVIEW_SHADEMODE_DRAFT)
- pBase3D->SetShadeModel(Base3DFlat);
- else if(nShadeMode == PREVIEW_SHADEMODE_GOURAUD)
- pBase3D->SetShadeModel(Base3DSmooth);
- else
- pBase3D->SetShadeModel(Base3DPhong);
-
- // Ausgaberechteck setzen
- aCameraSet.SetDeviceRectangle(-fDeviceSize, fDeviceSize, -fDeviceSize, fDeviceSize, FALSE);
- aCameraSet.SetFrontClippingPlane(fDistance - fDeviceSize);
- aCameraSet.SetBackClippingPlane(fDistance + fDeviceSize);
- aCameraSet.SetViewportRectangle(aVisible);
-
- // Matritzen setzen
- pBase3D->SetTransformationSet(&aCameraSet);
-
- // Werte fuer Objekt setzen
- pBase3D->SetActiveTexture();
- pBase3D->SetMaterial(aObjectMaterial.GetMaterial(Base3DMaterialAmbient), Base3DMaterialAmbient);
- pBase3D->SetMaterial(aObjectMaterial.GetMaterial(Base3DMaterialDiffuse), Base3DMaterialDiffuse);
- pBase3D->SetMaterial(aObjectMaterial.GetMaterial(Base3DMaterialSpecular), Base3DMaterialSpecular);
- pBase3D->SetMaterial(aObjectMaterial.GetMaterial(Base3DMaterialEmission), Base3DMaterialEmission);
- pBase3D->SetShininess(aObjectMaterial.GetShininess());
-
- pBase3D->SetRenderMode(Base3DRenderFill);
- pBase3D->SetCullMode(Base3DCullBack);
-
- // ScissorRegion defaultmaessig disablen
- pBase3D->ActivateScissorRegion(FALSE);
-
- // Nicht flach
- pBase3D->SetForceFlat(FALSE);
-
- // Geometrie ausgeben
- DrawGeometryClip(pBase3D);
-}
-
-void SvxPreviewCtl3D::DrawGeometryClip(Base3D *pBase3D)
+//////////////////////////////////////////////////////////////////////////////
+
+#define RADIUS_LAMP_PREVIEW_SIZE (4500.0)
+#define RADIUS_LAMP_SMALL (600.0)
+#define RADIUS_LAMP_BIG (1000.0)
+#define NO_LIGHT_SELECTED (0xffffffff)
+#define MAX_NUMBER_LIGHTS (8)
+
+Svx3DLightControl::Svx3DLightControl(Window* pParent, const ResId& rResId)
+: Svx3DPreviewControl(pParent, rResId),
+ maUserInteractiveChangeCallback(),
+ maUserSelectionChangeCallback(),
+ maChangeCallback(),
+ maSelectionChangeCallback(),
+ maSelectedLight(NO_LIGHT_SELECTED),
+ mpExpansionObject(0),
+ mpLampBottomObject(0),
+ mpLampShaftObject(0),
+ maLightObjects(MAX_NUMBER_LIGHTS, (E3dObject*)0),
+ mfRotateX(-20.0),
+ mfRotateY(45.0),
+ mfRotateZ(0.0),
+ maActionStartPoint(),
+ mnInteractionStartDistance(5 * 5 * 2),
+ mfSaveActionStartHor(0.0),
+ mfSaveActionStartVer(0.0),
+ mfSaveActionStartRotZ(0.0),
+ mbMouseMoved(false),
+ mbGeometrySelected(false)
+{
+ Construct2();
+}
+
+Svx3DLightControl::Svx3DLightControl(Window* pParent, WinBits nStyle)
+: Svx3DPreviewControl(pParent, nStyle),
+ maUserInteractiveChangeCallback(),
+ maUserSelectionChangeCallback(),
+ maChangeCallback(),
+ maSelectionChangeCallback(),
+ maSelectedLight(NO_LIGHT_SELECTED),
+ mpExpansionObject(0),
+ mpLampBottomObject(0),
+ mpLampShaftObject(0),
+ maLightObjects(MAX_NUMBER_LIGHTS, (E3dObject*)0),
+ mfRotateX(-20.0),
+ mfRotateY(45.0),
+ mfRotateZ(0.0),
+ maActionStartPoint(),
+ mnInteractionStartDistance(5 * 5 * 2),
+ mfSaveActionStartHor(0.0),
+ mfSaveActionStartVer(0.0),
+ mfSaveActionStartRotZ(0.0),
+ mbMouseMoved(false),
+ mbGeometrySelected(false)
+{
+ Construct2();
+}
+
+Svx3DLightControl::~Svx3DLightControl()
+{
+ // SdrObjects like mpExpansionObject and mpLampBottomObject/mpLampShaftObject get deleted
+ // with deletion of the DrawingLayer and model
+}
+
+void Svx3DLightControl::Construct2()
{
- // spezielles Clipping fuer OpenGL, um keine floating windows ueberzumalen
- if(pBase3D->GetBase3DType() == BASE3D_TYPE_OPENGL
- && GetOutDevType() == OUTDEV_WINDOW
- && pBase3D->GetTransformationSet())
{
- Window* pWin = (Window*)this;
- Region aClipRegion = pWin->GetActiveClipRegion();
-
- // ClipRegion ist gesetzt, benutze diese
- RegionHandle aRegionHandle = aClipRegion.BeginEnumRects();
- Rectangle aClipRect;
-
- while(aClipRegion.GetEnumRects(aRegionHandle, aClipRect))
- {
- if(aClipRect.IsOver(pBase3D->GetTransformationSet()->GetLogicalViewportBounds()))
- {
- // Viewport setzen
- pBase3D->SetScissorRegion(aClipRect, TRUE);
-
- // Zeichne alle Objekte
- pBase3D->StartScene();
- DrawGeometry(pBase3D);
- pBase3D->EndScene();
- }
- }
- aClipRegion.EndEnumRects(aRegionHandle);
+ // hide all page stuff, use control background (normally gray)
+ const Color aDialogColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
+ mp3DView->SetPageVisible(false);
+ mp3DView->SetApplicationBackgroundColor(aDialogColor);
+ mp3DView->SetApplicationDocumentColor(aDialogColor);
}
- else
- {
- // Zeichne alle Objekte
- pBase3D->StartScene();
- DrawGeometry(pBase3D);
- pBase3D->EndScene();
- }
-}
-
-void SvxPreviewCtl3D::DrawGeometry(Base3D *pBase3D)
-{
- pBase3D->DrawPolygonGeometry(aGeometry);
-}
-void SvxPreviewCtl3D::SetGeometry(BOOL bGeomCube)
-{
- if(bGeometryCube != bGeomCube)
{
- bGeometryCube = bGeomCube;
- CreateGeometry();
+ // create invisible expansion object
+ const double fMaxExpansion(RADIUS_LAMP_BIG + RADIUS_LAMP_PREVIEW_SIZE);
+ mpExpansionObject = new E3dCubeObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPoint(-fMaxExpansion, -fMaxExpansion, -fMaxExpansion),
+ basegfx::B3DVector(2.0 * fMaxExpansion, 2.0 * fMaxExpansion, 2.0 * fMaxExpansion));
+ mpScene->Insert3DObj( mpExpansionObject );
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+ mpExpansionObject->SetMergedItemSet(aSet);
}
- Invalidate();
-}
-void SvxPreviewCtl3D::SetRotation(double fRotX, double fRotY, double fRotZ)
-{
- if(fRotX != fRotateX || fRotY != fRotateY || fRotZ != fRotateZ)
{
- fRotateX = fRotX;
- fRotateY = fRotY;
- fRotateZ = fRotZ;
- CreateGeometry();
+ // create lamp control object (Yellow lined object)
+ // base circle
+ const basegfx::B2DPolygon a2DCircle(basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0.0, 0.0), RADIUS_LAMP_PREVIEW_SIZE));
+ basegfx::B3DPolygon a3DCircle(basegfx::tools::createB3DPolygonFromB2DPolygon(a2DCircle));
+ basegfx::B3DHomMatrix aTransform;
+
+ aTransform.rotate(F_PI2, 0.0, 0.0);
+ aTransform.translate(0.0, -RADIUS_LAMP_PREVIEW_SIZE, 0.0);
+ a3DCircle.transform(aTransform);
+
+ // create object for it
+ mpLampBottomObject = new E3dPolygonObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPolyPolygon(a3DCircle),
+ true);
+ mpScene->Insert3DObj( mpLampBottomObject );
+
+ // half circle with stand
+ basegfx::B2DPolygon a2DHalfCircle;
+ a2DHalfCircle.append(basegfx::B2DPoint(RADIUS_LAMP_PREVIEW_SIZE, 0.0));
+ a2DHalfCircle.append(basegfx::B2DPoint(RADIUS_LAMP_PREVIEW_SIZE, -RADIUS_LAMP_PREVIEW_SIZE));
+ a2DHalfCircle.append(basegfx::tools::createPolygonFromEllipseSegment(
+ basegfx::B2DPoint(0.0, 0.0), RADIUS_LAMP_PREVIEW_SIZE, RADIUS_LAMP_PREVIEW_SIZE, F_2PI - F_PI2, F_PI2));
+ basegfx::B3DPolygon a3DHalfCircle(basegfx::tools::createB3DPolygonFromB2DPolygon(a2DHalfCircle));
+
+ // create object for it
+ mpLampShaftObject = new E3dPolygonObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPolyPolygon(a3DHalfCircle),
+ true);
+ mpScene->Insert3DObj( mpLampShaftObject );
+
+ // initially invisible
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+
+ mpLampBottomObject->SetMergedItemSet(aSet);
+ mpLampShaftObject->SetMergedItemSet(aSet);
}
- Invalidate();
-}
-void SvxPreviewCtl3D::GetRotation(double& rRotX, double& rRotY, double& rRotZ)
-{
- rRotX = fRotateX;
- rRotY = fRotateY;
- rRotZ = fRotateZ;
-}
-
-// Zugriffsfunktionen Materialien
-void SvxPreviewCtl3D::SetMaterial(Color rNew, Base3DMaterialValue eVal)
-{
- if(aObjectMaterial.GetMaterial(eVal) != rNew)
{
- aObjectMaterial.SetMaterial(rNew, eVal);
- Invalidate();
- }
-}
-
-Color SvxPreviewCtl3D::GetMaterial(Base3DMaterialValue eVal)
-{
- return aObjectMaterial.GetMaterial(eVal);
-}
-
-void SvxPreviewCtl3D::SetShininess(UINT16 nNew)
-{
- if(aObjectMaterial.GetShininess() != nNew)
- {
- aObjectMaterial.SetShininess(nNew);
- Invalidate();
+ // change camera settings
+ Camera3D& rCamera = (Camera3D&) mpScene->GetCamera();
+ const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
+ double fW = rVolume.getWidth();
+ double fH = rVolume.getHeight();
+ double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
+
+ rCamera.SetAutoAdjustProjection(FALSE);
+ rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
+ basegfx::B3DPoint aLookAt;
+ double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
+ basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
+ rCamera.SetPosAndLookAt(aCamPos, aLookAt);
+ double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
+ rCamera.SetFocalLength(fDefaultCamFocal);
+ rCamera.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt, fDefaultCamFocal);
+
+ mpScene->SetCamera( rCamera );
+
+ basegfx::B3DHomMatrix aNeutral;
+ mpScene->SetTransform(aNeutral);
}
-}
-UINT16 SvxPreviewCtl3D::GetShininess()
-{
- return aObjectMaterial.GetShininess();
+ // invalidate SnapRects of objects
+ mpScene->SetRectsDirty();
}
-// Lichtquellen setzen
-void SvxPreviewCtl3D::SetLightGroup(B3dLightGroup* pNew)
+void Svx3DLightControl::ConstructLightObjects()
{
- if(pNew)
+ for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
{
- aLights = *pNew;
- Invalidate();
- }
-}
-
-// View-Einstellungen
-void SvxPreviewCtl3D::SetUserDistance(double fNew)
-{
- if(fNew != fDistance)
- {
- fDistance = fNew;
- Invalidate();
- }
-}
-
-void SvxPreviewCtl3D::SetDeviceSize(double fNew)
-{
- if(fNew != fDeviceSize)
- {
- fDeviceSize = fNew;
- Invalidate();
- }
-}
-
-// Zugriffsfunktionen Segmentierung
-void SvxPreviewCtl3D::SetHorizontalSegments(UINT16 nNew)
-{
- if(nNew != nHorSegs)
- {
- nHorSegs = nNew;
- CreateGeometry();
- Invalidate();
- }
-}
-
-void SvxPreviewCtl3D::SetVerticalSegments(UINT16 nNew)
-{
- if(nNew != nVerSegs)
- {
- nVerSegs = nNew;
- CreateGeometry();
- Invalidate();
- }
-}
-
-void SvxPreviewCtl3D::SetSegments(UINT16 nNewHor, UINT16 nNewVer)
-{
- if(nNewHor != nHorSegs || nNewVer != nVerSegs)
- {
- nHorSegs = nNewHor;
- nVerSegs = nNewVer;
- CreateGeometry();
- Invalidate();
- }
-}
-
-// Zugriff Normalenmodus
-void SvxPreviewCtl3D::SetNormalMode(UINT16 nNew)
-{
- if(nNew != nNormalMode)
- {
- nNormalMode = nNew;
- CreateGeometry();
- Invalidate();
- }
-}
-
-// Zugriff auf ShadeMode
-void SvxPreviewCtl3D::SetShadeMode(UINT16 nNew)
-{
- if(nNew != nShadeMode)
- {
- nShadeMode = nNew;
- Invalidate();
- }
-}
-
-void SvxPreviewCtl3D::CreateGeometry()
-{
- // Wuerfel erzeugen fuer Objektgroesse
- basegfx::B3DRange aVolume;
- aVolume.expand(basegfx::B3DPoint(-1.0, -1.0, -1.0));
- aVolume.expand(basegfx::B3DPoint( 1.0, 1.0, 1.0));
-
- if(bGeometryCube)
- {
- // Wuerfel erzeugen
- aGeometry.CreateCube(aVolume);
- }
- else
- {
- // AHCTUNG: Das PreviewControl hat bis zu dieser Stelle KEINE
- // Begrenzung in der Anzahl der Hor/Ver Segmente. Diese wird hier nun
- // explizit eingeschraenkt.
- double fHSegs = (nHorSegs > 50) ? 50.0 : (double)nHorSegs;
- double fVSegs = (nVerSegs > 50) ? 50.0 : (double)nVerSegs;
-
- // Kugel erzeugen
- aGeometry.CreateSphere(aVolume, fHSegs, fVSegs);
- }
-
- if(nNormalMode != PREVIEW_NORMAL_MODE_OBJECT)
- {
- if(!(nNormalMode == PREVIEW_NORMAL_MODE_FLAT))
+ // get rid of evtl. existing light object
+ if(maLightObjects[a])
{
- aGeometry.CreateDefaultNormalsSphere();
+ mpScene->Remove3DObj(maLightObjects[a]);
+ delete maLightObjects[a];
+ maLightObjects[a] = 0;
}
- }
- // Gesetzte Rotation ausfuehren
- if(fRotateX != 0.0 || fRotateY != 0.0 || fRotateZ != 0.0)
- {
- basegfx::B3DHomMatrix aRotMat;
- if(fRotateY != 0.0)
- aRotMat.rotate(0.0, fRotateY * F_PI180, 0.0);
- if(fRotateX != 0.0)
- aRotMat.rotate(-fRotateX * F_PI180, 0.0, 0.0);
- if(fRotateZ != 0.0)
- aRotMat.rotate(0.0, 0.0, fRotateZ * F_PI180);
- aGeometry.Transform(aRotMat);
- }
-}
-
-/*************************************************************************
-|*
-|* 3D Light Control
-|*
-\************************************************************************/
-
-SvxLightPrevievCtl3D::SvxLightPrevievCtl3D( Window* pParent, const ResId& rResId)
-: SvxPreviewCtl3D(pParent, rResId)
-{
- // Members initialisieren
- Init();
-}
-
-SvxLightPrevievCtl3D::SvxLightPrevievCtl3D( Window* pParent, WinBits nStyle )
-: SvxPreviewCtl3D(pParent, nStyle)
-{
- // Members initialisieren
- Init();
-}
-
-void SvxLightPrevievCtl3D::Init()
-{
- // Do never mirror the preview window. This explicitly includes right
- // to left writing environments.
- EnableRTL (FALSE);
-
- // Lokale Parameter fuellen
- eSelectedLight = Base3DLightNone;
- fObjectRadius = 1.414;
- fDistanceToObject = 0.4;
- fScaleSizeSelected = 1.8;
- fLampSize = 0.1;
- nInteractionStartDistance = 5 * 5 * 2;
- bMouseMoved = FALSE;
- bGeometrySelected = FALSE;
-
- // Device groesser, da Lampen angezeigt werden
- SetDeviceSize(2.0);
-
- // Geometrie fuer Lampenobjekt erzeugen
- CreateLightGeometry();
-}
-
-SvxLightPrevievCtl3D::~SvxLightPrevievCtl3D()
-{
-}
-
-void SvxLightPrevievCtl3D::SelectLight(Base3DLightNumber eNew)
-{
- if(eNew != eSelectedLight)
- {
- eSelectedLight = eNew;
- bGeometrySelected = FALSE;
- Invalidate();
- }
-}
-
-void SvxLightPrevievCtl3D::SelectGeometry()
-{
- if(!bGeometrySelected)
- {
- bGeometrySelected = TRUE;
- eSelectedLight = Base3DLightNone;
- Invalidate();
- }
-}
-
-void SvxLightPrevievCtl3D::SetObjectRadius(double fNew)
-{
- if(fObjectRadius != fNew)
- {
- fObjectRadius = fNew;
- Invalidate();
- }
-}
-
-void SvxLightPrevievCtl3D::SetDistanceToObject(double fNew)
-{
- if(fDistanceToObject != fNew)
- {
- fDistanceToObject = fNew;
- Invalidate();
+ if(GetLightOnOff(a))
+ {
+ const bool bIsSelectedLight(a == maSelectedLight);
+ basegfx::B3DVector aDirection(GetLightDirection(a));
+ aDirection.normalize();
+ aDirection *= RADIUS_LAMP_PREVIEW_SIZE;
+
+ const double fLampSize(bIsSelectedLight ? RADIUS_LAMP_BIG : RADIUS_LAMP_SMALL);
+ E3dObject* pNewLight = new E3dSphereObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPoint( 0, 0, 0 ),
+ basegfx::B3DVector( fLampSize, fLampSize, fLampSize));
+ mpScene->Insert3DObj(pNewLight);
+
+ basegfx::B3DHomMatrix aTransform;
+ aTransform.translate(aDirection.getX(), aDirection.getY(), aDirection.getZ());
+ pNewLight->SetTransform(aTransform);
+
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aSet.Put( XFillColorItem(String(), GetLightColor(a)));
+ pNewLight->SetMergedItemSet(aSet);
+
+ maLightObjects[a] = pNewLight;
+ }
}
}
-void SvxLightPrevievCtl3D::SetScaleSizeSelected(double fNew)
+void Svx3DLightControl::AdaptToSelectedLight()
{
- if(fScaleSizeSelected != fNew)
+ if(NO_LIGHT_SELECTED == maSelectedLight)
{
- fScaleSizeSelected = fNew;
- Invalidate();
+ // make mpLampBottomObject/mpLampShaftObject invisible
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+ mpLampBottomObject->SetMergedItemSet(aSet);
+ mpLampShaftObject->SetMergedItemSet(aSet);
}
-}
-
-void SvxLightPrevievCtl3D::SetLampSize(double fNew)
-{
- if(fLampSize != fNew)
+ else
{
- fLampSize = fNew;
- CreateLightGeometry();
- Invalidate();
- }
-}
+ basegfx::B3DVector aDirection(GetLightDirection(maSelectedLight));
+ aDirection.normalize();
-void SvxLightPrevievCtl3D::DrawGeometry(Base3D *pBase3D)
-{
- // call parent; zeichnet das Objekt selbst
- SvxPreviewCtl3D::DrawGeometry(pBase3D);
+ // make mpLampBottomObject/mpLampShaftObject visible (yellow hairline)
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_SOLID ) );
+ aSet.Put( XLineColorItem(String(), COL_YELLOW));
+ aSet.Put( XLineWidthItem(0));
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+ mpLampBottomObject->SetMergedItemSet(aSet);
+ mpLampShaftObject->SetMergedItemSet(aSet);
- // Lichter zeichnen
- for(UINT16 a=0;a<BASE3D_MAX_NUMBER_LIGHTS;a++)
- {
- Base3DLightNumber eLightNum = (Base3DLightNumber)(Base3DLight0 + a);
- if(aLights.IsEnabled(eLightNum))
- DrawLightGeometry(eLightNum, pBase3D);
- }
-}
+ // adapt transformation of mpLampShaftObject
+ basegfx::B3DHomMatrix aTransform;
+ double fRotateY(0.0);
-void SvxLightPrevievCtl3D::DrawLightGeometry(Base3DLightNumber eLightNum,
- Base3D* pBase3D)
-{
- // Geometrie bereitstellen
- B3dGeometry aNew;
- basegfx::B3DHomMatrix aTrans;
- double fRadius = fObjectRadius + fDistanceToObject;
- Color aLineColor(COL_YELLOW);
- aNew = aLightGeometry;
-
- if(eLightNum == eSelectedLight)
- aTrans.scale(fScaleSizeSelected, fScaleSizeSelected, fScaleSizeSelected);
-
- basegfx::B3DVector aDirection(aLights.GetDirection(eLightNum));
- aDirection.normalize();
- aDirection *= fRadius;
- aTrans.translate(aDirection.getX(), aDirection.getY(), aDirection.getZ());
-
- aNew.Transform(aTrans);
-
- // Material setzen
- Color aZwi;
- aZwi = aLights.GetIntensity(Base3DMaterialDiffuse, eLightNum);
- pBase3D->SetMaterial(aZwi, Base3DMaterialAmbient);
-// pBase3D->SetMaterial(aZwi, Base3DMaterialDiffuse);
- pBase3D->SetMaterial(aZwi, Base3DMaterialEmission);
- aZwi = aLights.GetIntensity(Base3DMaterialSpecular, eLightNum);
- pBase3D->SetMaterial(aZwi, Base3DMaterialSpecular);
-
- // Lampe Zeichnen
- pBase3D->SetRenderMode(Base3DRenderLine);
- pBase3D->DrawPolygonGeometry(aNew);
-
- if(eLightNum == eSelectedLight)
- {
- // Beleuchtung aus und Linienfarbe setzen
- BOOL bLightingWasEnabled = aLights.IsLightingEnabled();
- aLights.EnableLighting(FALSE);
- pBase3D->SetLightGroup(&aLights);
- pBase3D->SetLineWidth();
-
- // Kreis am Boden zeichnen
- basegfx::B3DPoint aPoint(0.0, -fRadius, fRadius);
- pBase3D->StartPrimitive(Base3DLineLoop);
- pBase3D->SetColor(aLineColor);
-
- double fWink;
- for(fWink=-F_PI;fWink < F_PI; fWink += F_2PI/24.0)
+ if(!basegfx::fTools::equalZero(aDirection.getZ()) || !basegfx::fTools::equalZero(aDirection.getX()))
{
- aPoint.setZ(-cos(fWink) * fRadius);
- aPoint.setX(-sin(fWink) * fRadius);
- pBase3D->AddVertex(aPoint);
+ fRotateY = atan2(-aDirection.getZ(), aDirection.getX());
}
- pBase3D->EndPrimitive();
- // Kreisbogen zeichnen
- double fBodenWinkel = atan2(-aDirection.getX(), -aDirection.getZ());
- double fSinBoden = sin(fBodenWinkel) * fRadius;
- double fCosBoden = cos(fBodenWinkel) * fRadius;
- pBase3D->StartPrimitive(Base3DLineStrip);
- pBase3D->SetColor(aLineColor);
+ aTransform.rotate(0.0, fRotateY, 0.0);
+ mpLampShaftObject->SetTransform(aTransform);
+
+ // adapt transformation of selected light
+ E3dObject* pSelectedLight = maLightObjects[sal_Int32(maSelectedLight)];
- for(fWink=-F_PI2;fWink < F_PI2; fWink += F_PI/12.0)
+ if(pSelectedLight)
{
- aPoint.setX(cos(fWink) * -fSinBoden);
- aPoint.setY(sin(fWink) * fRadius);
- aPoint.setZ(cos(fWink) * -fCosBoden);
- pBase3D->AddVertex(aPoint);
+ aTransform.identity();
+ aTransform.translate(
+ aDirection.getX() * RADIUS_LAMP_PREVIEW_SIZE,
+ aDirection.getY() * RADIUS_LAMP_PREVIEW_SIZE,
+ aDirection.getZ() * RADIUS_LAMP_PREVIEW_SIZE);
+ pSelectedLight->SetTransform(aTransform);
}
- pBase3D->EndPrimitive();
-
- // Verbindung zeichnen
- pBase3D->StartPrimitive(Base3DLineStrip);
- pBase3D->SetColor(aLineColor);
- aPoint = basegfx::B3DPoint(0.0, -fRadius, 0.0);
- pBase3D->AddVertex(aPoint);
- aPoint.setX(-fSinBoden);
- aPoint.setZ(-fCosBoden);
- pBase3D->AddVertex(aPoint);
- aPoint.setY(0.0);
- pBase3D->AddVertex(aPoint);
- pBase3D->EndPrimitive();
-
- // Beleuchtung wieder eischalten
- aLights.EnableLighting(bLightingWasEnabled);
- pBase3D->SetLightGroup(&aLights);
}
}
-void SvxLightPrevievCtl3D::CreateLightGeometry()
+void Svx3DLightControl::TrySelection(Point aPosPixel)
{
- // Wuerfel erzeugen fuer Objektgroesse
- basegfx::B3DRange aVolume;
- aVolume.expand(basegfx::B3DPoint(-fLampSize, -fLampSize, -fLampSize));
- aVolume.expand(basegfx::B3DPoint( fLampSize, fLampSize, fLampSize));
+ if(mpScene)
+ {
+ const Point aPosLogic(PixelToLogic(aPosPixel));
+ const basegfx::B2DPoint aPoint(aPosLogic.X(), aPosLogic.Y());
+ std::vector< const E3dCompoundObject* > aResult;
+ getAllHit3DObjectsSortedFrontToBack(aPoint, *mpScene, aResult);
- // Kugel erzeugen
- aLightGeometry.CreateSphere(aVolume, 4.0, 3.0);
-}
+ if(aResult.size())
+ {
+ // take the frontmost one
+ const E3dCompoundObject* pResult = aResult[0];
-// Selektion gueltig? D.h.: Lampe ist Selektiert un auch EINGESCHALTET
-BOOL SvxLightPrevievCtl3D::IsSelectionValid()
-{
- if((eSelectedLight != Base3DLightNone)
- && (aLights.GetLightObject(eSelectedLight).IsEnabled()))
- {
- return TRUE;
- }
- return FALSE;
-}
+ if(pResult == mp3DObj)
+ {
+ if(!mbGeometrySelected)
+ {
+ mbGeometrySelected = true;
+ maSelectedLight = NO_LIGHT_SELECTED;
+ ConstructLightObjects();
+ AdaptToSelectedLight();
+ Invalidate();
+
+ if(maSelectionChangeCallback.IsSet())
+ {
+ maSelectionChangeCallback.Call(this);
+ }
+ }
+ }
+ else
+ {
+ sal_uInt32 aNewSelectedLight(NO_LIGHT_SELECTED);
-// Selektierte Lampe Position in Polarkoordinaten holen/setzen
-// dabei geht Hor:[0..360.0[ und Ver:[-90..90] Grad
-void SvxLightPrevievCtl3D::GetPosition(double& rHor, double& rVer)
-{
- if(IsSelectionValid())
- {
- basegfx::B3DVector aDirection(aLights.GetDirection(eSelectedLight));
- aDirection.normalize();
- rHor = atan2(-aDirection.getX(), -aDirection.getZ()) + F_PI; // 0..2PI
- rVer = atan2(aDirection.getY(), aDirection.getXZLength()); // -PI2..PI2
- rHor /= F_PI180; // 0..360.0
- rVer /= F_PI180; // -90.0..90.0
- }
- if(IsGeometrySelected())
- {
- rHor = fRotateY;
- rVer = fRotateX;
+ for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
+ {
+ if(maLightObjects[a] && maLightObjects[a] == pResult)
+ {
+ aNewSelectedLight = a;
+ }
+ }
+
+ if(aNewSelectedLight != maSelectedLight)
+ {
+ SelectLight(aNewSelectedLight);
+
+ if(maSelectionChangeCallback.IsSet())
+ {
+ maSelectionChangeCallback.Call(this);
+ }
+ }
+ }
+ }
}
}
-void SvxLightPrevievCtl3D::SetPosition(double fHor, double fVer)
+void Svx3DLightControl::Paint(const Rectangle& rRect)
{
- if(IsSelectionValid())
- {
- basegfx::B3DVector aDirection;
- fHor = (fHor * F_PI180) - F_PI; // -PI..PI
- fVer *= F_PI180; // -PI2..PI2
- aDirection.setX(cos(fVer) * -sin(fHor));
- aDirection.setY(sin(fVer));
- aDirection.setZ(cos(fVer) * -cos(fHor));
- aDirection.normalize();
- aLights.SetDirection(aDirection, eSelectedLight);
- Invalidate();
- }
- if(IsGeometrySelected())
- {
- SetRotation(fVer, fHor, fRotateZ);
- }
+ Svx3DPreviewControl::Paint(rRect);
}
-// Interaktion
-void SvxLightPrevievCtl3D::MouseButtonDown( const MouseEvent& rMEvt )
+void Svx3DLightControl::MouseButtonDown( const MouseEvent& rMEvt )
{
- BOOL bCallParent = TRUE;
+ bool bCallParent(true);
- // Status switchen
+ // switch state
if(rMEvt.IsLeft())
{
- if(IsSelectionValid() || bGeometrySelected)
+ if(IsSelectionValid() || mbGeometrySelected)
{
- bMouseMoved = FALSE;
- bCallParent = FALSE;
- aActionStartPoint = rMEvt.GetPosPixel();
+ mbMouseMoved = false;
+ bCallParent = false;
+ maActionStartPoint = rMEvt.GetPosPixel();
StartTracking();
}
else
@@ -959,48 +583,54 @@ void SvxLightPrevievCtl3D::MouseButtonDown( const MouseEvent& rMEvt )
// Einfacher Click ohne viel Bewegen, versuche eine
// Selektion
TrySelection(rMEvt.GetPosPixel());
- bCallParent = FALSE;
+ bCallParent = false;
}
}
// call parent
if(bCallParent)
- SvxPreviewCtl3D::MouseButtonDown(rMEvt);
+ {
+ Svx3DPreviewControl::MouseButtonDown(rMEvt);
+ }
}
-void SvxLightPrevievCtl3D::Tracking( const TrackingEvent& rTEvt )
+void Svx3DLightControl::Tracking( const TrackingEvent& rTEvt )
{
if(rTEvt.IsTrackingEnded())
{
if(rTEvt.IsTrackingCanceled())
{
- if(bMouseMoved)
+ if(mbMouseMoved)
{
- // Interaktion abbrechen
- bMouseMoved = FALSE;
- if(bGeometrySelected)
+ // interrupt tracking
+ mbMouseMoved = false;
+
+ if(mbGeometrySelected)
{
- SetRotation(fSaveActionStartVer, fSaveActionStartHor, fSaveActionStartRotZ);
+ SetRotation(mfSaveActionStartVer, mfSaveActionStartHor, mfSaveActionStartRotZ);
}
else
{
- SetPosition(fSaveActionStartHor, fSaveActionStartVer);
+ SetPosition(mfSaveActionStartHor, mfSaveActionStartVer);
+ }
+
+ if(maChangeCallback.IsSet())
+ {
+ maChangeCallback.Call(this);
}
- if(aChangeCallback.IsSet())
- aChangeCallback.Call(this);
}
}
else
{
const MouseEvent& rMEvt = rTEvt.GetMouseEvent();
- if(bMouseMoved)
+
+ if(mbMouseMoved)
{
- // Wurde interaktiv veraendert
+ // was change dinteractively
}
else
{
- // Einfacher Click ohne viel Bewegen, versuche eine
- // Selektion
+ // simple click without much movement, try selection
TrySelection(rMEvt.GetPosPixel());
}
}
@@ -1008,208 +638,402 @@ void SvxLightPrevievCtl3D::Tracking( const TrackingEvent& rTEvt )
else
{
const MouseEvent& rMEvt = rTEvt.GetMouseEvent();
- Point aDeltaPos = rMEvt.GetPosPixel() - aActionStartPoint;
+ Point aDeltaPos = rMEvt.GetPosPixel() - maActionStartPoint;
- if(!bMouseMoved)
+ if(!mbMouseMoved)
{
- if(INT32(aDeltaPos.X() * aDeltaPos.X() + aDeltaPos.Y() * aDeltaPos.Y())
- > nInteractionStartDistance)
+ if(sal_Int32(aDeltaPos.X() * aDeltaPos.X() + aDeltaPos.Y() * aDeltaPos.Y()) > mnInteractionStartDistance)
{
- if(bGeometrySelected)
+ if(mbGeometrySelected)
{
- GetRotation(fSaveActionStartVer, fSaveActionStartHor, fSaveActionStartRotZ);
+ GetRotation(mfSaveActionStartVer, mfSaveActionStartHor, mfSaveActionStartRotZ);
}
else
{
- // Start der Interaktion, Werte Sichern
- GetPosition(fSaveActionStartHor, fSaveActionStartVer);
+ // intercation start, save values
+ GetPosition(mfSaveActionStartHor, mfSaveActionStartVer);
}
- bMouseMoved = TRUE;
+
+ mbMouseMoved = true;
}
}
- if(bMouseMoved)
+ if(mbMouseMoved)
{
- if(bGeometrySelected)
+ if(mbGeometrySelected)
{
- double fNewRotX = fSaveActionStartVer - ((double)aDeltaPos.Y());
- double fNewRotY = fSaveActionStartHor + ((double)aDeltaPos.X());
+ double fNewRotX = mfSaveActionStartVer - ((double)aDeltaPos.Y() * F_PI180);
+ double fNewRotY = mfSaveActionStartHor + ((double)aDeltaPos.X() * F_PI180);
- // Horizontal abgleichen
+ // cut horizontal
while(fNewRotY < 0.0)
- fNewRotY += 360.0;
- while(fNewRotY >= 360.0)
- fNewRotY -= 360.0;
+ {
+ fNewRotY += F_2PI;
+ }
+
+ while(fNewRotY >= F_2PI)
+ {
+ fNewRotY -= F_2PI;
+ }
- // Vertikal cutten
- if(fNewRotX < -90.0)
- fNewRotX = -90.0;
- if(fNewRotX > 90.0)
- fNewRotX = 90.0;
+ // cut vertical
+ if(fNewRotX < -F_PI2)
+ {
+ fNewRotX = -F_PI2;
+ }
+
+ if(fNewRotX > F_PI2)
+ {
+ fNewRotX = F_PI2;
+ }
- SetRotation(fNewRotX, fNewRotY, fSaveActionStartRotZ);
+ SetRotation(fNewRotX, fNewRotY, mfSaveActionStartRotZ);
- if(aChangeCallback.IsSet())
- aChangeCallback.Call(this);
+ if(maChangeCallback.IsSet())
+ {
+ maChangeCallback.Call(this);
+ }
}
else
{
- // Interaktion im vollen Gange
- double fNewPosHor = fSaveActionStartHor + ((double)aDeltaPos.X());
- double fNewPosVer = fSaveActionStartVer - ((double)aDeltaPos.Y());
+ // interaction in progress
+ double fNewPosHor = mfSaveActionStartHor + ((double)aDeltaPos.X());
+ double fNewPosVer = mfSaveActionStartVer - ((double)aDeltaPos.Y());
- // Horizontal abgleichen
+ // cut horizontal
while(fNewPosHor < 0.0)
+ {
fNewPosHor += 360.0;
+ }
+
while(fNewPosHor >= 360.0)
+ {
fNewPosHor -= 360.0;
+ }
- // Vertikal cutten
+ // cut vertical
if(fNewPosVer < -90.0)
+ {
fNewPosVer = -90.0;
+ }
+
if(fNewPosVer > 90.0)
+ {
fNewPosVer = 90.0;
+ }
SetPosition(fNewPosHor, fNewPosVer);
- if(aChangeCallback.IsSet())
- aChangeCallback.Call(this);
+ if(maChangeCallback.IsSet())
+ {
+ maChangeCallback.Call(this);
+ }
}
}
}
}
-// Selektion einer Lampe
-void SvxLightPrevievCtl3D::TrySelection(Point aPosPixel)
+void Svx3DLightControl::Resize()
+{
+ // set size of page
+ const Size aSize(PixelToLogic(GetSizePixel()));
+ mpFmPage->SetSize(aSize);
+
+ // set position and size of scene
+ mpScene->SetSnapRect(Rectangle(Point(0, 0), aSize));
+}
+
+void Svx3DLightControl::SetObjectType(sal_uInt16 nType)
+{
+ // call parent
+ Svx3DPreviewControl::SetObjectType(nType);
+
+ // apply object rotation
+ if(mp3DObj)
+ {
+ basegfx::B3DHomMatrix aObjectRotation;
+ aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
+ mp3DObj->SetTransform(aObjectRotation);
+ }
+}
+
+bool Svx3DLightControl::IsSelectionValid()
{
- BOOL bNewSelection(FALSE);
- Base3DLightNumber eNew = Base3DLightNone;
+ if((NO_LIGHT_SELECTED != maSelectedLight) && (GetLightOnOff(maSelectedLight)))
+ {
+ return true;
+ }
- for(UINT16 a=0;a<BASE3D_MAX_NUMBER_LIGHTS;a++)
+ return false;
+}
+
+void Svx3DLightControl::GetPosition(double& rHor, double& rVer)
+{
+ if(IsSelectionValid())
{
- Base3DLightNumber eActualLight = (Base3DLightNumber)(Base3DLight0 + a);
- if(aLights.IsEnabled(eActualLight))
+ basegfx::B3DVector aDirection(GetLightDirection(maSelectedLight));
+ aDirection.normalize();
+ rHor = atan2(-aDirection.getX(), -aDirection.getZ()) + F_PI; // 0..2PI
+ rVer = atan2(aDirection.getY(), aDirection.getXZLength()); // -PI2..PI2
+ rHor /= F_PI180; // 0..360.0
+ rVer /= F_PI180; // -90.0..90.0
+ }
+ if(IsGeometrySelected())
+ {
+ rHor = mfRotateY;
+ rVer = mfRotateX;
+ }
+}
+
+void Svx3DLightControl::SetPosition(double fHor, double fVer)
+{
+ if(IsSelectionValid())
+ {
+ // set selected light's direction
+ fHor = (fHor * F_PI180) - F_PI; // -PI..PI
+ fVer *= F_PI180; // -PI2..PI2
+ basegfx::B3DVector aDirection(cos(fVer) * -sin(fHor), sin(fVer), cos(fVer) * -cos(fHor));
+ aDirection.normalize();
+
+ if(!aDirection.equal(GetLightDirection(maSelectedLight)))
{
- basegfx::B3DVector aLightPos(aLights.GetDirection(eActualLight));
- aLightPos.normalize();
- aLightPos *= GetObjectRadius() + GetDistanceToObject();
- basegfx::B3DPoint aScreenPos(aCameraSet.ObjectToViewCoor(aLightPos));
- Point aScreenPosPixel((long)(aScreenPos.getX() + 0.5), (long)(aScreenPos.getY() + 0.5));
- aScreenPosPixel = LogicToPixel(aScreenPosPixel);
- aScreenPosPixel -= aPosPixel;
- INT32 nDistance = (aScreenPosPixel.getX() * aScreenPosPixel.getX()) + (aScreenPosPixel.getY() * aScreenPosPixel.getY());
-
- if(nDistance < nInteractionStartDistance)
+ // set changed light direction at SdrScene
+ SfxItemSet aSet(mpModel->GetItemPool());
+
+ switch(maSelectedLight)
+ {
+ case 0: aSet.Put(Svx3DLightDirection1Item(aDirection)); break;
+ case 1: aSet.Put(Svx3DLightDirection2Item(aDirection)); break;
+ case 2: aSet.Put(Svx3DLightDirection3Item(aDirection)); break;
+ case 3: aSet.Put(Svx3DLightDirection4Item(aDirection)); break;
+ case 4: aSet.Put(Svx3DLightDirection5Item(aDirection)); break;
+ case 5: aSet.Put(Svx3DLightDirection6Item(aDirection)); break;
+ case 6: aSet.Put(Svx3DLightDirection7Item(aDirection)); break;
+ default:
+ case 7: aSet.Put(Svx3DLightDirection8Item(aDirection)); break;
+ }
+
+ mpScene->SetMergedItemSet(aSet);
+
+ // correct 3D light's and LampFrame's geometries
+ AdaptToSelectedLight();
+ Invalidate();
+ }
+ }
+ if(IsGeometrySelected())
+ {
+ if(mfRotateX != fVer || mfRotateY != fHor)
+ {
+ mfRotateX = fVer;
+ mfRotateY = fHor;
+
+ if(mp3DObj)
{
- eNew = eActualLight;
- bNewSelection = TRUE;
+ basegfx::B3DHomMatrix aObjectRotation;
+ aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
+ mp3DObj->SetTransform(aObjectRotation);
+
+ Invalidate();
}
}
}
+}
- if(bNewSelection && eSelectedLight != eNew)
+void Svx3DLightControl::SetRotation(double fRotX, double fRotY, double fRotZ)
+{
+ if(IsGeometrySelected())
{
- // Auswaehlen
- SelectLight(eNew);
+ if(fRotX != mfRotateX || fRotY != mfRotateY || fRotZ != mfRotateZ)
+ {
+ mfRotateX = fRotX;
+ mfRotateY = fRotY;
+ mfRotateZ = fRotZ;
+
+ if(mp3DObj)
+ {
+ basegfx::B3DHomMatrix aObjectRotation;
+ aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
+ mp3DObj->SetTransform(aObjectRotation);
- // Falls tatsaechlich eine andere Lampe selektiert
- // wurde, rufe den entsprechenden Callback
- if(aSelectionChangeCallback.IsSet())
- aSelectionChangeCallback.Call(this);
+ Invalidate();
+ }
+ }
}
- else
+}
+
+void Svx3DLightControl::GetRotation(double& rRotX, double& rRotY, double& rRotZ)
+{
+ rRotX = mfRotateX;
+ rRotY = mfRotateY;
+ rRotZ = mfRotateZ;
+}
+
+void Svx3DLightControl::Set3DAttributes( const SfxItemSet& rAttr )
+{
+ // call parent
+ Svx3DPreviewControl::Set3DAttributes(rAttr);
+
+ if(maSelectedLight != NO_LIGHT_SELECTED && !GetLightOnOff(maSelectedLight))
{
- // Punkt in logische Koordinaten umrechnen
- Point aPosLogic = PixelToLogic(aPosPixel);
+ // selected light is no more active, select new one
+ maSelectedLight = NO_LIGHT_SELECTED;
+ }
- // Punkte generieren
- basegfx::B3DPoint aHitFront(aPosLogic.X(), aPosLogic.Y(), 0.0);
- basegfx::B3DPoint aHitBack(aPosLogic.X(), aPosLogic.Y(), ZBUFFER_DEPTH_RANGE);
+ // local updates
+ ConstructLightObjects();
+ AdaptToSelectedLight();
+ Invalidate();
+}
- // Umrechnen
- aHitFront = aCameraSet.ViewToObjectCoor(aHitFront);
- aHitBack = aCameraSet.ViewToObjectCoor(aHitBack);
+void Svx3DLightControl::SelectLight(sal_uInt32 nLightNumber)
+{
+ if(nLightNumber > 7)
+ {
+ nLightNumber = NO_LIGHT_SELECTED;
+ }
- // Eventuell die Geometrie des Beispielobjektes waehlen
- if(aGeometry.CheckHit(aHitFront, aHitBack, 0))
+ if(NO_LIGHT_SELECTED != nLightNumber)
+ {
+ if(!GetLightOnOff(nLightNumber))
{
- // Auswaehlen
- SelectGeometry();
+ nLightNumber = NO_LIGHT_SELECTED;
+ }
+ }
- // Falls tatsaechlich eine andere Lampe selektiert
- // wurde, rufe den entsprechenden Callback
- if(aSelectionChangeCallback.IsSet())
- aSelectionChangeCallback.Call(this);
+ if(nLightNumber != maSelectedLight)
+ {
+ maSelectedLight = nLightNumber;
+ mbGeometrySelected = false;
+ ConstructLightObjects();
+ AdaptToSelectedLight();
+ Invalidate();
+ }
+}
+
+bool Svx3DLightControl::GetLightOnOff(sal_uInt32 nNum) const
+{
+ if(nNum <= 7)
+ {
+ const SfxItemSet aLightItemSet(Get3DAttributes());
+
+ switch(nNum)
+ {
+ case 0 : return ((const Svx3DLightOnOff1Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue();
+ case 1 : return ((const Svx3DLightOnOff2Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue();
+ case 2 : return ((const Svx3DLightOnOff3Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue();
+ case 3 : return ((const Svx3DLightOnOff4Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue();
+ case 4 : return ((const Svx3DLightOnOff5Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue();
+ case 5 : return ((const Svx3DLightOnOff6Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue();
+ case 6 : return ((const Svx3DLightOnOff7Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue();
+ case 7 : return ((const Svx3DLightOnOff8Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue();
}
}
+
+ return false;
}
-/*************************************************************************
-|*
-|* 3D Light Control Konstruktor
-|*
-\************************************************************************/
+Color Svx3DLightControl::GetLightColor(sal_uInt32 nNum) const
+{
+ if(nNum <= 7)
+ {
+ const SfxItemSet aLightItemSet(Get3DAttributes());
+
+ switch(nNum)
+ {
+ case 0 : return ((const Svx3DLightcolor1Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue();
+ case 1 : return ((const Svx3DLightcolor2Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue();
+ case 2 : return ((const Svx3DLightcolor3Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue();
+ case 3 : return ((const Svx3DLightcolor4Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue();
+ case 4 : return ((const Svx3DLightcolor5Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue();
+ case 5 : return ((const Svx3DLightcolor6Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue();
+ case 6 : return ((const Svx3DLightcolor7Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue();
+ case 7 : return ((const Svx3DLightcolor8Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue();
+ }
+ }
+
+ return Color(COL_BLACK);
+}
+
+basegfx::B3DVector Svx3DLightControl::GetLightDirection(sal_uInt32 nNum) const
+{
+ if(nNum <= 7)
+ {
+ const SfxItemSet aLightItemSet(Get3DAttributes());
+
+ switch(nNum)
+ {
+ case 0 : return ((const Svx3DLightDirection1Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1)).GetValue();
+ case 1 : return ((const Svx3DLightDirection2Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2)).GetValue();
+ case 2 : return ((const Svx3DLightDirection3Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3)).GetValue();
+ case 3 : return ((const Svx3DLightDirection4Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4)).GetValue();
+ case 4 : return ((const Svx3DLightDirection5Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5)).GetValue();
+ case 5 : return ((const Svx3DLightDirection6Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6)).GetValue();
+ case 6 : return ((const Svx3DLightDirection7Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7)).GetValue();
+ case 7 : return ((const Svx3DLightDirection8Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8)).GetValue();
+ }
+ }
+
+ return basegfx::B3DVector();
+}
+
+//////////////////////////////////////////////////////////////////////////////
SvxLightCtl3D::SvxLightCtl3D( Window* pParent, const ResId& rResId)
: Control(pParent, rResId),
- aLightControl(this, 0),
- aHorScroller(this, WB_HORZ | WB_DRAG),
- aVerScroller(this, WB_VERT | WB_DRAG),
- aSwitcher(this, 0)
+ maLightControl(this, 0),
+ maHorScroller(this, WB_HORZ | WB_DRAG),
+ maVerScroller(this, WB_VERT | WB_DRAG),
+ maSwitcher(this, 0)
{
- // Members initialisieren
+ // init members
Init();
}
SvxLightCtl3D::SvxLightCtl3D( Window* pParent, WinBits nStyle )
: Control(pParent, nStyle),
- aLightControl(this, 0),
- aHorScroller(this, WB_HORZ | WB_DRAG),
- aVerScroller(this, WB_VERT | WB_DRAG),
- aSwitcher(this, 0)
+ maLightControl(this, 0),
+ maHorScroller(this, WB_HORZ | WB_DRAG),
+ maVerScroller(this, WB_VERT | WB_DRAG),
+ maSwitcher(this, 0)
{
- // Members initialisieren
+ // init members
Init();
}
void SvxLightCtl3D::Init()
{
// #i58240# set HelpIDs for scrollbars and switcher
- aHorScroller.SetHelpId(HID_CTRL3D_HSCROLL);
- aVerScroller.SetHelpId(HID_CTRL3D_VSCROLL);
- aSwitcher.SetHelpId(HID_CTRL3D_SWITCHER);
-
- // Lokale Parameter setzen
- bSphereUsed = TRUE;
- bVectorValid = FALSE;
+ maHorScroller.SetHelpId(HID_CTRL3D_HSCROLL);
+ maVerScroller.SetHelpId(HID_CTRL3D_VSCROLL);
+ maSwitcher.SetHelpId(HID_CTRL3D_SWITCHER);
// Light preview
- aLightControl.Show();
- aLightControl.SetChangeCallback( LINK(this, SvxLightCtl3D, InternalInteractiveChange) );
- aLightControl.SetSelectionChangeCallback( LINK(this, SvxLightCtl3D, InternalSelectionChange) );
+ maLightControl.Show();
+ maLightControl.SetChangeCallback( LINK(this, SvxLightCtl3D, InternalInteractiveChange) );
+ maLightControl.SetSelectionChangeCallback( LINK(this, SvxLightCtl3D, InternalSelectionChange) );
// Horiz Scrollbar
- aHorScroller.Show();
- aHorScroller.SetRange(Range(0, 36000));
- aHorScroller.SetLineSize(100);
- aHorScroller.SetPageSize(1000);
- aHorScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
+ maHorScroller.Show();
+ maHorScroller.SetRange(Range(0, 36000));
+ maHorScroller.SetLineSize(100);
+ maHorScroller.SetPageSize(1000);
+ maHorScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
// Vert Scrollbar
- aVerScroller.Show();
- aVerScroller.SetRange(Range(0, 18000));
- aVerScroller.SetLineSize(100);
- aVerScroller.SetPageSize(1000);
- aVerScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
+ maVerScroller.Show();
+ maVerScroller.SetRange(Range(0, 18000));
+ maVerScroller.SetLineSize(100);
+ maVerScroller.SetPageSize(1000);
+ maVerScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
// Switch Button
- aSwitcher.Show();
- aSwitcher.SetClickHdl( LINK(this, SvxLightCtl3D, ButtonPress) );
+ maSwitcher.Show();
+ maSwitcher.SetClickHdl( LINK(this, SvxLightCtl3D, ButtonPress) );
- // Selektion klaeren
+ // check selection
CheckSelection();
- // Neues Layout
+ // new layout
NewLayout();
}
@@ -1217,73 +1041,56 @@ SvxLightCtl3D::~SvxLightCtl3D()
{
}
-void SvxLightCtl3D::SetVector(const basegfx::B3DVector& rNew)
-{
- aVector = rNew;
- aVector.normalize();
- bVectorValid = TRUE;
-}
-
-const basegfx::B3DVector& SvxLightCtl3D::GetVector()
-{
- // Grobe Anbindung an altes Verhalten, um eine Reaktion zu haben
- aVector = aLightControl.GetLightGroup()->GetDirection(aLightControl.GetSelectedLight());
- aVector.normalize();
- return aVector;
-}
-
void SvxLightCtl3D::Resize()
{
// call parent
Control::Resize();
- // Neues Layout
+ // new layout
NewLayout();
}
void SvxLightCtl3D::NewLayout()
{
// Layout members
- Size aSize = GetOutputSizePixel();
- long nScrollSize = aHorScroller.GetSizePixel().Height();
+ const Size aSize(GetOutputSizePixel());
+ const sal_Int32 nScrollSize(maHorScroller.GetSizePixel().Height());
- // Preview Fenster
+ // Preview control
Point aPoint(0, 0);
Size aDestSize(aSize.Width() - nScrollSize, aSize.Height() - nScrollSize);
- aLightControl.SetPosSizePixel(aPoint, aDestSize);
+ maLightControl.SetPosSizePixel(aPoint, aDestSize);
- // Horizontaler Scrollbar
+ // hor scrollbar
aPoint.Y() = aSize.Height() - nScrollSize;
aDestSize.Height() = nScrollSize;
- aHorScroller.SetPosSizePixel(aPoint, aDestSize);
+ maHorScroller.SetPosSizePixel(aPoint, aDestSize);
- // Vertikaler Scrollbar
+ // vert scrollbar
aPoint.X() = aSize.Width() - nScrollSize;
aPoint.Y() = 0;
aDestSize.Width() = nScrollSize;
aDestSize.Height() = aSize.Height() - nScrollSize;
- aVerScroller.SetPosSizePixel(aPoint, aDestSize);
+ maVerScroller.SetPosSizePixel(aPoint, aDestSize);
- // Button
+ // button
aPoint.Y() = aSize.Height() - nScrollSize;
aDestSize.Height() = nScrollSize;
- aSwitcher.SetPosSizePixel(aPoint, aDestSize);
+ maSwitcher.SetPosSizePixel(aPoint, aDestSize);
}
-// Selektion auf Gueltigkeit pruefen
void SvxLightCtl3D::CheckSelection()
{
- BOOL bSelectionValid = (aLightControl.IsSelectionValid()
- || aLightControl.IsGeometrySelected());
- aHorScroller.Enable(bSelectionValid);
- aVerScroller.Enable(bSelectionValid);
+ const bool bSelectionValid(maLightControl.IsSelectionValid() || maLightControl.IsGeometrySelected());
+ maHorScroller.Enable(bSelectionValid);
+ maVerScroller.Enable(bSelectionValid);
if(bSelectionValid)
{
double fHor, fVer;
- aLightControl.GetPosition(fHor, fVer);
- aHorScroller.SetThumbPos( INT32(fHor * 100.0) );
- aVerScroller.SetThumbPos( 18000 - INT32((fVer + 90.0) * 100.0) );
+ maLightControl.GetPosition(fHor, fVer);
+ maHorScroller.SetThumbPos( INT32(fHor * 100.0) );
+ maVerScroller.SetThumbPos( 18000 - INT32((fVer + 90.0) * 100.0) );
}
}
@@ -1291,8 +1098,7 @@ void SvxLightCtl3D::move( double fDeltaHor, double fDeltaVer )
{
double fHor, fVer;
- aLightControl.GetPosition(fHor, fVer);
-
+ maLightControl.GetPosition(fHor, fVer);
fHor += fDeltaHor;
fVer += fDeltaVer;
@@ -1302,18 +1108,19 @@ void SvxLightCtl3D::move( double fDeltaHor, double fDeltaVer )
if ( fVer < -90.0 )
return;
- aLightControl.SetPosition(fHor, fVer);
- aHorScroller.SetThumbPos( INT32(fHor * 100.0) );
- aVerScroller.SetThumbPos( 18000 - INT32((fVer + 90.0) * 100.0) );
-
- if(aUserInteractiveChangeCallback.IsSet())
- aUserInteractiveChangeCallback.Call(this);
+ maLightControl.SetPosition(fHor, fVer);
+ maHorScroller.SetThumbPos( INT32(fHor * 100.0) );
+ maVerScroller.SetThumbPos( 18000 - INT32((fVer + 90.0) * 100.0) );
+ if(maUserInteractiveChangeCallback.IsSet())
+ {
+ maUserInteractiveChangeCallback.Call(this);
+ }
}
void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt )
{
- KeyCode aCode = rKEvt.GetKeyCode();
+ const KeyCode aCode(rKEvt.GetKeyCode());
if( aCode.GetModifier() )
{
@@ -1324,71 +1131,98 @@ void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt )
switch ( aCode.GetCode() )
{
case KEY_SPACE:
- ;
+ {
break;
+ }
case KEY_LEFT:
+ {
move( -4.0, 0.0 ); // #i58242# changed move direction in X
break;
+ }
case KEY_RIGHT:
+ {
move( 4.0, 0.0 ); // #i58242# changed move direction in X
break;
+ }
case KEY_UP:
+ {
move( 0.0, 4.0 );
break;
+ }
case KEY_DOWN:
+ {
move( 0.0, -4.0 );
break;
+ }
case KEY_PAGEUP:
- {
- B3dLightGroup* pLights = aLightControl.GetLightGroup();
- int eLight = aLightControl.GetSelectedLight() - 1;
+ {
+ sal_Int32 nLight(maLightControl.GetSelectedLight() - 1);
- while( (eLight >= Base3DLight0) && !pLights->IsEnabled((Base3DLightNumber)eLight) )
- eLight--;
+ while((nLight >= 0) && !maLightControl.GetLightOnOff(nLight))
+ {
+ nLight--;
+ }
- if( eLight < Base3DLight0 )
+ if(nLight < 0)
+ {
+ nLight = 7;
+
+ while((nLight >= 0) && !maLightControl.GetLightOnOff(nLight))
{
- eLight = Base3DLight7;
- while( (eLight >= Base3DLight0) && !pLights->IsEnabled((Base3DLightNumber)eLight) )
- eLight--;
+ nLight--;
}
+ }
+
+ if(nLight >= 0)
+ {
+ maLightControl.SelectLight(nLight);
+ CheckSelection();
- if( eLight >= Base3DLight0 )
+ if(maUserSelectionChangeCallback.IsSet())
{
- aLightControl.SelectLight((Base3DLightNumber)eLight);
- CheckSelection();
- if(aUserSelectionChangeCallback.IsSet())
- aUserSelectionChangeCallback.Call(this);
+ maUserSelectionChangeCallback.Call(this);
}
- break;
}
+
+ break;
+ }
case KEY_PAGEDOWN:
+ {
+ sal_Int32 nLight(maLightControl.GetSelectedLight() - 1);
+
+ while(nLight <= 7 && !maLightControl.GetLightOnOff(nLight))
{
- B3dLightGroup* pLights = aLightControl.GetLightGroup();
- int eLight = aLightControl.GetSelectedLight() + 1;
+ nLight++;
+ }
- while( (eLight < Base3DLightNone) && !pLights->IsEnabled((Base3DLightNumber)eLight) )
- eLight++;
+ if(nLight > 7)
+ {
+ nLight = 0;
- if( eLight == Base3DLightNone )
+ while(nLight <= 7 && !maLightControl.GetLightOnOff(nLight))
{
- eLight = Base3DLight0;
- while( (eLight < Base3DLightNone) && !pLights->IsEnabled((Base3DLightNumber)eLight) )
- eLight++;
+ nLight++;
}
+ }
+
+ if(nLight <= 7)
+ {
+ maLightControl.SelectLight(nLight);
+ CheckSelection();
- if( eLight < Base3DLightNone )
+ if(maUserSelectionChangeCallback.IsSet())
{
- aLightControl.SelectLight((Base3DLightNumber)eLight);
- CheckSelection();
- if(aUserSelectionChangeCallback.IsSet())
- aUserSelectionChangeCallback.Call(this);
+ maUserSelectionChangeCallback.Call(this);
}
- break;
}
+
+ break;
+ }
default:
+ {
Control::KeyInput( rKEvt );
break;
+ }
}
}
@@ -1396,20 +1230,20 @@ void SvxLightCtl3D::GetFocus()
{
Control::GetFocus();
- if( HasFocus() && IsEnabled() )
+ if(HasFocus() && IsEnabled())
{
CheckSelection();
- Size aFocusSize = aLightControl.GetOutputSizePixel();
+ Size aFocusSize = maLightControl.GetOutputSizePixel();
aFocusSize.Width() -= 4;
aFocusSize.Height() -= 4;
Rectangle aFocusRect( Point( 2, 2 ), aFocusSize );
- aFocusRect = aLightControl.PixelToLogic( aFocusRect );
+ aFocusRect = maLightControl.PixelToLogic( aFocusRect );
- aLightControl.ShowFocus( aFocusRect );
+ maLightControl.ShowFocus( aFocusRect );
}
}
@@ -1417,31 +1251,37 @@ void SvxLightCtl3D::LoseFocus()
{
Control::LoseFocus();
- aLightControl.HideFocus();
+ maLightControl.HideFocus();
}
IMPL_LINK( SvxLightCtl3D, ScrollBarMove, void*, EMPTYARG)
{
- INT32 nHor = aHorScroller.GetThumbPos();
- INT32 nVer = aVerScroller.GetThumbPos();
+ const sal_Int32 nHor(maHorScroller.GetThumbPos());
+ const sal_Int32 nVer(maVerScroller.GetThumbPos());
- aLightControl.SetPosition(
+ maLightControl.SetPosition(
((double)nHor) / 100.0,
((double)((18000 - nVer) - 9000)) / 100.0);
- if(aUserInteractiveChangeCallback.IsSet())
- aUserInteractiveChangeCallback.Call(this);
-
- // ...um Kompatibel zu bleiben, kann spaeter wieder raus
- //InteractiveChange(NULL);
+ if(maUserInteractiveChangeCallback.IsSet())
+ {
+ maUserInteractiveChangeCallback.Call(this);
+ }
return 0;
}
IMPL_LINK( SvxLightCtl3D, ButtonPress, void*, EMPTYARG)
{
- aLightControl.SetGeometry(bSphereUsed);
- bSphereUsed = !bSphereUsed;
+ if(PREVIEW_OBJECTTYPE_SPHERE == GetSvx3DLightControl().GetObjectType())
+ {
+ GetSvx3DLightControl().SetObjectType(PREVIEW_OBJECTTYPE_CUBE);
+ }
+ else
+ {
+ GetSvx3DLightControl().SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
+ }
+
return 0;
}
@@ -1449,15 +1289,14 @@ IMPL_LINK( SvxLightCtl3D, InternalInteractiveChange, void*, EMPTYARG)
{
double fHor, fVer;
- aLightControl.GetPosition(fHor, fVer);
- aHorScroller.SetThumbPos( INT32(fHor * 100.0) );
- aVerScroller.SetThumbPos( 18000 - INT32((fVer + 90.0) * 100.0) );
-
- if(aUserInteractiveChangeCallback.IsSet())
- aUserInteractiveChangeCallback.Call(this);
+ maLightControl.GetPosition(fHor, fVer);
+ maHorScroller.SetThumbPos( INT32(fHor * 100.0) );
+ maVerScroller.SetThumbPos( 18000 - INT32((fVer + 90.0) * 100.0) );
- // ...um Kompatibel zu bleiben, kann spaeter wieder raus
- //InteractiveChange(NULL);
+ if(maUserInteractiveChangeCallback.IsSet())
+ {
+ maUserInteractiveChangeCallback.Call(this);
+ }
return 0;
}
@@ -1466,26 +1305,13 @@ IMPL_LINK( SvxLightCtl3D, InternalSelectionChange, void*, EMPTYARG)
{
CheckSelection();
- if(aUserSelectionChangeCallback.IsSet())
- aUserSelectionChangeCallback.Call(this);
-
- // ...um Kompatibel zu bleiben, kann spaeter wieder raus
- //SelectionChange(NULL);
+ if(maUserSelectionChangeCallback.IsSet())
+ {
+ maUserSelectionChangeCallback.Call(this);
+ }
return 0;
}
-// ...um Kompatibel zu bleiben, kann spaeter wieder raus
-/*
-IMPL_LINK( SvxLightCtl3D, InteractiveChange, void*, EMPTYARG)
-{
- return NULL;
-} */
-
-/*
-IMPL_LINK( SvxLightCtl3D, SelectionChange, void*, EMPTYARG)
-{
- return NULL;
-}*/
-
-
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/engine3d/cube3d.cxx b/svx/source/engine3d/cube3d.cxx
index 2a439705b1..0f52f80dff 100644
--- a/svx/source/engine3d/cube3d.cxx
+++ b/svx/source/engine3d/cube3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: cube3d.cxx,v $
- * $Revision: 1.18 $
+ * $Revision: 1.18.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -66,9 +66,6 @@ E3dCubeObj::E3dCubeObj(E3dDefaultAttributes& rDefault, basegfx::B3DPoint aPos, c
// uebergebene drueberbuegeln
aCubePos = aPos;
aCubeSize = r3DSize;
-
- // Geometrie erzeugen
- CreateGeometry();
}
E3dCubeObj::E3dCubeObj()
@@ -111,178 +108,6 @@ SdrObject *E3dCubeObj::DoConvertToPolyObj(BOOL /*bBezier*/) const
/*************************************************************************
|*
-|* Give out simple line geometry
-|*
-\************************************************************************/
-
-basegfx::B3DPolyPolygon E3dCubeObj::Get3DLineGeometry() const
-{
- basegfx::B3DPolyPolygon aRetval;
-
- // add geometry describing polygons to rLinePolyPolygon
- basegfx::B3DPolygon aNewUpper;
- aNewUpper.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aNewUpper.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aNewUpper.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aNewUpper.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aNewUpper.append(aNewUpper.getB3DPoint(0));
- aRetval.append(aNewUpper);
-
- basegfx::B3DPolygon aNewLower;
- aNewLower.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY(), aCubePos.getZ()));
- aNewLower.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ()));
- aNewLower.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ()));
- aNewLower.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY(), aCubePos.getZ()));
- aNewLower.append(aNewLower.getB3DPoint(0));
- aRetval.append(aNewLower);
-
- basegfx::B3DPolygon aNewVertical;
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY(), aCubePos.getZ()));
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aRetval.append(aNewVertical);
-
- aNewVertical.clear();
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ()));
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aRetval.append(aNewVertical);
-
- aNewVertical.clear();
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ()));
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY() + aCubeSize.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aRetval.append(aNewVertical);
-
- aNewVertical.clear();
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY(), aCubePos.getZ()));
- aNewVertical.append(basegfx::B3DPoint(aCubePos.getX() + aCubeSize.getX(), aCubePos.getY(), aCubePos.getZ() + aCubeSize.getZ()));
- aRetval.append(aNewVertical);
-
- return aRetval;
-}
-
-/*************************************************************************
-|*
-|* Geometrieerzeugung
-|*
-\************************************************************************/
-
-void E3dCubeObj::CreateGeometry()
-{
- basegfx::B3DPoint aPos(aCubePos);
- short nV1, nV2;
- UINT16 nSideBit = 0x0001;
-
- // Start der Geometrieerzeugung ankuendigen
- StartCreateGeometry();
-
- if ( bPosIsCenter )
- aCubePos -= aCubeSize / 2;
-
- for (nV1 = 0; nV1 < 3; nV1++)
- {
- if ( nV1 == 0 ) nV2 = 2;
- else nV2 = nV1 - 1;
-
- // Nur die Flaechen erzeugen, fuer die ein Bit
- if ( nSideFlags & nSideBit )
- { // Flaechenpunkte entgegen dem Uhrzeigersinn generieren
- basegfx::B3DPolygon aRect3D;
-
- aRect3D.append(aPos); aPos[nV1] += aCubeSize[nV1];
- aRect3D.append(aPos); aPos[nV2] += aCubeSize[nV2];
- aRect3D.append(aPos); aPos[nV1] -= aCubeSize[nV1];
- aRect3D.append(aPos); aPos[nV2] -= aCubeSize[nV2];
-
- if(GetCreateNormals())
- {
- basegfx::B3DPolygon aNormals3D;
- basegfx::B3DVector aVecTmp;
-
- aVecTmp = aRect3D.getB3DPoint(0L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
- aVecTmp = aRect3D.getB3DPoint(1L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
- aVecTmp = aRect3D.getB3DPoint(2L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
- aVecTmp = aRect3D.getB3DPoint(3L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
-
- if(GetCreateTexture())
- {
- basegfx::B2DPolygon aTexture2D;
-
- aTexture2D.append(basegfx::B2DPoint(1.0, 0.0));
- aTexture2D.append(basegfx::B2DPoint(0.0, 0.0));
- aTexture2D.append(basegfx::B2DPoint(0.0, 1.0));
- aTexture2D.append(basegfx::B2DPoint(1.0, 1.0));
-
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormals3D), basegfx::B2DPolyPolygon(aTexture2D), FALSE);
- }
- else
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormals3D), FALSE);
- }
- }
- else
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), FALSE);
- }
- }
- nSideBit <<= 1;
- }
- aPos += aCubeSize;
-
- for (nV1 = 2; nV1 >= 0; nV1--)
- {
- if ( nV1 == 2 ) nV2 = 0;
- else nV2 = nV1 + 1;
-
- if ( nSideFlags & nSideBit )
- { // Flaechenpunkte entgegen dem Uhrzeigersinn generieren
- basegfx::B3DPolygon aRect3D;
- basegfx::B2DPolygon aTexture2D;
-
- aRect3D.append(aPos); aPos[nV1] -= aCubeSize[nV1];
- aRect3D.append(aPos); aPos[nV2] -= aCubeSize[nV2];
- aRect3D.append(aPos); aPos[nV1] += aCubeSize[nV1];
- aRect3D.append(aPos); aPos[nV2] += aCubeSize[nV2];
-
- if(GetCreateTexture())
- {
- aTexture2D.append(basegfx::B2DPoint(1.0, 0.0));
- aTexture2D.append(basegfx::B2DPoint(0.0, 0.0));
- aTexture2D.append(basegfx::B2DPoint(0.0, 1.0));
- aTexture2D.append(basegfx::B2DPoint(1.0, 1.0));
- }
-
- if(GetCreateNormals())
- {
- basegfx::B3DPolygon aNormals3D;
- basegfx::B3DVector aVecTmp;
-
- aVecTmp = aRect3D.getB3DPoint(0L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
- aVecTmp = aRect3D.getB3DPoint(1L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
- aVecTmp = aRect3D.getB3DPoint(2L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
- aVecTmp = aRect3D.getB3DPoint(3L); aVecTmp.normalize(); aNormals3D.append(basegfx::B3DPoint(aVecTmp));
-
- if(GetCreateTexture())
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormals3D), basegfx::B2DPolyPolygon(aTexture2D), FALSE);
- }
- else
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormals3D), FALSE);
- }
- }
- else
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), FALSE);
- }
- }
- nSideBit <<= 1;
- }
-
- // call parent
- E3dCompoundObject::CreateGeometry();
-}
-
-/*************************************************************************
-|*
|* Zuweisungsoperator
|*
\************************************************************************/
@@ -312,7 +137,7 @@ void E3dCubeObj::SetCubePos(const basegfx::B3DPoint& rNew)
if(aCubePos != rNew)
{
aCubePos = rNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -321,7 +146,7 @@ void E3dCubeObj::SetCubeSize(const basegfx::B3DVector& rNew)
if(aCubeSize != rNew)
{
aCubeSize = rNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -330,7 +155,7 @@ void E3dCubeObj::SetPosIsCenter(BOOL bNew)
if(bPosIsCenter != bNew)
{
bPosIsCenter = bNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -339,7 +164,7 @@ void E3dCubeObj::SetSideFlags(UINT16 nNew)
if(nSideFlags != nNew)
{
nSideFlags = nNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
diff --git a/svx/source/engine3d/deflt3d.cxx b/svx/source/engine3d/deflt3d.cxx
index aa0f73b0ca..920b98efe4 100644
--- a/svx/source/engine3d/deflt3d.cxx
+++ b/svx/source/engine3d/deflt3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: deflt3d.cxx,v $
- * $Revision: 1.11 $
+ * $Revision: 1.11.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -54,7 +54,6 @@ void E3dDefaultAttributes::Reset()
// Compound-Objekt
bDefaultCreateNormals = TRUE;
bDefaultCreateTexture = TRUE;
- bDefaultUseDifferentBackMaterial = FALSE;
// Cube-Objekt
aDefaultCubePos = basegfx::B3DPoint(-500.0, -500.0, -500.0);
@@ -80,9 +79,6 @@ void E3dDefaultAttributes::Reset()
bDefaultExtrudeCharacterMode = FALSE;
bDefaultExtrudeCloseFront = TRUE;
bDefaultExtrudeCloseBack = TRUE;
-
- // Scene-Objekt
- bDefaultDither = TRUE;
}
// eof
diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx
index bf732689d9..8188fcc221 100644
--- a/svx/source/engine3d/dragmt3d.cxx
+++ b/svx/source/engine3d/dragmt3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dragmt3d.cxx,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.18.2 $
*
* This file is part of OpenOffice.org.
*
@@ -31,10 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-// MIB 6.11.97: Die Reihenfolge der Includes mag verwundern, aber in dieser
-// Reihenfolge geht das durch den SCO GCC, in anderen nicht. Also bitte nicht
-// an der Reihenfolge drehen, wenn es nicht noetig ist. Das gleiche gilt
-// natuerlich auch fuer das hinzufuegen von Includes. Danke.
+#include <dragmt3d.hxx>
#include <tools/shl.hxx>
#include <svx/svdpagv.hxx>
#include <svx/dialmgr.hxx>
@@ -43,35 +40,18 @@
#include <svx/obj3d.hxx>
#include <svx/polysc3d.hxx>
#include <svx/e3dundo.hxx>
-#include "dragmt3d.hxx"
-
#include <svx/dialogs.hrc>
#include <svx/sdr/overlay/overlaypolypolygon.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <svx/e3dsceneupdater.hxx>
TYPEINIT1(E3dDragMethod, SdrDragMethod);
/*************************************************************************
|*
-|* Parameter fuer Interaktion eines 3D-Objektes
-|*
-\************************************************************************/
-
-SV_IMPL_PTRARR(E3dDragMethodUnitGroup, E3dDragMethodUnit*);
-
-/*************************************************************************
-|*
-|* Timing-Qualitaeten
-|*
-\************************************************************************/
-
-#define E3D_GOOD_TIME Time(0,0)
-#define E3D_BAD_TIME Time(0,0,1)
-#define E3D_WANTED_TIME Time(0,0,0,25)
-#define E3D_WAITTIME_TIL_REDRAW (5)
-
-/*************************************************************************
-|*
|* Konstruktor aller 3D-DragMethoden
|*
\************************************************************************/
@@ -82,110 +62,57 @@ E3dDragMethod::E3dDragMethod (
E3dDragConstraint eConstr,
BOOL bFull)
: SdrDragMethod(_rView),
- eConstraint(eConstr),
- bMoveFull(bFull),
- bMovedAtAll(FALSE)
+ meConstraint(eConstr),
+ mbMoveFull(bFull),
+ mbMovedAtAll(FALSE)
{
// Fuer alle in der selektion befindlichen 3D-Objekte
// eine Unit anlegen
- long nCnt = rMark.GetMarkCount();
+ const long nCnt(rMark.GetMarkCount());
+ static bool bDoInvalidate(false);
+
for(long nObjs = 0;nObjs < nCnt;nObjs++)
{
- SdrObject *pObj = rMark.GetMark(nObjs)->GetMarkedSdrObj();
- if(pObj && pObj->ISA(E3dObject))
+ E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj());
+
+ if(pE3dObj)
{
- E3dObject* p3DObj = (E3dObject*)pObj;
- E3dDragMethodUnit* pNewUnit = new E3dDragMethodUnit;
- DBG_ASSERT(pNewUnit, "AW: Kein Speicher");
+ // fill new interaction unit
+ E3dDragMethodUnit aNewUnit;
+ aNewUnit.mp3DObj = pE3dObj;
- // Neue Unit einrichten
- pNewUnit->p3DObj = p3DObj;
+ // get transformations
+ aNewUnit.maInitTransform = aNewUnit.maTransform = pE3dObj->GetTransform();
- // Transformationen holen
- pNewUnit->aInitTransform = pNewUnit->aTransform = p3DObj->GetTransform();
- if(p3DObj->GetParentObj())
- pNewUnit->aDisplayTransform = p3DObj->GetParentObj()->GetFullTransform();
- pNewUnit->aInvDisplayTransform = pNewUnit->aDisplayTransform;
- pNewUnit->aInvDisplayTransform.invert();
+ if(pE3dObj->GetParentObj())
+ {
+ // get transform between object and world, normally scene transform
+ aNewUnit.maInvDisplayTransform = aNewUnit.maDisplayTransform = pE3dObj->GetParentObj()->GetFullTransform();
+ aNewUnit.maInvDisplayTransform.invert();
+ }
// SnapRects der beteiligten Objekte invalidieren, um eine
// Neuberechnung beim Setzen der Marker zu erzwingen
- p3DObj->SetRectsDirty();
-
- if(bMoveFull)
+ if(bDoInvalidate)
{
- // Timings merken
- pNewUnit->nOrigQuality = p3DObj->GetScene()->GetDisplayQuality();
+ pE3dObj->SetRectsDirty();
}
- else
+
+ if(!mbMoveFull)
{
- // Drahtgitterdarstellung fuer Parent-Koodinaten erzeugen
- pNewUnit->aWireframePoly.clear();
- p3DObj->CreateWireframe(pNewUnit->aWireframePoly, NULL);
- pNewUnit->aWireframePoly.transform(pNewUnit->aTransform);
+ // create wireframe visualisation for parent coordinate system
+ aNewUnit.maWireframePoly.clear();
+ aNewUnit.maWireframePoly = pE3dObj->CreateWireframe();
+ aNewUnit.maWireframePoly.transform(aNewUnit.maTransform);
}
// FullBound ermitteln
- aFullBound.Union(p3DObj->GetSnapRect());
+ maFullBound.Union(pE3dObj->GetSnapRect());
// Unit einfuegen
- aGrp.Insert((const E3dDragMethodUnit*&)pNewUnit, aGrp.Count());
- }
- }
-
- // Link auf den Timer setzen
- aCallbackTimer.SetTimeoutHdl( LINK( this, E3dDragMethod, TimerInterruptHdl) );
-}
-
-/*************************************************************************
-|*
-\************************************************************************/
-
-IMPL_LINK(E3dDragMethod, TimerInterruptHdl, void*, EMPTYARG)
-{
- // Alle beteiligten Szenen neu zeichnen
- UINT16 nCnt = aGrp.Count();
- E3dScene* pScene = NULL;
- UINT32 nNewTime(0);
-
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
- {
- if(aGrp[nOb]->p3DObj->GetScene() != pScene)
- {
- pScene = aGrp[nOb]->p3DObj->GetScene();
- INT32 nOldQual = pScene->GetDisplayQuality();
- if(nOldQual != 255)
- {
- if(nOldQual == 0)
- nOldQual = 30;
- else if(nOldQual <= 64)
- nOldQual = 64;
- else
- nOldQual = 255;
-
- pScene->SetDisplayQuality((UINT8)nOldQual);
- pScene->SetChanged();
- pScene->BroadcastObjectChange();
-
- if(nOldQual != 255)
- {
- Time aLast = pScene->GetLastPaintTime();
- if(nOldQual == 30)
- nNewTime = aLast.GetTime() * (50 * E3D_WAITTIME_TIL_REDRAW);
- else
- nNewTime = aLast.GetTime() * (200 * E3D_WAITTIME_TIL_REDRAW);
- }
- }
+ maGrp.push_back(aNewUnit);
}
}
-
- if(nNewTime)
- {
- // Timer reset
- aCallbackTimer.SetTimeout(nNewTime);
- aCallbackTimer.Start();
- }
- return 0L;
}
/*************************************************************************
@@ -204,22 +131,24 @@ void E3dDragMethod::TakeComment(XubString& /*rStr*/) const
FASTBOOL E3dDragMethod::Beg()
{
- if(eConstraint == E3DDRAG_CONSTR_Z)
+ if(E3DDRAG_CONSTR_Z == meConstraint)
{
- UINT16 nCnt = aGrp.Count();
- DragStat().Ref1() = aFullBound.Center();
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
+ const sal_uInt32 nCnt(maGrp.size());
+ DragStat().Ref1() = maFullBound.Center();
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
- aGrp[nOb]->nStartAngle = GetAngle(DragStat().GetStart() - DragStat().GetRef1());
- aGrp[nOb]->nLastAngle = 0;
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ rCandidate.mnStartAngle = GetAngle(DragStat().GetStart() - DragStat().GetRef1());
+ rCandidate.mnLastAngle = 0;
}
}
else
{
- aLastPos = DragStat().GetStart();
+ maLastPos = DragStat().GetStart();
}
- if(!bMoveFull)
+ if(!mbMoveFull)
{
Show();
}
@@ -235,52 +164,30 @@ FASTBOOL E3dDragMethod::Beg()
FASTBOOL E3dDragMethod::End(FASTBOOL /*bCopy*/)
{
- UINT16 nCnt = aGrp.Count();
+ const sal_uInt32 nCnt(maGrp.size());
- if(bMoveFull)
- {
- // Timer stoppen
- aCallbackTimer.Stop();
-
- if(bMovedAtAll)
- {
- // Original-Qualitaet restaurieren
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
- aGrp[nOb]->p3DObj->GetScene()->SetDisplayQuality(aGrp[nOb]->nOrigQuality);
- }
- }
- else
+ if(!mbMoveFull)
{
// WireFrame ausblenden
Hide();
}
// Alle Transformationen anwenden und UnDo's anlegen
- if(bMovedAtAll)
+ if(mbMovedAtAll)
{
rView.BegUndo(SVX_RESSTR(RID_SVX_3D_UNDO_ROTATE));
- UINT16 nOb;
- for(nOb=0;nOb<nCnt;nOb++)
- {
- aGrp[nOb]->p3DObj->SetTransform(aGrp[nOb]->aTransform);
- rView.AddUndo(new E3dRotateUndoAction(aGrp[nOb]->p3DObj->GetModel(),
- aGrp[nOb]->p3DObj, aGrp[nOb]->aInitTransform,
- aGrp[nOb]->aTransform));
- }
- rView.EndUndo();
+ sal_uInt32 nOb(0);
- // An allen beteiligten Szenen SnapRect neu setzen und
- // BoundVolume der Kamera neu bestimmen, da sich die Geometrie
- // tatsaechlich geaendert haben kann
- E3dScene* pScene = NULL;
for(nOb=0;nOb<nCnt;nOb++)
{
- if(aGrp[nOb]->p3DObj->GetScene() != pScene)
- {
- pScene = aGrp[nOb]->p3DObj->GetScene();
- pScene->CorrectSceneDimensions();
- }
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
+ rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
+ rView.AddUndo(new E3dRotateUndoAction(rCandidate.mp3DObj->GetModel(),
+ rCandidate.mp3DObj, rCandidate.maInitTransform,
+ rCandidate.maTransform));
}
+ rView.EndUndo();
}
return TRUE;
@@ -294,22 +201,17 @@ FASTBOOL E3dDragMethod::End(FASTBOOL /*bCopy*/)
void E3dDragMethod::Brk()
{
- if(bMoveFull)
+ if(mbMoveFull)
{
- // Timer stoppen
- aCallbackTimer.Stop();
-
- if(bMovedAtAll)
+ if(mbMovedAtAll)
{
- UINT16 nCnt = aGrp.Count();
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
+ const sal_uInt32 nCnt(maGrp.size());
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
// Transformation restaurieren
- aGrp[nOb]->p3DObj->SetTransform(aGrp[nOb]->aInitTransform);
- aGrp[nOb]->p3DObj->GetScene()->FitSnapRectToBoundVol();
-
- // Original-Qualitaet restaurieren
- aGrp[nOb]->p3DObj->GetScene()->SetDisplayQuality(aGrp[nOb]->nOrigQuality);
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ rCandidate.mp3DObj->SetTransform(rCandidate.maInitTransform);
}
}
}
@@ -328,43 +230,7 @@ void E3dDragMethod::Brk()
void E3dDragMethod::Mov(const Point& /*rPnt*/)
{
- bMovedAtAll = TRUE;
- if(bMoveFull)
- {
- UINT32 nNewTime = 0L;
-
- // Darstellungsqualitaet bestimmen
- UINT16 nCnt = aGrp.Count();
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
- {
- E3dScene* pScene = aGrp[nOb]->p3DObj->GetScene();
- if(pScene)
- {
- Time aLast = pScene->GetLastPaintTime();
- if(aLast.GetTime())
- {
- INT32 nActQual = pScene->GetDisplayQuality();
-
- // nur weiter ueberlegen, wenn die Qualitaet ueber null liegt
- if(nActQual)
- {
- INT32 nNewQual = nActQual + (E3D_WANTED_TIME.GetTime() - aLast.GetTime());
- if(nNewQual < 0L)
- nNewQual = 0L;
- if(nNewQual > 255L)
- nNewQual = 255L;
- pScene->SetDisplayQuality((UINT8)nNewQual);
- }
- }
- UINT32 nTime = aLast.GetTime() * (25 * E3D_WAITTIME_TIL_REDRAW);
- nNewTime = (nTime > nNewTime) ? nTime : nNewTime;
- }
- }
-
- // Timer reset
- aCallbackTimer.SetTimeout(nNewTime);
- aCallbackTimer.Start();
- }
+ mbMovedAtAll = true;
}
/*************************************************************************
@@ -376,36 +242,33 @@ void E3dDragMethod::Mov(const Point& /*rPnt*/)
// for migration from XOR to overlay
void E3dDragMethod::CreateOverlayGeometry(::sdr::overlay::OverlayManager& rOverlayManager, ::sdr::overlay::OverlayObjectList& rOverlayList)
{
- sal_uInt16 nCnt(aGrp.Count());
+ const sal_uInt32 nCnt(maGrp.size());
basegfx::B2DPolyPolygon aResult;
- for(sal_uInt16 nOb(0); nOb < nCnt; nOb++)
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
- B3dCamera& rCameraSet = aGrp[nOb]->p3DObj->GetScene()->GetCameraSet();
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
SdrPageView* pPV = rView.GetSdrPageView();
- if(pPV)
+ if(pPV && pPV->HasMarkedObjPageView())
{
- if(pPV->HasMarkedObjPageView())
+ const basegfx::B3DPolyPolygon aCandidate(rCandidate.maWireframePoly);
+ const sal_uInt32 nPlyCnt(aCandidate.count());
+
+ if(nPlyCnt)
{
- const sal_uInt32 nPntCnt(aGrp[nOb]->aWireframePoly.count());
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ const basegfx::B3DHomMatrix aWorldToView(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection() * aViewInfo3D.getOrientation());
+ const basegfx::B3DHomMatrix aTransform(aWorldToView * rCandidate.maDisplayTransform);
- if(nPntCnt > 1L)
- {
- for(sal_uInt32 b(0L); b < nPntCnt; b += 2L)
- {
- basegfx::B3DPoint aStart = aGrp[nOb]->aDisplayTransform * aGrp[nOb]->aWireframePoly.getB3DPoint(b);
- aStart = rCameraSet.WorldToViewCoor(aStart);
+ // transform to relative scene coordinates
+ basegfx::B2DPolyPolygon aPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aCandidate, aTransform));
- basegfx::B3DPoint aEnd = aGrp[nOb]->aDisplayTransform * aGrp[nOb]->aWireframePoly.getB3DPoint(b+1L);
- aEnd = rCameraSet.WorldToViewCoor(aEnd);
+ // transform to 2D view coordinates
+ aPolyPolygon.transform(rVCScene.getObjectTransformation());
- basegfx::B2DPolygon aTempPoly;
- aTempPoly.append(basegfx::B2DPoint(aStart.getX(), aStart.getY()));
- aTempPoly.append(basegfx::B2DPoint(aEnd.getX(), aEnd.getY()));
- aResult.append(aTempPoly);
- }
- }
+ aResult.append(aPolyPolygon);
}
}
}
@@ -433,47 +296,52 @@ E3dDragRotate::E3dDragRotate(SdrDragView &_rView,
: E3dDragMethod(_rView, rMark, eConstr, bFull)
{
// Zentrum aller selektierten Objekte in Augkoordinaten holen
- UINT16 nCnt = aGrp.Count();
- E3dScene *pScene = NULL;
+ const sal_uInt32 nCnt(maGrp.size());
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
+ if(nCnt)
{
- basegfx::B3DPoint aObjCenter = aGrp[nOb]->p3DObj->GetCenter();
- B3dCamera& rCameraSet = aGrp[nOb]->p3DObj->GetScene()->GetCameraSet();
- aObjCenter *= aGrp[nOb]->aInitTransform;
- aObjCenter *= aGrp[nOb]->aDisplayTransform;
- aObjCenter = rCameraSet.WorldToEyeCoor(aObjCenter);
- aGlobalCenter += aObjCenter;
-
- if(aGrp[nOb]->p3DObj->ISA(E3dScene))
- pScene = (E3dScene*)aGrp[nOb]->p3DObj;
- }
+ const E3dScene *pScene = maGrp[0].mp3DObj->GetScene();
+
+ if(pScene)
+ {
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
- // Teilen durch Anzahl
- if(nCnt > 1)
- aGlobalCenter /= (double)nCnt;
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
+ {
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ basegfx::B3DPoint aObjCenter = rCandidate.mp3DObj->GetBoundVolume().getCenter();
+ const basegfx::B3DHomMatrix aTransform(aViewInfo3D.getOrientation() * rCandidate.maDisplayTransform * rCandidate.maInitTransform);
- // Gruppe schon gesetzt? Sonst gruppe irgendeines Objektes
- // (erstes) holen
- if(!pScene && nCnt)
- {
- if(aGrp[0]->p3DObj)
- pScene = aGrp[0]->p3DObj->GetScene();
- }
+ aObjCenter = aTransform * aObjCenter;
+ maGlobalCenter += aObjCenter;
+ }
- if(pScene)
- {
- // 2D-Koordinaten des Controls Rotationszentrum holen
- Point aRotCenter2D = Ref1();
+ // Teilen durch Anzahl
+ if(nCnt > 1)
+ {
+ maGlobalCenter /= (double)nCnt;
+ }
+
+ // get rotate center and transform to 3D eye coordinates
+ basegfx::B2DPoint aRotCenter2D(Ref1().X(), Ref1().Y());
- // In Augkoordinaten transformieren
- basegfx::B3DPoint aRotCenter(aRotCenter2D.X(), aRotCenter2D.Y(), 0.0);
- aRotCenter = pScene->GetCameraSet().ViewToEyeCoor(aRotCenter);
+ // from world to relative scene using inverse getObjectTransformation()
+ basegfx::B2DHomMatrix aInverseObjectTransform(rVCScene.getObjectTransformation());
+ aInverseObjectTransform.invert();
+ aRotCenter2D = aInverseObjectTransform * aRotCenter2D;
+
+ // from 3D view to 3D eye
+ basegfx::B3DPoint aRotCenter3D(aRotCenter2D.getX(), aRotCenter2D.getY(), 0.0);
+ basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
+ aInverseViewToEye.invert();
+ aRotCenter3D = aInverseViewToEye * aRotCenter3D;
// X,Y des RotCenter und Tiefe der gemeinsamen Objektmitte aus
// Rotationspunkt im Raum benutzen
- aGlobalCenter.setX(aRotCenter.getX());
- aGlobalCenter.setY(aRotCenter.getY());
+ maGlobalCenter.setX(aRotCenter3D.getX());
+ maGlobalCenter.setY(aRotCenter3D.getY());
+ }
}
}
@@ -491,7 +359,7 @@ void E3dDragRotate::Mov(const Point& rPnt)
if(DragStat().CheckMinMoved(rPnt))
{
// Modifier holen
- UINT16 nModifier = 0;
+ sal_uInt16 nModifier = 0;
if(rView.ISA(E3dView))
{
const MouseEvent& rLastMouse = ((E3dView&)rView).GetMouseEvent();
@@ -499,26 +367,28 @@ void E3dDragRotate::Mov(const Point& rPnt)
}
// Alle Objekte rotieren
- UINT16 nCnt = aGrp.Count();
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
+ const sal_uInt32 nCnt(maGrp.size());
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
// Rotationswinkel bestimmen
double fWAngle, fHAngle;
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
- if(eConstraint == E3DDRAG_CONSTR_Z)
+ if(E3DDRAG_CONSTR_Z == meConstraint)
{
fWAngle = NormAngle360(GetAngle(rPnt - DragStat().GetRef1()) -
- aGrp[nOb]->nStartAngle) - aGrp[nOb]->nLastAngle;
- aGrp[nOb]->nLastAngle = (long)fWAngle + aGrp[nOb]->nLastAngle;
+ rCandidate.mnStartAngle) - rCandidate.mnLastAngle;
+ rCandidate.mnLastAngle = (long)fWAngle + rCandidate.mnLastAngle;
fWAngle /= 100.0;
fHAngle = 0.0;
}
else
{
- fWAngle = 90.0 * (double)(rPnt.X() - aLastPos.X())
- / (double)aFullBound.GetWidth();
- fHAngle = 90.0 * (double)(rPnt.Y() - aLastPos.Y())
- / (double)aFullBound.GetHeight();
+ fWAngle = 90.0 * (double)(rPnt.X() - maLastPos.X())
+ / (double)maFullBound.GetWidth();
+ fHAngle = 90.0 * (double)(rPnt.Y() - maLastPos.Y())
+ / (double)maFullBound.GetHeight();
}
long nSnap = 0;
@@ -537,51 +407,55 @@ void E3dDragRotate::Mov(const Point& rPnt)
// Transformation bestimmen
basegfx::B3DHomMatrix aRotMat;
- if(eConstraint & E3DDRAG_CONSTR_Y)
+ if(E3DDRAG_CONSTR_Y & meConstraint)
{
if(nModifier & KEY_MOD2)
aRotMat.rotate(0.0, 0.0, fWAngle);
else
aRotMat.rotate(0.0, fWAngle, 0.0);
}
- else if(eConstraint & E3DDRAG_CONSTR_Z)
+ else if(E3DDRAG_CONSTR_Z & meConstraint)
{
if(nModifier & KEY_MOD2)
aRotMat.rotate(0.0, fWAngle, 0.0);
else
aRotMat.rotate(0.0, 0.0, fWAngle);
}
- if(eConstraint & E3DDRAG_CONSTR_X)
+ if(E3DDRAG_CONSTR_X & meConstraint)
{
aRotMat.rotate(fHAngle, 0.0, 0.0);
}
// Transformation in Eye-Koordinaten, dort rotieren
// und zurueck
- B3dCamera& rCameraSet = aGrp[nOb]->p3DObj->GetScene()->GetCameraSet();
- basegfx::B3DHomMatrix aTransMat = aGrp[nOb]->aDisplayTransform;
- aTransMat *= rCameraSet.GetOrientation();
- aTransMat.translate(-aGlobalCenter.getX(), -aGlobalCenter.getY(), -aGlobalCenter.getZ());
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+
+ basegfx::B3DHomMatrix aTransMat(rCandidate.maDisplayTransform);
+ aTransMat *= aViewInfo3D.getOrientation();
+ aTransMat.translate(-maGlobalCenter.getX(), -maGlobalCenter.getY(), -maGlobalCenter.getZ());
aTransMat *= aRotMat;
- aTransMat.translate(aGlobalCenter.getX(), aGlobalCenter.getY(), aGlobalCenter.getZ());
- aTransMat *= rCameraSet.GetInvOrientation();
- aTransMat *= aGrp[nOb]->aInvDisplayTransform;
+ aTransMat.translate(maGlobalCenter.getX(), maGlobalCenter.getY(), maGlobalCenter.getZ());
+ aTransMat *= aInverseOrientation;
+ aTransMat *= rCandidate.maInvDisplayTransform;
// ...und anwenden
- aGrp[nOb]->aTransform *= aTransMat;
- if(bMoveFull)
+ rCandidate.maTransform *= aTransMat;
+
+ if(mbMoveFull)
{
- aGrp[nOb]->p3DObj->NbcSetTransform(aGrp[nOb]->aTransform);
- aGrp[nOb]->p3DObj->GetScene()->FitSnapRectToBoundVol();
+ rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
}
else
{
Hide();
- aGrp[nOb]->aWireframePoly.transform(aTransMat);
+ rCandidate.maWireframePoly.transform(aTransMat);
Show();
}
}
- aLastPos = rPnt;
+ maLastPos = rPnt;
DragStat().NextMove(rPnt);
}
}
@@ -612,33 +486,33 @@ E3dDragMove::E3dDragMove(SdrDragView &_rView,
E3dDragConstraint eConstr,
BOOL bFull)
: E3dDragMethod(_rView, rMark, eConstr, bFull),
- eWhatDragHdl(eDrgHdl)
+ meWhatDragHdl(eDrgHdl)
{
- switch(eWhatDragHdl)
+ switch(meWhatDragHdl)
{
case HDL_LEFT:
- aScaleFixPos = aFullBound.RightCenter();
+ maScaleFixPos = maFullBound.RightCenter();
break;
case HDL_RIGHT:
- aScaleFixPos = aFullBound.LeftCenter();
+ maScaleFixPos = maFullBound.LeftCenter();
break;
case HDL_UPPER:
- aScaleFixPos = aFullBound.BottomCenter();
+ maScaleFixPos = maFullBound.BottomCenter();
break;
case HDL_LOWER:
- aScaleFixPos = aFullBound.TopCenter();
+ maScaleFixPos = maFullBound.TopCenter();
break;
case HDL_UPLFT:
- aScaleFixPos = aFullBound.BottomRight();
+ maScaleFixPos = maFullBound.BottomRight();
break;
case HDL_UPRGT:
- aScaleFixPos = aFullBound.BottomLeft();
+ maScaleFixPos = maFullBound.BottomLeft();
break;
case HDL_LWLFT:
- aScaleFixPos = aFullBound.TopRight();
+ maScaleFixPos = maFullBound.TopRight();
break;
case HDL_LWRGT:
- aScaleFixPos = aFullBound.TopLeft();
+ maScaleFixPos = maFullBound.TopLeft();
break;
default:
// Bewegen des Objektes, HDL_MOVE
@@ -648,8 +522,8 @@ E3dDragMove::E3dDragMove(SdrDragView &_rView,
// Override wenn IsResizeAtCenter()
if(rView.IsResizeAtCenter())
{
- eWhatDragHdl = HDL_USER;
- aScaleFixPos = aFullBound.Center();
+ meWhatDragHdl = HDL_USER;
+ maScaleFixPos = maFullBound.Center();
}
}
@@ -666,64 +540,82 @@ void E3dDragMove::Mov(const Point& rPnt)
if(DragStat().CheckMinMoved(rPnt))
{
- if(eWhatDragHdl == HDL_MOVE)
+ if(HDL_MOVE == meWhatDragHdl)
{
// Translation
// Bewegungsvektor bestimmen
- basegfx::B3DPoint aGlobalMoveHead((double)(rPnt.X() - aLastPos.X()), (double)(rPnt.Y() - aLastPos.Y()), 32768.0);
+ basegfx::B3DPoint aGlobalMoveHead((double)(rPnt.X() - maLastPos.X()), (double)(rPnt.Y() - maLastPos.Y()), 32768.0);
basegfx::B3DPoint aGlobalMoveTail(0.0, 0.0, 32768.0);
- UINT16 nCnt = aGrp.Count();
+ const sal_uInt32 nCnt(maGrp.size());
// Modifier holen
- UINT16 nModifier = 0;
+ sal_uInt16 nModifier(0);
+
if(rView.ISA(E3dView))
{
const MouseEvent& rLastMouse = ((E3dView&)rView).GetMouseEvent();
nModifier = rLastMouse.GetModifier();
}
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
- B3dCamera& rCameraSet = aGrp[nOb]->p3DObj->GetScene()->GetCameraSet();
-
- // Bewegungsvektor von View-Koordinaten nach Aug-Koordinaten
- basegfx::B3DPoint aMoveHead(rCameraSet.ViewToEyeCoor(aGlobalMoveHead));
- basegfx::B3DPoint aMoveTail(rCameraSet.ViewToEyeCoor(aGlobalMoveTail));
-
- // Eventuell Bewegung von XY-Ebene auf XZ-Ebene umschalten
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+
+ // move coor from 2d world to 3d Eye
+ basegfx::B2DPoint aGlobalMoveHead2D((double)(rPnt.X() - maLastPos.X()), (double)(rPnt.Y() - maLastPos.Y()));
+ basegfx::B2DPoint aGlobalMoveTail2D(0.0, 0.0);
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+
+ aInverseSceneTransform.invert();
+ aGlobalMoveHead2D = aInverseSceneTransform * aGlobalMoveHead2D;
+ aGlobalMoveTail2D = aInverseSceneTransform * aGlobalMoveTail2D;
+
+ basegfx::B3DPoint aMoveHead3D(aGlobalMoveHead2D.getX(), aGlobalMoveHead2D.getY(), 0.5);
+ basegfx::B3DPoint aMoveTail3D(aGlobalMoveTail2D.getX(), aGlobalMoveTail2D.getY(), 0.5);
+ basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
+ aInverseViewToEye.invert();
+
+ aMoveHead3D = aInverseViewToEye * aMoveHead3D;
+ aMoveTail3D = aInverseViewToEye * aMoveTail3D;
+
+ // eventually switch movement from XY to XZ plane
if(nModifier & KEY_MOD2)
{
- double fZwi = aMoveHead.getY();
- aMoveHead.setY(aMoveHead.getZ());
- aMoveHead.setZ(fZwi);
+ double fZwi = aMoveHead3D.getY();
+ aMoveHead3D.setY(aMoveHead3D.getZ());
+ aMoveHead3D.setZ(fZwi);
- fZwi = aMoveTail.getY();
- aMoveTail.setY(aMoveTail.getZ());
- aMoveTail.setZ(fZwi);
+ fZwi = aMoveTail3D.getY();
+ aMoveTail3D.setY(aMoveTail3D.getZ());
+ aMoveTail3D.setZ(fZwi);
}
// Bewegungsvektor von Aug-Koordinaten nach Parent-Koordinaten
- aMoveHead = rCameraSet.EyeToWorldCoor(aMoveHead);
- aMoveHead *= aGrp[nOb]->aInvDisplayTransform;
- aMoveTail = rCameraSet.EyeToWorldCoor(aMoveTail);
- aMoveTail *= aGrp[nOb]->aInvDisplayTransform;
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+ basegfx::B3DHomMatrix aCompleteTrans(rCandidate.maInvDisplayTransform * aInverseOrientation);
+
+ aMoveHead3D = aCompleteTrans * aMoveHead3D;
+ aMoveTail3D = aCompleteTrans* aMoveTail3D;
- // Transformation bestimmen
+ // build transformation
basegfx::B3DHomMatrix aTransMat;
- basegfx::B3DPoint aTranslate(aMoveHead - aMoveTail);
+ basegfx::B3DPoint aTranslate(aMoveHead3D - aMoveTail3D);
aTransMat.translate(aTranslate.getX(), aTranslate.getY(), aTranslate.getZ());
- // ...und anwenden
- aGrp[nOb]->aTransform *= aTransMat;
- if(bMoveFull)
+ // ...and apply
+ rCandidate.maTransform *= aTransMat;
+
+ if(mbMoveFull)
{
- aGrp[nOb]->p3DObj->NbcSetTransform(aGrp[nOb]->aTransform);
- aGrp[nOb]->p3DObj->GetScene()->FitSnapRectToBoundVol();
+ rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
}
else
{
Hide();
- aGrp[nOb]->aWireframePoly.transform(aTransMat);
+ rCandidate.maWireframePoly.transform(aTransMat);
Show();
}
}
@@ -733,98 +625,122 @@ void E3dDragMove::Mov(const Point& rPnt)
// Skalierung
// Skalierungsvektor bestimmen
Point aStartPos = DragStat().GetStart();
- basegfx::B3DPoint aGlobalScaleStart((double)(aStartPos.X()), (double)(aStartPos.Y()), 32768.0);
- basegfx::B3DPoint aGlobalScaleNext((double)(rPnt.X()), (double)(rPnt.Y()), 32768.0);
- basegfx::B3DPoint aGlobalScaleFixPos((double)(aScaleFixPos.X()), (double)(aScaleFixPos.Y()), 32768.0);
- UINT16 nCnt = aGrp.Count();
+ const sal_uInt32 nCnt(maGrp.size());
- for(UINT16 nOb=0;nOb<nCnt;nOb++)
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
- B3dCamera& rCameraSet = aGrp[nOb]->p3DObj->GetScene()->GetCameraSet();
- basegfx::B3DPoint aObjectCenter(aGrp[nOb]->p3DObj->GetCenter());
- aGlobalScaleStart.setZ(aObjectCenter.getZ());
- aGlobalScaleNext.setZ(aObjectCenter.getZ());
- aGlobalScaleFixPos.setZ(aObjectCenter.getZ());
-
- // Skalierungsvektor von View-Koordinaten nach Aug-Koordinaten
- basegfx::B3DPoint aScStart(rCameraSet.ViewToEyeCoor(aGlobalScaleStart));
- basegfx::B3DPoint aScNext(rCameraSet.ViewToEyeCoor(aGlobalScaleNext));
- basegfx::B3DPoint aScFixPos(rCameraSet.ViewToEyeCoor(aGlobalScaleFixPos));
-
- // Einschraenkungen?
- switch(eWhatDragHdl)
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ const basegfx::B3DPoint aObjectCenter(rCandidate.mp3DObj->GetBoundVolume().getCenter());
+
+ // transform from 2D world view to 3D eye
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+
+ basegfx::B2DPoint aGlobalScaleStart2D((double)(aStartPos.X()), (double)(aStartPos.Y()));
+ basegfx::B2DPoint aGlobalScaleNext2D((double)(rPnt.X()), (double)(rPnt.Y()));
+ basegfx::B2DPoint aGlobalScaleFixPos2D((double)(maScaleFixPos.X()), (double)(maScaleFixPos.Y()));
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+
+ aInverseSceneTransform.invert();
+ aGlobalScaleStart2D = aInverseSceneTransform * aGlobalScaleStart2D;
+ aGlobalScaleNext2D = aInverseSceneTransform * aGlobalScaleNext2D;
+ aGlobalScaleFixPos2D = aInverseSceneTransform * aGlobalScaleFixPos2D;
+
+ basegfx::B3DPoint aGlobalScaleStart3D(aGlobalScaleStart2D.getX(), aGlobalScaleStart2D.getY(), aObjectCenter.getZ());
+ basegfx::B3DPoint aGlobalScaleNext3D(aGlobalScaleNext2D.getX(), aGlobalScaleNext2D.getY(), aObjectCenter.getZ());
+ basegfx::B3DPoint aGlobalScaleFixPos3D(aGlobalScaleFixPos2D.getX(), aGlobalScaleFixPos2D.getY(), aObjectCenter.getZ());
+ basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
+
+ aInverseViewToEye.invert();
+ basegfx::B3DPoint aScStart(aInverseViewToEye * aGlobalScaleStart3D);
+ basegfx::B3DPoint aScNext(aInverseViewToEye * aGlobalScaleNext3D);
+ basegfx::B3DPoint aScFixPos(aInverseViewToEye * aGlobalScaleFixPos3D);
+
+ // constraints?
+ switch(meWhatDragHdl)
{
case HDL_LEFT:
case HDL_RIGHT:
- // Einschraenken auf X -> Y gleichsetzen
+ // constrain to auf X -> Y equal
aScNext.setY(aScFixPos.getY());
break;
case HDL_UPPER:
case HDL_LOWER:
- // Einschraenken auf Y -> X gleichsetzen
+ // constrain to auf Y -> X equal
aScNext.setX(aScFixPos.getX());
break;
default:
break;
}
- // ScaleVector in Augkoordinaten bestimmen
+ // get scale vector in eye coordinates
basegfx::B3DPoint aScaleVec(aScStart - aScFixPos);
aScaleVec.setZ(1.0);
if(aScaleVec.getX() != 0.0)
+ {
aScaleVec.setX((aScNext.getX() - aScFixPos.getX()) / aScaleVec.getX());
+ }
else
+ {
aScaleVec.setX(1.0);
+ }
if(aScaleVec.getY() != 0.0)
+ {
aScaleVec.setY((aScNext.getY() - aScFixPos.getY()) / aScaleVec.getY());
+ }
else
+ {
aScaleVec.setY(1.0);
+ }
- // Mit SHIFT-Taste?
+ // SHIFT-key used?
if(rView.IsOrtho())
{
if(fabs(aScaleVec.getX()) > fabs(aScaleVec.getY()))
{
- // X ist am groessten
+ // X is biggest
aScaleVec.setY(aScaleVec.getX());
}
else
{
- // Y ist am groessten
+ // Y is biggest
aScaleVec.setX(aScaleVec.getY());
}
}
- // Transformation bestimmen
- basegfx::B3DHomMatrix aNewTrans = aGrp[nOb]->aInitTransform;
- aNewTrans *= aGrp[nOb]->aDisplayTransform;
- aNewTrans *= rCameraSet.GetOrientation();
+ // build transformation
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+
+ basegfx::B3DHomMatrix aNewTrans = rCandidate.maInitTransform;
+ aNewTrans *= rCandidate.maDisplayTransform;
+ aNewTrans *= aViewInfo3D.getOrientation();
aNewTrans.translate(-aScFixPos.getX(), -aScFixPos.getY(), -aScFixPos.getZ());
aNewTrans.scale(aScaleVec.getX(), aScaleVec.getY(), aScaleVec.getZ());
aNewTrans.translate(aScFixPos.getX(), aScFixPos.getY(), aScFixPos.getZ());
- aNewTrans *= rCameraSet.GetInvOrientation();
- aNewTrans *= aGrp[nOb]->aInvDisplayTransform;
+ aNewTrans *= aInverseOrientation;
+ aNewTrans *= rCandidate.maInvDisplayTransform;
// ...und anwenden
- aGrp[nOb]->aTransform = aNewTrans;
- if(bMoveFull)
+ rCandidate.maTransform = aNewTrans;
+
+ if(mbMoveFull)
{
- aGrp[nOb]->p3DObj->NbcSetTransform(aGrp[nOb]->aTransform);
- aGrp[nOb]->p3DObj->GetScene()->FitSnapRectToBoundVol();
+ rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
}
else
{
Hide();
- aGrp[nOb]->aWireframePoly.clear();
- aGrp[nOb]->p3DObj->CreateWireframe(aGrp[nOb]->aWireframePoly, NULL);
- aGrp[nOb]->aWireframePoly.transform(aGrp[nOb]->aTransform);
+ rCandidate.maWireframePoly.clear();
+ rCandidate.maWireframePoly = rCandidate.mp3DObj->CreateWireframe();
+ rCandidate.maWireframePoly.transform(rCandidate.maTransform);
Show();
}
}
}
- aLastPos = rPnt;
+ maLastPos = rPnt;
DragStat().NextMove(rPnt);
}
}
diff --git a/svx/source/engine3d/e3dsceneupdater.cxx b/svx/source/engine3d/e3dsceneupdater.cxx
new file mode 100644
index 0000000000..c138acdde0
--- /dev/null
+++ b/svx/source/engine3d/e3dsceneupdater.cxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: e3dsceneupdater.cxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/e3dsceneupdater.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/scene3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+E3DModifySceneSnapRectUpdater::E3DModifySceneSnapRectUpdater(const SdrObject* pObject)
+: mpScene(0),
+ mpViewInformation3D(0)
+{
+ // Secure old 3D transformation stack before modification
+ if(pObject)
+ {
+ const E3dObject* pE3dObject = dynamic_cast< const E3dObject* >(pObject);
+
+ if(pE3dObject)
+ {
+ mpScene = pE3dObject->GetScene();
+
+ if(mpScene && mpScene->GetScene() == mpScene)
+ {
+ // if there is a scene and it's the outmost scene, get current 3D range
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(mpScene->GetViewContact());
+ const basegfx::B3DRange aAllContentRange(rVCScene.getAllContentRange3D());
+
+ if(aAllContentRange.isEmpty())
+ {
+ // no content, nothing to do
+ mpScene = 0;
+ }
+ else
+ {
+ // secure current 3D transformation stack
+ mpViewInformation3D = new drawinglayer::geometry::ViewInformation3D(rVCScene.getViewInformation3D(aAllContentRange));
+ }
+ }
+ }
+ }
+}
+
+E3DModifySceneSnapRectUpdater::~E3DModifySceneSnapRectUpdater()
+{
+ if(mpScene && mpViewInformation3D)
+ {
+ // after changing parts of the scene, use the secured last 3d transformation stack and the new content
+ // range to calculate a new, eventually expanded or shrunk, 2D geometry for the scene and apply it.
+ // Get new content range
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(mpScene->GetViewContact());
+ basegfx::B3DRange aAllContentRange(rVCScene.getAllContentRange3D());
+
+ // only change when there is still content; else let scene stay at old SnapRect
+ if(!aAllContentRange.isEmpty())
+ {
+ // check if object transform of scene has changed
+ if(mpViewInformation3D->getObjectTransformation() != mpScene->GetTransform())
+ {
+ // If Yes, it needs to be updated since it's - for historical reasons -
+ // part of the basic 3d transformation stack of the scene
+ drawinglayer::geometry::ViewInformation3D* pNew = new drawinglayer::geometry::ViewInformation3D(
+ mpScene->GetTransform(), // replace object transformation with new local transform
+ mpViewInformation3D->getOrientation(),
+ mpViewInformation3D->getProjection(),
+ mpViewInformation3D->getDeviceToView(),
+ mpViewInformation3D->getViewTime(),
+ mpViewInformation3D->getExtendedInformationSequence());
+ delete mpViewInformation3D;
+ mpViewInformation3D = pNew;
+ }
+
+ // transform content range to scene-relative coordinates using old 3d transformation stack
+ aAllContentRange.transform(mpViewInformation3D->getObjectToView());
+
+ // build 2d relative content range
+ basegfx::B2DRange aSnapRange(
+ aAllContentRange.getMinX(), aAllContentRange.getMinY(),
+ aAllContentRange.getMaxX(), aAllContentRange.getMaxY());
+
+ // transform to 2D world coordiantes using scene's 2D transformation
+ aSnapRange.transform(rVCScene.getObjectTransformation());
+
+ // snap to (old) integer
+ const Rectangle aNewSnapRect(
+ sal_Int32(floor(aSnapRange.getMinX())), sal_Int32(floor(aSnapRange.getMinY())),
+ sal_Int32(ceil(aSnapRange.getMaxX())), sal_Int32(ceil(aSnapRange.getMaxY())));
+
+ // set as new SnapRect and invalidate bound volume
+ if(mpScene->GetSnapRect() != aNewSnapRect)
+ {
+ mpScene->SetSnapRect(aNewSnapRect);
+ mpScene->InvalidateBoundVolume();
+ }
+ }
+ }
+
+ delete mpViewInformation3D;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/engine3d/e3dundo.cxx b/svx/source/engine3d/e3dundo.cxx
index 3853b4b93a..a564149499 100644
--- a/svx/source/engine3d/e3dundo.cxx
+++ b/svx/source/engine3d/e3dundo.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: e3dundo.cxx,v $
- * $Revision: 1.9 $
+ * $Revision: 1.9.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -35,6 +35,7 @@
#include <svx/outlobj.hxx>
#include <svx/view3d.hxx>
#include <svx/scene3d.hxx>
+#include <svx/e3dsceneupdater.hxx>
/************************************************************************/
@@ -85,8 +86,8 @@ E3dRotateUndoAction::~E3dRotateUndoAction ()
\************************************************************************/
void E3dRotateUndoAction::Undo ()
{
+ E3DModifySceneSnapRectUpdater aUpdater(pMy3DObj);
pMy3DObj->SetTransform(aMyOldRotation);
- pMy3DObj->GetScene()->CorrectSceneDimensions();
}
/************************************************************************\
@@ -96,8 +97,8 @@ void E3dRotateUndoAction::Undo ()
\************************************************************************/
void E3dRotateUndoAction::Redo ()
{
+ E3DModifySceneSnapRectUpdater aUpdater(pMy3DObj);
pMy3DObj->SetTransform(aMyNewRotation);
- pMy3DObj->GetScene()->CorrectSceneDimensions();
}
/*************************************************************************
@@ -146,15 +147,8 @@ E3dAttributesUndoAction::~E3dAttributesUndoAction()
\************************************************************************/
void E3dAttributesUndoAction::Undo()
{
- //pObject->SetItemSetAndBroadcast(aOldSet);
+ E3DModifySceneSnapRectUpdater aUpdater(pObject);
pObject->SetMergedItemSetAndBroadcast(aOldSet);
-
- if(pObject->ISA(E3dObject))
- {
- E3dScene* pScene = ((E3dObject*)pObject)->GetScene();
- if(pScene)
- pScene->CorrectSceneDimensions();
- }
}
/*************************************************************************
@@ -164,15 +158,8 @@ void E3dAttributesUndoAction::Undo()
\************************************************************************/
void E3dAttributesUndoAction::Redo()
{
- //pObject->SetItemSetAndBroadcast(aNewSet);
+ E3DModifySceneSnapRectUpdater aUpdater(pObject);
pObject->SetMergedItemSetAndBroadcast(aNewSet);
-
- if(pObject->ISA(E3dObject))
- {
- E3dScene* pScene = ((E3dObject*)pObject)->GetScene();
- if(pScene)
- pScene->CorrectSceneDimensions();
- }
}
/*************************************************************************
diff --git a/svx/source/engine3d/extrud3d.cxx b/svx/source/engine3d/extrud3d.cxx
index fe7f7ddb49..a08fe4e753 100644
--- a/svx/source/engine3d/extrud3d.cxx
+++ b/svx/source/engine3d/extrud3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: extrud3d.cxx,v $
- * $Revision: 1.25 $
+ * $Revision: 1.25.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -48,6 +48,7 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b3dpolygontools.hxx>
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
//////////////////////////////////////////////////////////////////////////////
// #110094# DrawContact section
@@ -89,9 +90,6 @@ E3dExtrudeObj::E3dExtrudeObj(E3dDefaultAttributes& rDefault, const basegfx::B2DP
// set extrude depth
GetProperties().SetObjectItemDirect(Svx3DDepthItem((sal_uInt32)(fDepth + 0.5)));
-
- // Geometrie erzeugen
- CreateGeometry();
}
E3dExtrudeObj::E3dExtrudeObj()
@@ -117,183 +115,6 @@ void E3dExtrudeObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
/*************************************************************************
|*
-|* Geometrieerzeugung
-|*
-\************************************************************************/
-
-basegfx::B3DPolyPolygon E3dExtrudeObj::GetFrontSide()
-{
- basegfx::B3DPolyPolygon aRetval;
-
- if(maExtrudePolygon.count())
- {
- basegfx::B2DPolyPolygon aTemp(maExtrudePolygon);
- aTemp.removeDoublePoints();
- aTemp = basegfx::tools::correctOrientations(aTemp);
- const basegfx::B2VectorOrientation aOrient = basegfx::tools::getOrientation(aTemp.getB2DPolygon(0L));
-
- if(basegfx::ORIENTATION_POSITIVE == aOrient)
- {
- aTemp.flip();
- }
-
- aRetval = basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(aTemp);
- }
-
- return aRetval;
-}
-
-basegfx::B3DPolyPolygon E3dExtrudeObj::GetBackSide(const basegfx::B3DPolyPolygon& rFrontSide)
-{
- basegfx::B3DPolyPolygon aBackSide(rFrontSide);
-
- if(GetExtrudeDepth() != 0)
- {
- // eventuell Skalieren
- if(GetPercentBackScale() != 100)
- {
- // #i74056#
- aBackSide = ImpScalePoly(aBackSide, (double)GetPercentBackScale() / 100.0);
- }
-
- // Verschieben
- basegfx::B3DHomMatrix aTrans;
- aTrans.translate(0.0, 0.0, (double)GetExtrudeDepth());
- aBackSide.transform(aTrans);
- }
-
- return aBackSide;
-}
-
-/*************************************************************************
-|*
-|* Give out simple line geometry
-|*
-\************************************************************************/
-
-basegfx::B3DPolyPolygon E3dExtrudeObj::Get3DLineGeometry() const
-{
- return maLinePolyPolygon;
-}
-
-void E3dExtrudeObj::CreateGeometry()
-{
- // Start der Geometrieerzeugung ankuendigen
- StartCreateGeometry();
-
- // #78972# prepare new line geometry creation
- maLinePolyPolygon.clear();
-
- // Polygon als Grundlage holen
- basegfx::B3DPolyPolygon aFrontSide(GetFrontSide());
-
- if(aFrontSide.count())
- {
- if(GetExtrudeDepth() != 0)
- {
- // Hinteres Polygon erzeugen
- basegfx::B3DPolyPolygon aBackSide(GetBackSide(aFrontSide));
-
- // Was muss erzeugt werden?
- if(!aFrontSide.isClosed())
- {
- GetProperties().SetObjectItemDirect(Svx3DDoubleSidedItem(TRUE));
- }
-
- double fTextureDepth(1.0);
- double fTextureStart(0.0);
-
- // Texturen erzeugen?
- if(!GetCreateTexture())
- {
- fTextureStart = fTextureDepth = 0.0;
- }
-
- // Falls Texturen erzeugen Randbreite fuer diese bestimmen
- double fSurroundFactor(1.0);
-
- if(GetCreateTexture())
- {
- const basegfx::B3DPolygon aFirstPolygon(aFrontSide.getB3DPolygon(0L));
- const double fLength(basegfx::tools::getLength(aFirstPolygon));
- const double fArea(basegfx::tools::getArea(aFirstPolygon));
- fSurroundFactor = fLength / sqrt(fArea);
- fSurroundFactor = (double)((long)(fSurroundFactor - 0.5));
- if(fSurroundFactor == 0.0)
- fSurroundFactor = 1.0;
- }
-
- // #i28528#
- basegfx::B3DPolyPolygon aFrontLines;
- basegfx::B3DPolyPolygon aBackLines;
- basegfx::B3DPolyPolygon aInBetweenLines;
-
- // Segment erzeugen
- ImpCreateSegment(
- aFrontSide,
- aBackSide,
- 0L,
- 0L,
- GetCloseFront(), // #107245# bExtrudeCloseFront,
- GetCloseBack(), // #107245# bExtrudeCloseBack,
- (double)GetPercentDiagonal() / 200.0,
- GetSmoothNormals(), // #107245# GetExtrudeSmoothed(),
- GetSmoothNormals(), // #107245# GetExtrudeSmoothed(),
- GetSmoothLids(), // #107245# GetExtrudeSmoothFrontBack(),
- fSurroundFactor,
- fTextureStart,
- fTextureDepth,
- GetCreateNormals(),
- GetCreateTexture(),
- GetCharacterMode(), // #107245# bExtrudeCharacterMode,
- FALSE,
- // #78972#
- &aFrontLines,
- &aBackLines,
- &aInBetweenLines);
-
- // #78972#
- // Simply add them for Extrudes
- maLinePolyPolygon.append(aFrontLines);
- maLinePolyPolygon.append(aInBetweenLines);
- maLinePolyPolygon.append(aBackLines);
- }
- else
- {
- // nur ein Polygon erzeugen
- GetProperties().SetObjectItemDirect(Svx3DDoubleSidedItem(TRUE));
-
- // Fuer evtl. selbst erzeugte Normalen
- basegfx::B3DPolyPolygon aNormalsFront(ImpCreateByPattern(aFrontSide));
-
- // Extrudevektor bilden
- basegfx::B3DVector aNormal(0.0, 0.0, (double)GetExtrudeDepth());
-
- // Normalen und Vorderseite selbst erzeugen
- aNormalsFront = ImpAddFrontNormals(aNormalsFront, aNormal);
- ImpCreateFront(aFrontSide, aNormalsFront, GetCreateNormals(), GetCreateTexture());
-
- // #78972#
- maLinePolyPolygon.append(aFrontSide);
- }
-
- // #i28528#
- if(!GetReducedLineGeometry())
- {
- basegfx::B3DPolyPolygon aNewPolyPoly(ImpCompleteLinePolygon(maLinePolyPolygon, aFrontSide.count(), sal_False));
- // append horizontal lines
- maLinePolyPolygon.append(aNewPolyPoly);
- }
-
- //ImpCorrectLinePolygon(maLinePolyPolygon, aFrontSide.count());
- }
-
- // call parent
- E3dCompoundObject::CreateGeometry();
-}
-
-/*************************************************************************
-|*
|* Identifier zurueckgeben
|*
\************************************************************************/
@@ -318,9 +139,6 @@ void E3dExtrudeObj::operator=(const SdrObject& rObj)
const E3dExtrudeObj& r3DObj = (const E3dExtrudeObj&)rObj;
maExtrudePolygon = r3DObj.maExtrudePolygon;
-
- // #95519# copy LinePolygon info, too
- maLinePolyPolygon = r3DObj.maLinePolyPolygon;
}
/*************************************************************************
@@ -334,7 +152,7 @@ void E3dExtrudeObj::SetExtrudePolygon(const basegfx::B2DPolyPolygon &rNew)
if(maExtrudePolygon != rNew)
{
maExtrudePolygon = rNew;
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -382,22 +200,68 @@ BOOL E3dExtrudeObj::IsBreakObjPossible()
SdrAttrObj* E3dExtrudeObj::GetBreakObj()
{
- // create PathObj
- basegfx::B2DPolyPolygon aPoly = TransformToScreenCoor(GetBackSide(GetFrontSide()));
- SdrPathObj* pPathObj = new SdrPathObj(OBJ_PLIN, aPoly);
+ basegfx::B3DPolyPolygon aFrontSide;
+ basegfx::B3DPolyPolygon aBackSide;
- if(pPathObj)
+ if(maExtrudePolygon.count())
{
- // Attribute setzen
- SfxItemSet aSet(GetObjectItemSet());
+ basegfx::B2DPolyPolygon aTemp(maExtrudePolygon);
+ aTemp.removeDoublePoints();
+ aTemp = basegfx::tools::correctOrientations(aTemp);
+ const basegfx::B2VectorOrientation aOrient = basegfx::tools::getOrientation(aTemp.getB2DPolygon(0L));
+
+ if(basegfx::ORIENTATION_POSITIVE == aOrient)
+ {
+ aTemp.flip();
+ }
+
+ aFrontSide = basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(aTemp);
+ }
+
+ if(aFrontSide.count())
+ {
+ aBackSide = aFrontSide;
- // Linien aktivieren, um Objekt garantiert sichtbar zu machen
- aSet.Put(XLineStyleItem(XLINE_SOLID));
+ if(GetExtrudeDepth())
+ {
+ basegfx::B3DHomMatrix aTransform;
+
+ if(100 != GetPercentBackScale())
+ {
+ // scale polygon from center
+ const double fScaleFactor(GetPercentBackScale() / 100.0);
+ const basegfx::B3DRange aPolyPolyRange(basegfx::tools::getRange(aBackSide));
+ const basegfx::B3DPoint aCenter(aPolyPolyRange.getCenter());
+
+ aTransform.translate(-aCenter.getX(), -aCenter.getY(), -aCenter.getZ());
+ aTransform.scale(fScaleFactor, fScaleFactor, fScaleFactor);
+ aTransform.translate(aCenter.getX(), aCenter.getY(), aCenter.getZ());
+ }
+
+ // translate by extrude depth
+ aTransform.translate(0.0, 0.0, (double)GetExtrudeDepth());
+
+ aBackSide.transform(aTransform);
+ }
+ }
+
+ if(aBackSide.count())
+ {
+ // create PathObj
+ basegfx::B2DPolyPolygon aPoly = TransformToScreenCoor(aBackSide);
+ SdrPathObj* pPathObj = new SdrPathObj(OBJ_PLIN, aPoly);
+
+ if(pPathObj)
+ {
+ SfxItemSet aSet(GetObjectItemSet());
+ aSet.Put(XLineStyleItem(XLINE_SOLID));
+ pPathObj->SetMergedItemSet(aSet);
+ }
- pPathObj->SetMergedItemSet(aSet);
+ return pPathObj;
}
- return pPathObj;
+ return 0;
}
// eof
diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx
index c4f007e5fb..02a0cf267b 100644
--- a/svx/source/engine3d/float3d.cxx
+++ b/svx/source/engine3d/float3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: float3d.cxx,v $
- * $Revision: 1.27 $
+ * $Revision: 1.27.226.1 $
*
* This file is part of OpenOffice.org.
*
@@ -236,7 +236,6 @@ __EXPORT Svx3DWin::Svx3DWin( SfxBindings* pInBindings,
aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ),
aCtlLightPreview ( this, SVX_RES( CTL_LIGHT_PREVIEW ) ),
- pLightGroup ( NULL ),
aImgLightOn ( SVX_RES( RID_SVXIMAGE_LIGHT_ON ) ),
aImgLightOff ( SVX_RES( RID_SVXIMAGE_LIGHT_OFF ) ),
@@ -400,9 +399,9 @@ __EXPORT Svx3DWin::Svx3DWin( SfxBindings* pInBindings,
// Preview-Callback
aLink = LINK( this, Svx3DWin, ChangeLightCallbackHdl );
- aCtlLightPreview.SetUserInteractiveChangeCallback( aLink );
+ aCtlLightPreview.SetUserInteractiveChangeCallback(aLink);
aLink = LINK( this, Svx3DWin, ChangeSelectionCallbackHdl );
- aCtlLightPreview.SetUserSelectionChangeCallback( aLink );
+ aCtlLightPreview.SetUserSelectionChangeCallback(aLink);
aSize = GetOutputSizePixel();
SetMinOutputSizePixel( aSize );
@@ -433,8 +432,6 @@ __EXPORT Svx3DWin::~Svx3DWin()
delete pConvertTo3DItem;
delete pConvertTo3DLatheItem;
- delete pLightGroup;
-
if(mpRemember2DAttributes)
delete mpRemember2DAttributes;
@@ -447,10 +444,7 @@ void Svx3DWin::Construct()
aBtnGeo.Check();
Link aLink( LINK( this, Svx3DWin, ClickViewTypeHdl ) );
aLink.Call( &aBtnGeo );
-
aCtlLightPreview.Hide();
- pLightGroup = new B3dLightGroup();
- *pLightGroup = *aCtlLightPreview.GetPreviewControl().GetLightGroup();
}
// -----------------------------------------------------------------------
@@ -464,7 +458,7 @@ void Svx3DWin::Reset()
ClickUpdateHdl( NULL );
// Nichts selektieren, um Fehler beim erstselektieren zu vermeiden
- aCtlLightPreview.GetPreviewControl().SelectLight(Base3DLight0);
+ aCtlLightPreview.GetSvx3DLightControl().SelectLight(0);
}
bool Svx3DWin::GetUILightState( ImageButton& aBtn ) const
@@ -640,7 +634,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
{
aNumHorizontal.SetValue( nValue );
// evtl. am Ende...
- aCtlLightPreview.GetPreviewControl().SetHorizontalSegments( (UINT16)nValue );
+ // aCtlLightPreview.GetSvx3DLightControl().SetHorizontalSegments( (UINT16)nValue );
bUpdate = TRUE;
}
else if( aNumHorizontal.IsEmptyFieldValue() )
@@ -667,8 +661,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
{
aNumVertical.SetValue( nValue );
// evtl. am Ende...
- aCtlLightPreview.GetPreviewControl().SetVerticalSegments( (UINT16)nValue );
- //aCtlPreview.SetVerticalSegments( (UINT16)nValue );
+ //aCtlLightPreview.GetSvx3DLightControl().SetVerticalSegments( (UINT16)nValue );
bUpdate = TRUE;
}
else if( aNumVertical.IsEmptyFieldValue() )
@@ -1006,8 +999,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
-
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight0 );
bUpdate = TRUE;
}
}
@@ -1028,7 +1019,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight1 )) )
{
SetUILightState( aBtnLight1, bOn );
- pLightGroup->Enable( bOn, Base3DLight0 );
bUpdate = TRUE;
}
if( aBtnLight1.GetState() == STATE_DONTKNOW )
@@ -1046,13 +1036,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_1);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection1Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight0 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight0 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Licht 2 (Farbe)
@@ -1064,8 +1048,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
-
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight1 );
bUpdate = TRUE;
}
}
@@ -1086,7 +1068,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight2 )) )
{
SetUILightState( aBtnLight2, bOn );
- pLightGroup->Enable( bOn, Base3DLight1 );
bUpdate = TRUE;
}
if( aBtnLight2.GetState() == STATE_DONTKNOW )
@@ -1104,13 +1085,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_2);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection2Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight1 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight1 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Licht 3 (Farbe)
@@ -1122,8 +1097,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight2 );
-
bUpdate = TRUE;
}
}
@@ -1144,7 +1117,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight3)) )
{
SetUILightState( aBtnLight3, bOn );
- pLightGroup->Enable( bOn, Base3DLight2 );
bUpdate = TRUE;
}
if( aBtnLight3.GetState() == STATE_DONTKNOW )
@@ -1162,13 +1134,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_3);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection3Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight2 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight2 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Licht 4 (Farbe)
@@ -1180,8 +1146,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight3 );
-
bUpdate = TRUE;
}
}
@@ -1202,7 +1166,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight4 )) )
{
SetUILightState( aBtnLight4, bOn );
- pLightGroup->Enable( bOn, Base3DLight3 );
bUpdate = TRUE;
}
if( aBtnLight4.GetState() == STATE_DONTKNOW )
@@ -1220,13 +1183,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_4);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection4Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight3 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight3 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Licht 5 (Farbe)
@@ -1238,8 +1195,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight4 );
-
bUpdate = TRUE;
}
}
@@ -1260,7 +1215,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight5 )) )
{
SetUILightState( aBtnLight5, bOn );
- pLightGroup->Enable( bOn, Base3DLight4 );
bUpdate = TRUE;
}
if( aBtnLight5.GetState() == STATE_DONTKNOW )
@@ -1278,13 +1232,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_5);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection5Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight4 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight4 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Licht 6 (Farbe)
@@ -1296,8 +1244,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight5 );
-
bUpdate = TRUE;
}
}
@@ -1318,7 +1264,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight6 )) )
{
SetUILightState( aBtnLight6, bOn );
- pLightGroup->Enable( bOn, Base3DLight5 );
bUpdate = TRUE;
}
if( aBtnLight6.GetState() == STATE_DONTKNOW )
@@ -1336,13 +1281,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_6);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection6Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight5 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight5 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Licht 7 (Farbe)
@@ -1354,8 +1293,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight6 );
-
bUpdate = TRUE;
}
}
@@ -1376,7 +1313,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight7 )) )
{
SetUILightState( aBtnLight7 , bOn );
- pLightGroup->Enable( bOn, Base3DLight6 );
bUpdate = TRUE;
}
if( aBtnLight7.GetState() == STATE_DONTKNOW )
@@ -1394,13 +1330,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_7);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection7Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight6 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight6 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Licht 8 (Farbe)
@@ -1412,8 +1342,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
- pLightGroup->SetIntensity( aColor, Base3DMaterialDiffuse, Base3DLight7 );
-
bUpdate = TRUE;
}
}
@@ -1434,7 +1362,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
( !bOn && GetUILightState( aBtnLight8 )) )
{
SetUILightState( aBtnLight8, bOn );
- pLightGroup->Enable( bOn, Base3DLight7 );
bUpdate = TRUE;
}
if( aBtnLight8.GetState() == STATE_DONTKNOW )
@@ -1452,13 +1379,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_8);
if( eState != SFX_ITEM_DONTCARE )
{
- aVector = ((const Svx3DLightDirection8Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8)).GetValue();
- basegfx::B3DVector aVector2 = pLightGroup->GetDirection( Base3DLight7 );
- if( aVector != aVector2 )
- {
- pLightGroup->SetDirection( aVector, Base3DLight7 );
- bUpdate = TRUE;
- }
+ bUpdate = TRUE;
}
// Umgebungslicht
@@ -1470,8 +1391,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
- pLightGroup->SetGlobalAmbientLight( aColor );
-
bUpdate = TRUE;
}
}
@@ -1630,7 +1549,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SFX_ITEM_DONTCARE )
{
aColor = ((const XFillColorItem&)rAttrs.Get(XATTR_FILLCOLOR)).GetColorValue();
- aCtlLightPreview.GetPreviewControl().SetMaterial( aColor, Base3DMaterialDiffuse );
ColorLB* pLb = &aLbMatColor;
if( aColor != pLb->GetSelectEntryColor() )
{
@@ -1652,7 +1570,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SFX_ITEM_DONTCARE )
{
aColor = ((const Svx3DMaterialEmissionItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_EMISSION)).GetValue();
- aCtlLightPreview.GetPreviewControl().SetMaterial( aColor, Base3DMaterialEmission );
ColorLB* pLb = &aLbMatEmission;
if( aColor != pLb->GetSelectEntryColor() )
{
@@ -1674,7 +1591,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SFX_ITEM_DONTCARE )
{
aColor = ((const Svx3DMaterialSpecularItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR)).GetValue();
- aCtlLightPreview.GetPreviewControl().SetMaterial( aColor, Base3DMaterialSpecular );
ColorLB* pLb = &aLbMatSpecular;
if( aColor != pLb->GetSelectEntryColor() )
{
@@ -1696,7 +1612,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SFX_ITEM_DONTCARE )
{
UINT16 nValue = ((const Svx3DMaterialSpecularIntensityItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY)).GetValue();
- aCtlLightPreview.GetPreviewControl().SetShininess( nValue );
if( nValue != aMtrMatSpecularIntensity.GetValue() )
{
aMtrMatSpecularIntensity.SetValue( nValue );
@@ -1749,8 +1664,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( bUpdate || bOnly3DChanged )
{
// Preview updaten
- aCtlLightPreview.GetPreviewControl().SetLightGroup( pLightGroup );
-
SfxItemSet aSet(rAttrs);
// set LineStyle hard to XLINE_NONE when it's not set so that
@@ -1764,6 +1677,32 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
aSet.Put(XFillColorItem(String(), Color(COL_WHITE)));
aCtlPreview.Set3DAttributes(aSet);
+ aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes(aSet);
+
+ // try to select light corresponding to active button
+ sal_uInt32 nNumber(0xffffffff);
+
+ if(aBtnLight1.IsChecked())
+ nNumber = 0;
+ else if(aBtnLight2.IsChecked())
+ nNumber = 1;
+ else if(aBtnLight3.IsChecked())
+ nNumber = 2;
+ else if(aBtnLight4.IsChecked())
+ nNumber = 3;
+ else if(aBtnLight5.IsChecked())
+ nNumber = 4;
+ else if(aBtnLight6.IsChecked())
+ nNumber = 5;
+ else if(aBtnLight7.IsChecked())
+ nNumber = 6;
+ else if(aBtnLight8.IsChecked())
+ nNumber = 7;
+
+ if(nNumber != 0xffffffff)
+ {
+ aCtlLightPreview.GetSvx3DLightControl().SelectLight(nNumber);
+ }
}
// handle state of converts possible
@@ -1774,9 +1713,6 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
// -----------------------------------------------------------------------
void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
{
- // 2D-Attribute und alle anderen holen
-// rAttrs.Put( aCtlPreview.Get3DAttributes() );
-
// get remembered 2d attributes from the dialog
if(mpRemember2DAttributes)
{
@@ -1974,6 +1910,8 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
Image aImg;
basegfx::B3DVector aVector;
Color aColor;
+ const SfxItemSet aLightItemSet(aCtlLightPreview.GetSvx3DLightControl().Get3DAttributes());
+
// Licht 1 Farbe
if( aLbLight1.GetSelectEntryCount() )
{
@@ -1992,8 +1930,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 1 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight0 );
- rAttrs.Put(Svx3DLightDirection1Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1));
}
}
else
@@ -2018,8 +1955,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 2 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight1 );
- rAttrs.Put(Svx3DLightDirection2Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2));
}
}
else
@@ -2043,8 +1979,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 3 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight2 );
- rAttrs.Put(Svx3DLightDirection3Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3));
}
}
else
@@ -2068,8 +2003,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 4 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight3 );
- rAttrs.Put(Svx3DLightDirection4Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4));
}
}
else
@@ -2093,8 +2027,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 5 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight4 );
- rAttrs.Put(Svx3DLightDirection5Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5));
}
}
else
@@ -2118,8 +2051,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 6 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight5 );
- rAttrs.Put(Svx3DLightDirection6Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6));
}
}
else
@@ -2143,8 +2075,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 7 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight6 );
- rAttrs.Put(Svx3DLightDirection7Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7));
}
}
else
@@ -2168,8 +2099,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Licht 8 (Richtung)
if( bValue )
{
- aVector = pLightGroup->GetDirection( Base3DLight7 );
- rAttrs.Put(Svx3DLightDirection8Item(aVector));
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8));
}
}
else
@@ -2958,30 +2888,12 @@ IMPL_LINK( Svx3DWin, SelectHdl, void *, p )
p == &aLbMatEmission ||
p == &aLbMatSpecular )
{
- aColor = ( ( (ColorLB*)p )->GetSelectEntryColor() );
-
- Base3DMaterialValue eType = Base3DMaterialDiffuse;
- //if( p == &aLbMatColor )
- if( p == &aLbMatEmission )
- eType = Base3DMaterialEmission;
- else if( p == &aLbMatSpecular )
- eType = Base3DMaterialSpecular;
-
- //aCtlPreview.SetMaterial( aColor, eType );
- aCtlLightPreview.GetPreviewControl().SetMaterial( aColor, eType );
-
aLbMatFavorites.SelectEntryPos( 0 );
-
bUpdatePreview = TRUE;
}
// Beleuchtung
else if( p == &aLbAmbientlight )
{
- Color aColor2 = aLbAmbientlight.GetSelectEntryColor();
- pLightGroup->SetGlobalAmbientLight( aColor2 );
-
- aCtlLightPreview.GetPreviewControl().SetLightGroup( pLightGroup );
- //aCtlPreview.SetLightGroup( pLightGroup );
bUpdatePreview = TRUE;
}
else if( p == &aLbLight1 ||
@@ -2993,17 +2905,6 @@ IMPL_LINK( Svx3DWin, SelectHdl, void *, p )
p == &aLbLight7 ||
p == &aLbLight8 )
{
- Color aColor2 = ( (ColorLB*)p )->GetSelectEntryColor();
- USHORT nLightSource = GetLightSource();
-
- *pLightGroup = *aCtlLightPreview.GetPreviewControl().GetLightGroup();
-
- pLightGroup->SetIntensity( aColor2,
- Base3DMaterialDiffuse,
- (Base3DLightNumber) nLightSource );
-
- aCtlLightPreview.GetPreviewControl().SetLightGroup( pLightGroup );
- //aCtlPreview.SetLightGroup( pLightGroup );
bUpdatePreview = TRUE;
}
else if( p == &aLbShademode )
@@ -3025,27 +2926,20 @@ IMPL_LINK( Svx3DWin, ModifyHdl, void*, pField )
// Material
if( pField == &aMtrMatSpecularIntensity )
{
- UINT16 nValue = (UINT16) ( (MetricField*)pField )->GetValue();
- //aCtlPreview.SetShininess( nValue );
- aCtlLightPreview.GetPreviewControl().SetShininess( nValue );
bUpdatePreview = TRUE;
}
else if( pField == &aNumHorizontal )
{
- UINT16 nValue = (UINT16) ( (NumericField*)pField )->GetValue();
- aCtlLightPreview.GetPreviewControl().SetHorizontalSegments( nValue );
- //aCtlPreview.SetHorizontalSegments( nValue );
bUpdatePreview = TRUE;
}
else if( pField == &aNumVertical )
{
- UINT16 nValue = (UINT16) ( (NumericField*)pField )->GetValue();
- aCtlLightPreview.GetPreviewControl().SetVerticalSegments( nValue );
- //aCtlPreview.SetVerticalSegments( nValue );
bUpdatePreview = TRUE;
}
else if( pField == &aMtrSlant )
+ {
bUpdatePreview = TRUE;
+ }
if( bUpdatePreview == TRUE )
UpdatePreview();
@@ -3063,19 +2957,25 @@ IMPL_LINK( Svx3DWin, ClickLightHdl, PushButton*, pBtn )
USHORT nLightSource = GetLightSource( pBtn );
ColorLB* pLb = GetLbByButton( pBtn );
Color aColor( pLb->GetSelectEntryColor() );
- *pLightGroup = *aCtlLightPreview.GetPreviewControl().GetLightGroup();
+ SfxItemSet aLightItemSet(aCtlLightPreview.GetSvx3DLightControl().Get3DAttributes());
+ const bool bOnOff(GetUILightState( *(ImageButton*)pBtn ));
- pLightGroup->SetIntensity( aColor,
- Base3DMaterialDiffuse,
- (Base3DLightNumber) nLightSource );
-
- pLightGroup->Enable( GetUILightState( *(ImageButton*)pBtn ), (Base3DLightNumber) nLightSource );
+ switch(nLightSource)
+ {
+ case 0: aLightItemSet.Put(Svx3DLightcolor1Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff1Item(bOnOff)); break;
+ case 1: aLightItemSet.Put(Svx3DLightcolor2Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff2Item(bOnOff)); break;
+ case 2: aLightItemSet.Put(Svx3DLightcolor3Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff3Item(bOnOff)); break;
+ case 3: aLightItemSet.Put(Svx3DLightcolor4Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff4Item(bOnOff)); break;
+ case 4: aLightItemSet.Put(Svx3DLightcolor5Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff5Item(bOnOff)); break;
+ case 5: aLightItemSet.Put(Svx3DLightcolor6Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff6Item(bOnOff)); break;
+ case 6: aLightItemSet.Put(Svx3DLightcolor7Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff7Item(bOnOff)); break;
+ default:
+ case 7: aLightItemSet.Put(Svx3DLightcolor8Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff8Item(bOnOff)); break;
+ }
- aCtlLightPreview.GetPreviewControl().SetLightGroup( pLightGroup );
- aCtlLightPreview.GetPreviewControl().SelectLight( (Base3DLightNumber) nLightSource );
+ aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes(aLightItemSet);
+ aCtlLightPreview.GetSvx3DLightControl().SelectLight(nLightSource);
aCtlLightPreview.CheckSelection();
-
- //aCtlPreview.SetLightGroup( pLightGroup );
}
return( 0L );
}
@@ -3099,9 +2999,6 @@ IMPL_LINK( Svx3DWin, DoubleClickHdl, void*, EMPTYARG )
IMPL_LINK( Svx3DWin, ChangeLightCallbackHdl, void*, EMPTYARG )
{
- *pLightGroup = *aCtlLightPreview.GetPreviewControl().GetLightGroup();
- //aCtlPreview.SetLightGroup( pLightGroup );
-
return( 0L );
}
@@ -3110,11 +3007,10 @@ IMPL_LINK( Svx3DWin, ChangeLightCallbackHdl, void*, EMPTYARG )
IMPL_LINK( Svx3DWin, ChangeSelectionCallbackHdl, void*, EMPTYARG )
{
- Base3DLightNumber eLight = aCtlLightPreview.GetPreviewControl().GetSelectedLight();
-
- PushButton* pBtn = NULL;
+ const sal_uInt32 nLight(aCtlLightPreview.GetSvx3DLightControl().GetSelectedLight());
+ PushButton* pBtn = 0;
- switch( eLight )
+ switch( nLight )
{
case 0: pBtn = &aBtnLight1; break;
case 1: pBtn = &aBtnLight2; break;
@@ -3233,6 +3129,7 @@ void Svx3DWin::UpdatePreview()
// Attribute holen und im Preview setzen
GetAttr( aSet );
aCtlPreview.Set3DAttributes( aSet );
+ aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes( aSet );
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx
new file mode 100644
index 0000000000..1067fbf776
--- /dev/null
+++ b/svx/source/engine3d/helperhittest3d.cxx
@@ -0,0 +1,443 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: helperhittest3d.cxx,v $
+ * $Revision: 1.1.2.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/helperhittest3d.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/scene3d.hxx>
+#include <svditer.hxx>
+#include <drawinglayer/processor3d/baseprocessor3d.hxx>
+#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
+#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
+#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <basegfx/polygon/b3dpolygontools.hxx>
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
+#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
+#include <com/sun/star/uno/Sequence.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+class ImplPairDephAndObject
+{
+private:
+ const E3dCompoundObject* mpObject;
+ double mfDepth;
+
+public:
+ ImplPairDephAndObject(const E3dCompoundObject* pObject, double fDepth)
+ : mpObject(pObject),
+ mfDepth(fDepth)
+ {}
+
+ // for ::std::sort
+ bool operator<(const ImplPairDephAndObject& rComp) const
+ {
+ return (mfDepth < rComp.mfDepth);
+ }
+
+ // data read access
+ const E3dCompoundObject* getObject() const { return mpObject; }
+ double getDepth() const { return mfDepth; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ class CutFindProcessor : public BaseProcessor3D
+ {
+ private:
+ // the start and stop point for the cut vector
+ basegfx::B3DPoint maFront;
+ basegfx::B3DPoint maBack;
+
+ // the found cut points
+ ::std::vector< basegfx::B3DPoint > mo_rResult;
+
+ // as tooling, the process() implementation takes over API handling and calls this
+ // virtual render method when the primitive implementation is BasePrimitive3D-based.
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
+ public:
+ CutFindProcessor(const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B3DPoint& rFront,
+ const basegfx::B3DPoint& rBack)
+ : BaseProcessor3D(rViewInformation),
+ maFront(rFront),
+ maBack(rBack),
+ mo_rResult()
+ {}
+
+ // data access
+ const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return mo_rResult; }
+ };
+
+ void CutFindProcessor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate)
+ {
+ // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch
+ switch(rCandidate.getPrimitiveID())
+ {
+ case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D :
+ {
+ // transform group. Remember current transformations
+ const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(rCandidate);
+ const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D());
+
+ // remember old and transform front, back to object coordinates
+ const basegfx::B3DPoint aLastFront(maFront);
+ const basegfx::B3DPoint aLastBack(maBack);
+ basegfx::B3DHomMatrix aInverseTrans(rPrimitive.getTransformation());
+ aInverseTrans.invert();
+ maFront *= aInverseTrans;
+ maBack *= aInverseTrans;
+
+ // create new transformation; add new object transform from right side
+ const geometry::ViewInformation3D aNewViewInformation3D(
+ aLastViewInformation3D.getObjectTransformation() * rPrimitive.getTransformation(),
+ aLastViewInformation3D.getOrientation(),
+ aLastViewInformation3D.getProjection(),
+ aLastViewInformation3D.getDeviceToView(),
+ aLastViewInformation3D.getViewTime(),
+ aLastViewInformation3D.getExtendedInformationSequence());
+ updateViewInformation(aNewViewInformation3D);
+
+ // let break down
+ process(rPrimitive.getChildren());
+
+ // restore transformations and front, back
+ updateViewInformation(aLastViewInformation3D);
+ maFront = aLastFront;
+ maBack = aLastBack;
+ break;
+ }
+ case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D :
+ {
+ // PolygonHairlinePrimitive3D, not used for hit test with planes, ignore. This
+ // means that also thick line expansion will not be hit-tested as
+ // PolyPolygonMaterialPrimitive3D
+ break;
+ }
+ case PRIMITIVE3D_ID_HITTESTPRIMITIVE3D :
+ {
+ // HitTestPrimitive3D, force usage due to we are doing a hit test and this
+ // primitive only gets generated on 3d objects without fill, exactly for this
+ // purpose
+ const primitive3d::HitTestPrimitive3D& rPrimitive = static_cast< const primitive3d::HitTestPrimitive3D& >(rCandidate);
+ process(rPrimitive.getChildren());
+ break;
+ }
+ case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
+ {
+ // PolyPolygonMaterialPrimitive3D
+ const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rCandidate);
+
+ if(!maFront.equal(maBack))
+ {
+ const basegfx::B3DPolyPolygon& rPolyPolygon = rPrimitive.getB3DPolyPolygon();
+ const sal_uInt32 nPolyCount(rPolyPolygon.count());
+
+ if(nPolyCount)
+ {
+ const basegfx::B3DPolygon aPolygon(rPolyPolygon.getB3DPolygon(0));
+ const sal_uInt32 nPointCount(aPolygon.count());
+
+ if(nPointCount > 2)
+ {
+ const basegfx::B3DVector aPlaneNormal(aPolygon.getNormal());
+
+ if(!aPlaneNormal.equalZero())
+ {
+ const basegfx::B3DPoint aPointOnPlane(aPolygon.getB3DPoint(0));
+ double fCut(0.0);
+
+ if(basegfx::tools::getCutBetweenLineAndPlane(aPlaneNormal, aPointOnPlane, maFront, maBack, fCut))
+ {
+ const basegfx::B3DPoint aCutPoint(basegfx::interpolate(maFront, maBack, fCut));
+
+ if(basegfx::tools::isInside(rPolyPolygon, aCutPoint, false))
+ {
+ mo_rResult.push_back(aCutPoint);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ break;
+ }
+ default :
+ {
+ // process recursively
+ process(rCandidate.get3DDecomposition(getViewInformation3D()));
+ break;
+ }
+ }
+ }
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+void getAllHit3DObjectWithRelativePoint(
+ const basegfx::B3DPoint& rFront,
+ const basegfx::B3DPoint& rBack,
+ const E3dCompoundObject& rObject,
+ const drawinglayer::geometry::ViewInformation3D& rObjectViewInformation3D,
+ ::std::vector< basegfx::B3DPoint >& o_rResult)
+{
+ o_rResult.clear();
+
+ if(!rFront.equal(rBack))
+ {
+ // rObject is a E3dCompoundObject, so it cannot be a scene (which is a E3dObject)
+ const sdr::contact::ViewContactOfE3d& rVCObject = static_cast< sdr::contact::ViewContactOfE3d& >(rObject.GetViewContact());
+ const drawinglayer::primitive3d::Primitive3DSequence aPrimitives(rVCObject.getViewIndependentPrimitive3DSequence());
+
+ if(aPrimitives.hasElements())
+ {
+ // make BoundVolume empty and overlapping test for speedup
+ const basegfx::B3DRange aObjectRange(drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aPrimitives, rObjectViewInformation3D));
+
+ if(!aObjectRange.isEmpty())
+ {
+ const basegfx::B3DRange aFrontBackRange(rFront, rBack);
+
+ if(aObjectRange.overlaps(aFrontBackRange))
+ {
+ // bound volumes hit, geometric cut tests needed
+ drawinglayer::processor3d::CutFindProcessor aCutFindProcessor(rObjectViewInformation3D, rFront, rBack);
+ aCutFindProcessor.process(aPrimitives);
+ o_rResult = aCutFindProcessor.getCutPoints();
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+E3dScene* fillViewInformation3DForCompoundObject(drawinglayer::geometry::ViewInformation3D& o_rViewInformation3D, const E3dCompoundObject& rCandidate)
+{
+ // Search for root scene (outmost scene) of the 3d object since e.g. in chart, multiple scenes may
+ // be placed between object and outmost scene. On that search, remember the in-between scene's
+ // transformation for the correct complete ObjectTransformation. For historical reasons, the
+ // root scene's own object transformation is part of the scene's ViewTransformation, o do not
+ // add it. For more details, see ViewContactOfE3dScene::createViewInformation3D.
+ E3dScene* pParentScene = dynamic_cast< E3dScene* >(rCandidate.GetParentObj());
+ E3dScene* pRootScene = 0;
+ basegfx::B3DHomMatrix aInBetweenSceneMatrix;
+
+ while(pParentScene)
+ {
+ E3dScene* pParentParentScene = dynamic_cast< E3dScene* >(pParentScene->GetParentObj());
+
+ if(pParentParentScene)
+ {
+ // pParentScene is a in-between scene
+ aInBetweenSceneMatrix = pParentScene->GetTransform() * aInBetweenSceneMatrix;
+ }
+ else
+ {
+ // pParentScene is the root scene
+ pRootScene = pParentScene;
+ }
+
+ pParentScene = pParentParentScene;
+ }
+
+ if(pRootScene)
+ {
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+
+ if(aInBetweenSceneMatrix.isIdentity())
+ {
+ o_rViewInformation3D = rVCScene.getViewInformation3D();
+ }
+ else
+ {
+ // build new ViewInformation containing all transforms for the candidate
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+
+ o_rViewInformation3D = drawinglayer::geometry::ViewInformation3D(
+ aViewInfo3D.getObjectTransformation() * aInBetweenSceneMatrix,
+ aViewInfo3D.getOrientation(),
+ aViewInfo3D.getProjection(),
+ aViewInfo3D.getDeviceToView(),
+ aViewInfo3D.getViewTime(),
+ aViewInfo3D.getExtendedInformationSequence());
+ }
+ }
+ else
+ {
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ o_rViewInformation3D = drawinglayer::geometry::ViewInformation3D(aEmptyParameters);
+ }
+
+ return pRootScene;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SVX_DLLPUBLIC void getAllHit3DObjectsSortedFrontToBack(
+ const basegfx::B2DPoint& rPoint,
+ const E3dScene& rScene,
+ ::std::vector< const E3dCompoundObject* >& o_rResult)
+{
+ o_rResult.clear();
+ SdrObjList* pList = rScene.GetSubList();
+
+ if(pList && pList->GetObjCount())
+ {
+ // prepare relative HitPoint. To do so, get the VC of the 3DScene and from there
+ // the Scene's 2D transformation. Multiplying with the inverse transformation
+ // will create a point relative to the 3D scene as unit-2d-object
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rScene.GetViewContact());
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+ aInverseSceneTransform.invert();
+ const basegfx::B2DPoint aRelativePoint(aInverseSceneTransform * rPoint);
+
+ // check if test point is inside scene's area at all
+ if(aRelativePoint.getX() >= 0.0 && aRelativePoint.getX() <= 1.0 && aRelativePoint.getY() >= 0.0 && aRelativePoint.getY() <= 1.0)
+ {
+ SdrObjListIter aIterator(*pList, IM_DEEPNOGROUPS);
+ ::std::vector< ImplPairDephAndObject > aDepthAndObjectResults;
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+
+ while(aIterator.IsMore())
+ {
+ const E3dCompoundObject* pCandidate = dynamic_cast< const E3dCompoundObject* >(aIterator.Next());
+
+ if(pCandidate)
+ {
+ fillViewInformation3DForCompoundObject(aViewInfo3D, *pCandidate);
+
+ // create HitPoint Front and Back, transform to object coordinates
+ basegfx::B3DHomMatrix aViewToObject(aViewInfo3D.getObjectToView());
+ aViewToObject.invert();
+ const basegfx::B3DPoint aFront(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 0.0));
+ const basegfx::B3DPoint aBack(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 1.0));
+
+ if(!aFront.equal(aBack))
+ {
+ // get all hit points with object
+ ::std::vector< basegfx::B3DPoint > aHitsWithObject;
+ getAllHit3DObjectWithRelativePoint(aFront, aBack, *pCandidate, aViewInfo3D, aHitsWithObject);
+
+ if(aHitsWithObject.size())
+ {
+ const basegfx::B3DPoint aPointInViewCoordinates(aViewInfo3D.getObjectToView() * aHitsWithObject[0]);
+ aDepthAndObjectResults.push_back(ImplPairDephAndObject(pCandidate, aPointInViewCoordinates.getZ()));
+ }
+ }
+ }
+ }
+
+ // fill nRetval
+ const sal_uInt32 nCount(aDepthAndObjectResults.size());
+
+ if(nCount)
+ {
+ // sort aDepthAndObjectResults by depth
+ ::std::sort(aDepthAndObjectResults.begin(), aDepthAndObjectResults.end());
+
+ // copy SdrObject pointers to return result set
+ ::std::vector< ImplPairDephAndObject >::iterator aIterator2(aDepthAndObjectResults.begin());
+
+ for(;aIterator2 != aDepthAndObjectResults.end(); aIterator2++)
+ {
+ o_rResult.push_back(aIterator2->getObject());
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+bool checkHitSingle3DObject(
+ const basegfx::B2DPoint& rPoint,
+ const E3dCompoundObject& rCandidate)
+{
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, rCandidate);
+
+ if(pRootScene)
+ {
+ // prepare relative HitPoint. To do so, get the VC of the 3DScene and from there
+ // the Scene's 2D transformation. Multiplying with the inverse transformation
+ // will create a point relative to the 3D scene as unit-2d-object
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+ aInverseSceneTransform.invert();
+ const basegfx::B2DPoint aRelativePoint(aInverseSceneTransform * rPoint);
+
+ // check if test point is inside scene's area at all
+ if(aRelativePoint.getX() >= 0.0 && aRelativePoint.getX() <= 1.0 && aRelativePoint.getY() >= 0.0 && aRelativePoint.getY() <= 1.0)
+ {
+ // create HitPoint Front and Back, transform to object coordinates
+ basegfx::B3DHomMatrix aViewToObject(aViewInfo3D.getObjectToView());
+ aViewToObject.invert();
+ const basegfx::B3DPoint aFront(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 0.0));
+ const basegfx::B3DPoint aBack(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 1.0));
+
+ if(!aFront.equal(aBack))
+ {
+ // get all hit points with object
+ ::std::vector< basegfx::B3DPoint > aHitsWithObject;
+ getAllHit3DObjectWithRelativePoint(aFront, aBack, rCandidate, aViewInfo3D, aHitsWithObject);
+
+ if(aHitsWithObject.size())
+ {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/engine3d/helperminimaldepth3d.cxx b/svx/source/engine3d/helperminimaldepth3d.cxx
new file mode 100644
index 0000000000..9c31d2ef5e
--- /dev/null
+++ b/svx/source/engine3d/helperminimaldepth3d.cxx
@@ -0,0 +1,215 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: helperminimaldepth3d.cxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <helperminimaldepth3d.hxx>
+#include <drawinglayer/processor3d/baseprocessor3d.hxx>
+#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
+#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
+#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/scene3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ class MinimalDephInViewExtractor : public BaseProcessor3D
+ {
+ private:
+ // the value which will be fetched as result
+ double mfMinimalDepth;
+
+ // as tooling, the process() implementation takes over API handling and calls this
+ // virtual render method when the primitive implementation is BasePrimitive3D-based.
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
+ public:
+ MinimalDephInViewExtractor(const geometry::ViewInformation3D& rViewInformation)
+ : BaseProcessor3D(rViewInformation),
+ mfMinimalDepth(DBL_MAX)
+ {}
+
+ // data access
+ double getMinimalDepth() const { return mfMinimalDepth; }
+ };
+
+ void MinimalDephInViewExtractor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate)
+ {
+ // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch
+ switch(rCandidate.getPrimitiveID())
+ {
+ case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D :
+ {
+ // transform group. Remember current transformations
+ const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(rCandidate);
+ const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D());
+
+ // create new transformation; add new object transform from right side
+ const geometry::ViewInformation3D aNewViewInformation3D(
+ aLastViewInformation3D.getObjectTransformation() * rPrimitive.getTransformation(),
+ aLastViewInformation3D.getOrientation(),
+ aLastViewInformation3D.getProjection(),
+ aLastViewInformation3D.getDeviceToView(),
+ aLastViewInformation3D.getViewTime(),
+ aLastViewInformation3D.getExtendedInformationSequence());
+ updateViewInformation(aNewViewInformation3D);
+
+ // let break down
+ process(rPrimitive.getChildren());
+
+ // restore transformations
+ updateViewInformation(aLastViewInformation3D);
+ break;
+ }
+ case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D :
+ {
+ // PolygonHairlinePrimitive3D
+ const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(rCandidate);
+ const basegfx::B3DPolygon& rPolygon = rPrimitive.getB3DPolygon();
+ const sal_uInt32 nCount(rPolygon.count());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ const basegfx::B3DPoint aPointInView(getViewInformation3D().getObjectToView() * rPolygon.getB3DPoint(a));
+
+ if(aPointInView.getZ() < mfMinimalDepth)
+ {
+ mfMinimalDepth = aPointInView.getZ();
+ }
+ }
+
+ break;
+ }
+ case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
+ {
+ // PolyPolygonMaterialPrimitive3D
+ const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rCandidate);
+ const basegfx::B3DPolyPolygon& rPolyPolygon = rPrimitive.getB3DPolyPolygon();
+ const sal_uInt32 nPolyCount(rPolyPolygon.count());
+
+ for(sal_uInt32 a(0); a < nPolyCount; a++)
+ {
+ const basegfx::B3DPolygon aPolygon(rPolyPolygon.getB3DPolygon(a));
+ const sal_uInt32 nCount(aPolygon.count());
+
+ for(sal_uInt32 b(0); b < nCount; b++)
+ {
+ const basegfx::B3DPoint aPointInView(getViewInformation3D().getObjectToView() * aPolygon.getB3DPoint(b));
+
+ if(aPointInView.getZ() < mfMinimalDepth)
+ {
+ mfMinimalDepth = aPointInView.getZ();
+ }
+ }
+ }
+
+ break;
+ }
+ default :
+ {
+ // process recursively
+ process(rCandidate.get3DDecomposition(getViewInformation3D()));
+ break;
+ }
+ }
+ }
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// changed to create values using VCs, Primitive3DSequence and ViewInformation3D to allow
+// removal of old 3D bucket geometry. There is one slight difference in the result, it's
+// in [0.0 .. 1.0] for Z-Depth since the scaling of the scene as 2D object is no longer
+// part of the 3D transformations. This could be added since the ViewContactOfE3dScene is
+// given, but is not needed since the permutation of the depth values needs only be correct
+// relative to each other
+
+double getMinimalDepthInViewCoordinates(const E3dCompoundObject& rObject)
+{
+ // this is a E3dCompoundObject, so it cannot be a scene (which is a E3dObject).
+ // Get primitive sequence using VC
+ const sdr::contact::ViewContactOfE3d& rVCObject = static_cast< sdr::contact::ViewContactOfE3d& >(rObject.GetViewContact());
+ const drawinglayer::primitive3d::Primitive3DSequence aPrimitives = rVCObject.getViewIndependentPrimitive3DSequence();
+ double fRetval(DBL_MAX);
+
+ if(aPrimitives.hasElements())
+ {
+ const E3dScene* pScene = rObject.GetScene();
+
+ if(pScene)
+ {
+ // get ViewInformation3D from scene using VC
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+
+ // the scene's object transformation is already part of aViewInfo3D.getObjectTransformation()
+ // for historical reasons (see ViewContactOfE3dScene::createViewInformation3D for more info)
+ // and the object's transform is part of aPrimitives (and taken into account when decomposing
+ // to PolygonHairlinePrimitive3D and PolyPolygonMaterialPrimitive3D). The missing part may be
+ // some Scene SdrObjects lying in-between which may need to be added. This is e.g. used in chart,
+ // and generally allowed in 3d scenes an their 3d object hierarchy
+ basegfx::B3DHomMatrix aInBetweenSceneMatrix;
+ E3dScene* pParentScene = dynamic_cast< E3dScene* >(rObject.GetParentObj());
+
+ while(pParentScene && pParentScene != pScene)
+ {
+ aInBetweenSceneMatrix = pParentScene->GetTransform() * aInBetweenSceneMatrix;
+ pParentScene = dynamic_cast< E3dScene* >(pParentScene->GetParentObj());
+ }
+
+ // build new ViewInformation containing all transforms
+ const drawinglayer::geometry::ViewInformation3D aNewViewInformation3D(
+ aViewInfo3D.getObjectTransformation() * aInBetweenSceneMatrix,
+ aViewInfo3D.getOrientation(),
+ aViewInfo3D.getProjection(),
+ aViewInfo3D.getDeviceToView(),
+ aViewInfo3D.getViewTime(),
+ aViewInfo3D.getExtendedInformationSequence());
+
+ // create extractor helper, proccess geometry and get return value
+ drawinglayer::processor3d::MinimalDephInViewExtractor aExtractor(aNewViewInformation3D);
+ aExtractor.process(aPrimitives);
+ fRetval = aExtractor.getMinimalDepth();
+ }
+ }
+
+ return fRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/engine3d/helperminimaldepth3d.hxx b/svx/source/engine3d/helperminimaldepth3d.hxx
new file mode 100644
index 0000000000..6e3ea4b581
--- /dev/null
+++ b/svx/source/engine3d/helperminimaldepth3d.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: helperminimaldepth3d.hxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SVX_HELPERMINIMALDEPTH_HXX
+#define INCLUDED_SVX_HELPERMINIMALDEPTH_HXX
+
+#include <sal/types.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class E3dCompoundObject;
+class E3dScene;
+
+//////////////////////////////////////////////////////////////////////////////
+/** support extracting the minimal depth of a 3d object in it's scene
+
+ @param rObject
+ The 3D Object from which the minimal depth needs to be calculated. The scene
+ is defined by the object already
+
+ @return
+ The minimal depth of this object in unified ViewCoordinates. This is the
+ Z-Coordinate of one object point in the range of [0.0 .. 1.0]. ViewCoordinates
+ means the transformations (esp. rotation) of the scene are taken into account
+
+*/
+// support extracting the minimal depth of a 3d object in it's scene
+
+double getMinimalDepthInViewCoordinates(const E3dCompoundObject& rObject);
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_SVX_HELPERMINIMALDEPTH_HXX
+
+// eof
diff --git a/svx/source/engine3d/lathe3d.cxx b/svx/source/engine3d/lathe3d.cxx
index 4e78fcf17b..40acc800c4 100644
--- a/svx/source/engine3d/lathe3d.cxx
+++ b/svx/source/engine3d/lathe3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: lathe3d.cxx,v $
- * $Revision: 1.27 $
+ * $Revision: 1.27.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -102,9 +102,6 @@ E3dLatheObj::E3dLatheObj(E3dDefaultAttributes& rDefault, const basegfx::B2DPolyP
GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(nSegCnt));
}
-
- // Geometrie erzeugen
- CreateGeometry();
}
/*************************************************************************
@@ -132,310 +129,6 @@ void E3dLatheObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
/*************************************************************************
|*
-|* Give out simple line geometry
-|*
-\************************************************************************/
-
-basegfx::B3DPolyPolygon E3dLatheObj::Get3DLineGeometry() const
-{
- return maLinePolyPolygon;
-}
-
-/*************************************************************************
-|*
-|* Die eigentliche Konstruktionmethode, erzeugt einen Koerper durch
-|* Rotation des uebergebenen Polygons um die senkrechte Y-Achse. Wenn
-|* nEndAngle < 3600 ist, werden ausserdem zwei Deckelflaechen-Polygone
-|* erzeugt, die den Koerper abschliessen. Das Polygon sollte in der
-|* XY-Ebene liegen, mit X-Koordinaten >= 0; wenn die Anfangs- und End-
-|* X-Koordinaten nicht 0 sind, sollte das Polygon geschlossen sein.
-|* Wenn bDblSided TRUE ist, werden die Rotationsflaechen doppelseitig
-|* angelegt und keine Deckelflaechen erzeugt.
-|*
-\************************************************************************/
-
-// Geometrieerzeugung
-void E3dLatheObj::CreateGeometry()
-{
- // Start der Geometrieerzeugung ankuendigen
- StartCreateGeometry();
-
- // #78972#
- maLinePolyPolygon.clear();
-
- if(maPolyPoly2D.count())
- {
- // Polygon erzeugen
- // Eventuelle Anpassung der Segmentanzahlen
- basegfx::B2DPolyPolygon aLathePoly2D(CreateLathePolyPoly(maPolyPoly2D, GetVerticalSegments()));
- aLathePoly2D = basegfx::tools::correctOrientations(aLathePoly2D);
- const basegfx::B2VectorOrientation aOrient = basegfx::tools::getOrientation(aLathePoly2D.getB2DPolygon(0L));
-
- if(basegfx::ORIENTATION_NEGATIVE == aOrient)
- {
- aLathePoly2D.flip();
- }
-
- // #i28528#
- basegfx::B3DPolyPolygon aFrontLines;
- basegfx::B3DPolyPolygon aBackLines;
- basegfx::B3DPolyPolygon aInBetweenLines;
- basegfx::B3DPolyPolygon aLathePoly3D(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(aLathePoly2D));
-
- // Spezialfall Einzelnes Polygon erzeugen
- BOOL bSinglePoly = (GetEndAngle() == 0 || GetHorizontalSegments() == 0);
- if(bSinglePoly)
- {
- // nur ein Polygon erzeugen
- GetProperties().SetObjectItemDirect(Svx3DDoubleSidedItem(TRUE));
-
- // Fuer evtl. selbst erzeugte Normalen
- basegfx::B3DPolyPolygon aNormalsFront(ImpCreateByPattern(aLathePoly3D));
-
- // Normalen und Vorderseite selbst erzeugen
- aNormalsFront = ImpAddFrontNormals(aNormalsFront, basegfx::B3DVector(0.0, 0.0, 1.0));
- ImpCreateFront(aLathePoly3D, aNormalsFront, GetCreateNormals(), GetCreateTexture());
-
- // #i28528#
- aInBetweenLines.append(aLathePoly3D);
- }
- else
- {
- // Eventuell doppelseitig erzeugen?
- if(!aLathePoly3D.isClosed())
- {
- GetProperties().SetObjectItemDirect(Svx3DDoubleSidedItem(TRUE));
- }
-
- // Seiten genenrieren?
- BOOL bCreateSides = ((GetEndAngle() < 3600 && !GetDoubleSided()) || (GetBackScale() != 100));
-
- // Polygone vorbereiten
- basegfx::B3DPolyPolygon aPrev, aFront, aBack, aNext;
-
- // Rotation vorbereiten
- double fAng = DEG2RAD(double(GetEndAngle()) / 10);
- basegfx::B3DHomMatrix aRotMat;
-
- // Skalierung vorbereiten
- double fScalePerStep(1.0);
-
- if(GetBackScale() != 100)
- {
- fScalePerStep = (((double)GetBackScale() - 100.0) / 100.0) / (double)GetHorizontalSegments();
- }
-
- // Texturen erzeugen?
- double fTextureDepth(1.0);
- double fTextureStart(0.0);
-
- if(!GetCreateTexture())
- {
- fTextureStart = fTextureDepth = 0.0;
- }
-
- // aPrev bis aBack ausfuellen als Startvorbereitung
- aRotMat.rotate(0.0, -(fAng / (double)GetHorizontalSegments()), 0.0);
- aPrev = aLathePoly3D;
- aPrev.transform(aRotMat);
- if(GetBackScale() != 100)
- {
- // #i74056#
- aPrev = ImpScalePoly(aPrev, 1.0 - fScalePerStep);
- }
- aRotMat.identity();
- aRotMat.rotate(0.0, fAng / (double)GetHorizontalSegments(), 0.0);
- aFront = aLathePoly3D;
- aBack = aLathePoly3D;
- aBack.transform(aRotMat);
- if(GetBackScale() != 100)
- {
- // #i74056#
- aBack = ImpScalePoly(aBack, 1.0 + fScalePerStep);
- }
-
- // Werte fuer Textur-Zwischensegmenterzeugung berechnen
- double fTmpStart(0.0);
- double fTmpLength(fTextureDepth / (double)GetHorizontalSegments());
- sal_uInt16 nUpperBound((sal_uInt16)GetHorizontalSegments());
-
- for(UINT16 a=0;a<nUpperBound;a++)
- {
- // Naechstes Polygon vorbereiten
- aNext = aLathePoly3D;
-
- // Rotieren
- if(!(a+2 == nUpperBound && GetEndAngle() == 3600))
- {
- aRotMat.identity();
- aRotMat.rotate(0.0, (fAng * (double)(a+2))/ (double)nUpperBound, 0.0);
- aNext.transform(aRotMat);
- }
-
- // Skalieren
- if(GetBackScale() != 100)
- {
- // #i74056#
- aNext = ImpScalePoly(aNext, 1.0 + (fScalePerStep * (double)(a+2)));
- }
-
- // Jetzt Segment erzeugen
- ImpCreateSegment(
- aFront,
- aBack,
- &aPrev,
- &aNext,
- (a == 0) && bCreateSides && GetCloseFront(), // #107245# bLatheCloseFront,
- (a == nUpperBound-1) && bCreateSides && GetCloseBack(), // #107245# bLatheCloseBack,
- ((double)GetPercentDiagonal() / 200.0)
- * (double(nUpperBound) / 6.0),
- GetSmoothNormals(), // #107245# GetLatheSmoothed(),
- GetSmoothNormals(), // #107245# GetLatheSmoothed(),
- GetSmoothLids(), // #107245# GetLatheSmoothFrontBack(),
- 1.0,
- fTmpStart,
- fTmpLength,
- GetCreateTexture(),
- GetCreateNormals(),
- GetCharacterMode(), // #107245# GetLatheCharacterMode(),
- TRUE,
- // #78972#
- &aFrontLines,
- &aBackLines,
- &aInBetweenLines);
-
- // naechsten Schritt vorbereiten
- fTmpStart += fTmpLength;
- aPrev = aFront;
- aFront = aBack;
- aBack = aNext;
- }
- }
-
- // #78972#
- // Simply add them for preparing line geometry
- maLinePolyPolygon.append(aFrontLines);
- maLinePolyPolygon.append(aInBetweenLines);
- maLinePolyPolygon.append(aBackLines);
-
- // #i28528#
- sal_Bool bClosedLines((3600 == GetEndAngle()) && (100 == GetBackScale()));
- basegfx::B3DPolyPolygon aNewPolyPoly(ImpCompleteLinePolygon(maLinePolyPolygon, aLathePoly3D.count(), bClosedLines));
-
- if(GetReducedLineGeometry())
- {
- // replace vertical with horizontal lines
- maLinePolyPolygon = aNewPolyPoly;
-
- // append front lines
- maLinePolyPolygon.append(aFrontLines);
-
- // append back lines
- maLinePolyPolygon.append(aBackLines);
- }
- else
- {
- // append horizontal lines
- maLinePolyPolygon.append(aNewPolyPoly);
- }
-
- //ImpCorrectLinePolygon(maLinePolyPolygon, aLathePoly3D.count());
- }
-
- // call parent
- E3dCompoundObject::CreateGeometry();
-}
-
-basegfx::B2DPolyPolygon E3dLatheObj::CreateLathePolyPoly(const basegfx::B2DPolyPolygon& rPolyPoly2D, sal_uInt32 nVSegs)
-{
- basegfx::B2DPolyPolygon aRetval(rPolyPoly2D);
- const sal_uInt32 nCnt(aRetval.count());
- const basegfx::B2DPolygon aFirstOriginal(aRetval.getB2DPolygon(0L));
- sal_uInt32 nOrigSegmentCnt(aFirstOriginal.count());
-
- if(nOrigSegmentCnt && !aFirstOriginal.isClosed())
- {
- nOrigSegmentCnt -= 1;
- }
-
- if(nVSegs && nVSegs != nOrigSegmentCnt)
- {
- // make sure minimum is not too small, 3 edges for closed
- // and 2 edges for open obects
- sal_uInt32 nMinVSegs(aFirstOriginal.isClosed() ? 3L : 2L);
-
- if(nVSegs <= nMinVSegs)
- {
- nVSegs = nMinVSegs;
- }
-
- if(nVSegs != nOrigSegmentCnt)
- {
- // Erstes Polygon anpassen
- aRetval.setB2DPolygon(0L, CreateLathePoly(aRetval.getB2DPolygon(0L), nVSegs));
- GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(nVSegs));
-
- // andere Polygone im richtigen Verhaeltnis anpassen,
- // aber nur, wenn Wert fuer erstes angepasst werden musste
- for(sal_uInt32 i(1L); i < nCnt; i++ )
- {
- basegfx::B2DPolygon aPoly2D(aRetval.getB2DPolygon(i));
- sal_uInt32 nSegCnt(aPoly2D.count());
-
- if(nSegCnt && !aPoly2D.isClosed())
- {
- nSegCnt -= 1;
- }
-
- sal_uInt32 nNewVSegs((nSegCnt * nVSegs) / nOrigSegmentCnt);
-
- // make sure min is not too small for subpolys, too
- if(nNewVSegs <= nMinVSegs)
- {
- nNewVSegs = nMinVSegs;
- }
-
- if(nNewVSegs && nNewVSegs != nSegCnt)
- {
- aRetval.setB2DPolygon(i, CreateLathePoly(aPoly2D, nNewVSegs));
- }
- }
- }
- }
-
- return aRetval;
-}
-
-basegfx::B2DPolygon E3dLatheObj::CreateLathePoly(const basegfx::B2DPolygon& rPoly2D, sal_uInt32 nVSegs)
-{
- // attention: Here number of SEGMENTS is given, while GetExpandedPolygon()
- // takes number of points. Calc PntNum first
- sal_uInt32 nNumPts(rPoly2D.isClosed() ? nVSegs : nVSegs + 1L);
-
- if(nNumPts && rPoly2D.count() && nNumPts != rPoly2D.count())
- {
- // create a expanded or compresssed poly with exactly nNum Points
- basegfx::B2DPolygon aRetval;
- const double fLength(basegfx::tools::getLength(rPoly2D));
- const double fDivisor(rPoly2D.isClosed() ? ((double)nNumPts) : ((double)(nNumPts - 1L)));
-
- for(sal_uInt32 a(0L); a < nNumPts; a++)
- {
- const double fRelativePos((double)a / fDivisor); // 0.0 .. 1.0 for open, less for closed (without 1.0 e.g. last point)
- const basegfx::B2DPoint aNewPoint(basegfx::tools::getPositionRelative(rPoly2D, fRelativePos, fLength));
- aRetval.append(aNewPoint);
- }
-
- // copy closed flag
- aRetval.setClosed(rPoly2D.isClosed());
- return aRetval;
- }
-
- return rPoly2D;
-}
-
-/*************************************************************************
-|*
|* Identifier zurueckgeben
|*
\************************************************************************/
@@ -460,9 +153,6 @@ void E3dLatheObj::operator=(const SdrObject& rObj)
const E3dLatheObj& r3DObj = (const E3dLatheObj&)rObj;
maPolyPoly2D = r3DObj.maPolyPoly2D;
-
- // #95519# copy LinePolygon info, too
- maLinePolyPolygon = r3DObj.maLinePolyPolygon;
}
/*************************************************************************
@@ -490,7 +180,7 @@ void E3dLatheObj::ReSegment(sal_uInt32 nHSegs, sal_uInt32 nVSegs)
GetProperties().SetObjectItemDirect(Svx3DHorizontalSegmentsItem(nHSegs));
GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(nVSegs));
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
@@ -520,7 +210,7 @@ void E3dLatheObj::SetPolyPoly2D(const basegfx::B2DPolyPolygon& rNew)
GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(nSegCnt));
}
- bGeometryValid = FALSE;
+ ActionChanged();
}
}
diff --git a/svx/source/engine3d/makefile.mk b/svx/source/engine3d/makefile.mk
index 18ed727628..4c03f949e9 100644
--- a/svx/source/engine3d/makefile.mk
+++ b/svx/source/engine3d/makefile.mk
@@ -8,7 +8,7 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.15 $
+# $Revision: 1.15.18.1 $
#
# This file is part of OpenOffice.org.
#
@@ -43,6 +43,9 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
SLOFILES= \
+ $(SLO)$/e3dsceneupdater.obj \
+ $(SLO)$/helperminimaldepth3d.obj \
+ $(SLO)$/helperhittest3d.obj \
$(SLO)$/obj3d.obj \
$(SLO)$/scene3d.obj \
$(SLO)$/polysc3d.obj \
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 3de91a701b..1e16058af6 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: obj3d.cxx,v $
- * $Revision: 1.48 $
+ * $Revision: 1.48.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,7 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-
#include "svdstr.hrc"
#include "svdglob.hxx"
#include <svx/svdview.hxx>
@@ -52,8 +51,6 @@
#include <svx/xflclit.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
-#include <goodies/base3d.hxx>
-#include <goodies/b3dtex.hxx>
#include <svx/xlnclit.hxx>
#include <svtools/metitem.hxx>
#include <svx/xtable.hxx>
@@ -87,9 +84,20 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/polygon/b3dpolygontools.hxx>
+#include <svx/helperhittest3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
+#include <svx/e3dsceneupdater.hxx>
#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
/*************************************************************************
|*
|* Liste fuer 3D-Objekte
@@ -131,34 +139,51 @@ void E3dObjList::NbcInsertObject(SdrObject* pObj, ULONG nPos, const SdrInsertRea
}
}
+void E3dObjList::InsertObject(SdrObject* pObj, ULONG nPos, const SdrInsertReason* pReason)
+{
+ OSL_ENSURE(GetOwnerObj()->ISA(E3dObject), "Insert 3DObject in non-3D Parent");
+ //E3DModifySceneSnapRectUpdater aUpdater(GetOwnerObj());
+
+ // call parent
+ SdrObjList::InsertObject(pObj, nPos, pReason);
+
+ E3dScene* pScene = ((E3dObject*)GetOwnerObj())->GetScene();
+ if(pScene)
+ {
+ pScene->Cleanup3DDepthMapper();
+ }
+}
+
SdrObject* E3dObjList::NbcRemoveObject(ULONG nObjNum)
{
- // Owner holen
DBG_ASSERT(GetOwnerObj()->ISA(E3dObject), "AW: Entfernen 3DObject aus Parent != 3DObject");
- //E3dObject* pOwner = (E3dObject*)GetOwnerObj();
+ //E3DModifySceneSnapRectUpdater aUpdater(GetOwnerObj());
// call parent
SdrObject* pRetval = SdrObjList::NbcRemoveObject(nObjNum);
- // FitSnapRectToBoundVol vorbereiten
- if(GetOwnerObj() && GetOwnerObj()->ISA(E3dScene))
- ((E3dScene*)GetOwnerObj())->CorrectSceneDimensions();
+ E3dScene* pScene = ((E3dObject*)GetOwnerObj())->GetScene();
+ if(pScene)
+ {
+ pScene->Cleanup3DDepthMapper();
+ }
return pRetval;
}
SdrObject* E3dObjList::RemoveObject(ULONG nObjNum)
{
- // Owner holen
- DBG_ASSERT(GetOwnerObj()->ISA(E3dObject), "AW: Entfernen 3DObject aus Parent != 3DObject");
- //E3dObject* pOwner = (E3dObject*)GetOwnerObj();
+ OSL_ENSURE(GetOwnerObj()->ISA(E3dObject), "3DObject is removed from non-3D Parent");
+ //E3DModifySceneSnapRectUpdater aUpdater(GetOwnerObj());
// call parent
SdrObject* pRetval = SdrObjList::RemoveObject(nObjNum);
- // FitSnapRectToBoundVol vorbereiten
- if(GetOwnerObj() && GetOwnerObj()->ISA(E3dScene))
- ((E3dScene*)GetOwnerObj())->CorrectSceneDimensions();
+ E3dScene* pScene = ((E3dObject*)GetOwnerObj())->GetScene();
+ if(pScene)
+ {
+ pScene->Cleanup3DDepthMapper();
+ }
return pRetval;
}
@@ -180,16 +205,18 @@ sdr::properties::BaseProperties* E3dObject::CreateObjectSpecificProperties()
TYPEINIT1(E3dObject, SdrAttrObj);
-E3dObject::E3dObject() :
- bTfHasChanged(TRUE),
- bBoundVolValid(TRUE),
- bIsSelected(FALSE)
+E3dObject::E3dObject()
+: maSubList(),
+ maLocalBoundVol(),
+ maTransformation(),
+ maFullTransform(),
+ mbTfHasChanged(true),
+ mbIsSelected(false)
{
- bIs3DObj = TRUE;
- pSub = new E3dObjList(NULL, NULL);
- pSub->SetOwnerObj(this);
- pSub->SetListKind(SDROBJLIST_GROUPOBJ);
- bClosedObj = TRUE;
+ bIs3DObj = true;
+ maSubList.SetOwnerObj(this);
+ maSubList.SetListKind(SDROBJLIST_GROUPOBJ);
+ bClosedObj = true;
}
/*************************************************************************
@@ -200,8 +227,6 @@ E3dObject::E3dObject() :
E3dObject::~E3dObject()
{
- delete pSub;
- pSub = NULL;
}
/*************************************************************************
@@ -210,16 +235,21 @@ E3dObject::~E3dObject()
|*
\************************************************************************/
-void E3dObject::SetSelected(BOOL bNew)
+void E3dObject::SetSelected(bool bNew)
{
- // selbst setzen
- bIsSelected = bNew;
+ if((bool)mbIsSelected != bNew)
+ {
+ mbIsSelected = bNew;
+ }
- // bei SubObjekten setzen
- for ( ULONG i = 0; i < pSub->GetObjCount(); i++ )
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
{
- if(pSub->GetObj(i) && pSub->GetObj(i)->ISA(E3dObject))
- ((E3dObject*)pSub->GetObj(i))->SetSelected(bNew);
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
+
+ if(pCandidate)
+ {
+ pCandidate->SetSelected(bNew);
+ }
}
}
@@ -250,14 +280,13 @@ void E3dObject::SetRectsDirty(sal_Bool bNotMyself)
// call parent
SdrAttrObj::SetRectsDirty(bNotMyself);
- // Eigene SubListe AUCH behandeln
- if(pSub && pSub->GetObjCount())
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
{
- for (ULONG i = 0; i < pSub->GetObjCount(); i++)
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
+
+ if(pCandidate)
{
- SdrObject* pObj = pSub->GetObj(i);
- DBG_ASSERT(pObj->ISA(E3dObject), "AW: In E3dObject sind nur 3D-Objekte erlaubt!");
- ((E3dObject*)pObj)->SetRectsDirty(bNotMyself);
+ pCandidate->SetRectsDirty(bNotMyself);
}
}
}
@@ -320,7 +349,6 @@ void E3dObject::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
// Problem.
rInfo.bCanConvToPoly = FALSE;
rInfo.bCanConvToContour = FALSE;
-
rInfo.bCanConvToPathLineToArea = FALSE;
rInfo.bCanConvToPolyLineToArea = FALSE;
}
@@ -335,11 +363,15 @@ void E3dObject::NbcSetLayer(SdrLayerID nLayer)
{
SdrAttrObj::NbcSetLayer(nLayer);
- E3dObjList* pOL = pSub;
- ULONG nObjCnt = pOL->GetObjCount();
- ULONG i;
- for ( i = 0; i < nObjCnt; i++ )
- pOL->GetObj(i)->NbcSetLayer(nLayer);
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
+ {
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
+
+ if(pCandidate)
+ {
+ pCandidate->NbcSetLayer(nLayer);
+ }
+ }
}
/*************************************************************************
@@ -351,7 +383,7 @@ void E3dObject::NbcSetLayer(SdrLayerID nLayer)
void E3dObject::SetObjList(SdrObjList* pNewObjList)
{
SdrObject::SetObjList(pNewObjList);
- pSub->SetUpList(pNewObjList);
+ maSubList.SetUpList(pNewObjList);
}
/*************************************************************************
@@ -363,7 +395,7 @@ void E3dObject::SetObjList(SdrObjList* pNewObjList)
void E3dObject::SetPage(SdrPage* pNewPage)
{
SdrAttrObj::SetPage(pNewPage);
- pSub->SetPage(pNewPage);
+ maSubList.SetPage(pNewPage);
}
/*************************************************************************
@@ -375,7 +407,7 @@ void E3dObject::SetPage(SdrPage* pNewPage)
void E3dObject::SetModel(SdrModel* pNewModel)
{
SdrAttrObj::SetModel(pNewModel);
- pSub->SetModel(pNewModel);
+ maSubList.SetModel(pNewModel);
}
/*************************************************************************
@@ -391,35 +423,45 @@ void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fracti
if(pScene)
{
- // pos ermitteln
- B3dTransformationSet& rTransSet = pScene->GetCameraSet();
- basegfx::B3DPoint aScaleCenter((double)rRef.X(), (double)rRef.Y(), 32768.0);
- aScaleCenter = rTransSet.ViewToEyeCoor(aScaleCenter);
+ // transform pos from 2D world to 3D eye
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ basegfx::B2DPoint aScaleCenter2D((double)rRef.X(), (double)rRef.Y());
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+
+ aInverseSceneTransform.invert();
+ aScaleCenter2D = aInverseSceneTransform * aScaleCenter2D;
+
+ basegfx::B3DPoint aScaleCenter3D(aScaleCenter2D.getX(), aScaleCenter2D.getY(), 0.5);
+ basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
+
+ aInverseViewToEye.invert();
+ aScaleCenter3D = aInverseViewToEye * aScaleCenter3D;
// scale-faktoren holen
double fScaleX(xFact);
double fScaleY(yFact);
// build transform
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
basegfx::B3DHomMatrix mFullTransform(GetFullTransform());
basegfx::B3DHomMatrix mTrans(mFullTransform);
- mTrans *= rTransSet.GetOrientation();
- mTrans.translate(-aScaleCenter.getX(), -aScaleCenter.getY(), -aScaleCenter.getZ());
+ mTrans *= aViewInfo3D.getOrientation();
+ mTrans.translate(-aScaleCenter3D.getX(), -aScaleCenter3D.getY(), -aScaleCenter3D.getZ());
mTrans.scale(fScaleX, fScaleY, 1.0);
- mTrans.translate(aScaleCenter.getX(), aScaleCenter.getY(), aScaleCenter.getZ());
- mTrans *= rTransSet.GetInvOrientation();
+ mTrans.translate(aScaleCenter3D.getX(), aScaleCenter3D.getY(), aScaleCenter3D.getZ());
+ mTrans *= aInverseOrientation;
mFullTransform.invert();
mTrans *= mFullTransform;
// anwenden
basegfx::B3DHomMatrix mObjTrans(GetTransform());
mObjTrans *= mTrans;
+
+ E3DModifySceneSnapRectUpdater aUpdater(this);
SetTransform(mObjTrans);
-
- // force new camera and SnapRect on scene, geometry may have really
- // changed
- pScene->CorrectSceneDimensions();
}
}
@@ -446,31 +488,33 @@ void E3dObject::NbcMove(const Size& rSize)
mInvDispTransform.invert();
}
- // BoundVolume von Weltkoordinaten in Eye-Koordinaten
- B3dTransformationSet& rTransSet = pScene->GetCameraSet();
- const Volume3D& rVol = pScene->GetBoundVolume();
- Volume3D aEyeVol = rVol.GetTransformVolume(rTransSet.GetOrientation());
+ // BoundVolume from 3d world to 3d eye
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ basegfx::B3DRange aEyeVol(pScene->GetBoundVolume());
+ aEyeVol.transform(aViewInfo3D.getOrientation());
- // relativen Bewegungsvektor in Augkoordinaten bilden
+ // build relative movement vector in eye coordinates
basegfx::B3DPoint aMove(
(double)rSize.Width() * aEyeVol.getWidth() / (double)aRect.GetWidth(),
(double)-rSize.Height() * aEyeVol.getHeight() / (double)aRect.GetHeight(),
0.0);
+ basegfx::B3DPoint aPos(0.0, 0.0, 0.0);
+
+ // movement vektor to local coordinates of objects' parent
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+ basegfx::B3DHomMatrix aCompleteTrans(mInvDispTransform * aInverseOrientation);
- // Bewegungsvektor in lokale Koordinaten des Parents des Objektes
- basegfx::B3DPoint aPos;
- aMove = rTransSet.EyeToWorldCoor(aMove);
- aMove *= mInvDispTransform;
- aPos = rTransSet.EyeToWorldCoor(aPos);
- aPos *= mInvDispTransform;
- aMove = aMove - aPos;
+ aMove = aCompleteTrans * aMove;
+ aPos = aCompleteTrans * aPos;
- // Transformieren
- Translate(aMove);
+ // build transformation and apply
+ basegfx::B3DHomMatrix aTranslate;
+ aTranslate.translate(aMove.getX() - aPos.getX(), aMove.getY() - aPos.getY(), aMove.getZ() - aPos.getZ());
- // force new camera and SnapRect on scene, geometry may have really
- // changed
- pScene->CorrectSceneDimensions();
+ E3DModifySceneSnapRectUpdater aUpdater(pScene);
+ SetTransform(aTranslate * GetTransform());
}
}
@@ -482,55 +526,7 @@ void E3dObject::NbcMove(const Size& rSize)
SdrObjList* E3dObject::GetSubList() const
{
- return pSub;
-}
-
-/*************************************************************************
-|*
-|* Anzahl der Handles zurueckgeben
-|*
-\************************************************************************/
-
-sal_uInt32 E3dObject::GetHdlCount() const
-{
- // 8 Eckpunkte + 1 E3dVolumeMarker (= Wireframe-Darstellung)
- return 9L;
-}
-
-/*************************************************************************
-|*
-|* Handle-Liste fuellen
-|*
-\************************************************************************/
-
-void E3dObject::AddToHdlList(SdrHdlList& rHdlList) const
-{
- const basegfx::B2DPolyPolygon aPolyPoly(ImpCreateWireframePoly());
- const sal_uInt32 nPolyCount(aPolyPoly.count());
-
- for(sal_uInt32 a(0L); a < nPolyCount; a += 3L)
- {
- const basegfx::B2DPolygon aPoly(aPolyPoly.getB2DPolygon(a));
- const basegfx::B2DPoint aPointA(aPoly.getB2DPoint(0L));
- const basegfx::B2DPoint aPointB(aPoly.getB2DPoint(1L));
- rHdlList.AddHdl(new SdrHdl(Point(FRound(aPointA.getX()), FRound(aPointA.getY())), HDL_BWGT));
- rHdlList.AddHdl(new SdrHdl(Point(FRound(aPointB.getX()), FRound(aPointB.getY())), HDL_BWGT));
- }
-
- if(nPolyCount)
- {
- E3dVolumeMarker* pVolMarker = new E3dVolumeMarker(aPolyPoly);
- rHdlList.AddHdl(pVolMarker);
- }
-}
-
-/*************************************************************************
-|*
-\************************************************************************/
-
-FASTBOOL E3dObject::HasSpecialDrag() const
-{
- return TRUE;
+ return &(const_cast< E3dObjList& >(maSubList));
}
/*************************************************************************
@@ -542,14 +538,14 @@ FASTBOOL E3dObject::HasSpecialDrag() const
void E3dObject::RecalcSnapRect()
{
maSnapRect = Rectangle();
- if(pSub && pSub->GetObjCount())
+
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
{
- for (ULONG i = 0; i < pSub->GetObjCount(); i++)
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
+
+ if(pCandidate)
{
- SdrObject* pObj = pSub->GetObj(i);
- DBG_ASSERT(pObj->ISA(E3dObject), "AW: In E3dObject sind nur 3D-Objekte erlaubt!");
- Rectangle aSubRect = ((E3dObject*)pObj)->GetSnapRect();
- maSnapRect.Union(aSubRect);
+ maSnapRect.Union(pCandidate->GetSnapRect());
}
}
}
@@ -576,16 +572,12 @@ void E3dObject::NewObjectInserted(const E3dObject* p3DObj)
|*
\************************************************************************/
-void E3dObject::StructureChanged(const E3dObject* p3DObj)
+void E3dObject::StructureChanged()
{
if ( GetParentObj() )
{
- // Wenn sich im Child das BoundVolume geaendert hat, muessen
- // auch die der Parents angepasst werden
- if ( !p3DObj->bBoundVolValid )
- GetParentObj()->bBoundVolValid = FALSE;
-
- GetParentObj()->StructureChanged(p3DObj);
+ GetParentObj()->InvalidateBoundVolume();
+ GetParentObj()->StructureChanged();
}
}
@@ -599,11 +591,11 @@ void E3dObject::Insert3DObj(E3dObject* p3DObj)
{
DBG_ASSERT(p3DObj, "Insert3DObj mit NULL-Zeiger!");
SdrPage* pPg = pPage;
- pSub->InsertObject(p3DObj);
+ maSubList.InsertObject(p3DObj);
pPage = pPg;
- bBoundVolValid = FALSE;
+ InvalidateBoundVolume();
NewObjectInserted(p3DObj);
- StructureChanged(this);
+ StructureChanged();
}
void E3dObject::Remove3DObj(E3dObject* p3DObj)
@@ -613,11 +605,11 @@ void E3dObject::Remove3DObj(E3dObject* p3DObj)
if(p3DObj->GetParentObj() == this)
{
SdrPage* pPg = pPage;
- pSub->RemoveObject(p3DObj->GetOrdNum());
+ maSubList.RemoveObject(p3DObj->GetOrdNum());
pPage = pPg;
- bBoundVolValid = FALSE;
- StructureChanged(this);
+ InvalidateBoundVolume();
+ StructureChanged();
}
}
@@ -657,53 +649,47 @@ E3dScene* E3dObject::GetScene() const
|*
\************************************************************************/
-void E3dObject::RecalcBoundVolume()
+basegfx::B3DRange E3dObject::RecalcBoundVolume() const
{
- E3dObjList* pOL = pSub;
- ULONG nObjCnt = pOL->GetObjCount();
+ basegfx::B3DRange aRetval;
+ const sal_uInt32 nObjCnt(maSubList.GetObjCount());
if(nObjCnt)
{
- aBoundVol = Volume3D();
-
- for (ULONG i = 0; i < nObjCnt; i++)
+ for(sal_uInt32 a(0); a < nObjCnt; a++)
{
- SdrObject* pObj = pOL->GetObj(i);
-
- DBG_ASSERT(pObj->ISA(E3dObject), "In E3dObject sind nur 3D-Objekte erlaubt!");
- // Bei den Kindobjekten auch die lokalen Transformationen
- // beruecksichtigen
- E3dObject* p3DObj = (E3dObject*) pObj;
- const Volume3D& rVol = p3DObj->GetBoundVolume();
- const basegfx::B3DHomMatrix& rTf = p3DObj->GetTransform();
- aBoundVol.expand(rVol.GetTransformVolume(rTf));
- }
+ const E3dObject* p3DObject = dynamic_cast< const E3dObject* >(maSubList.GetObj(a));
- aLocalBoundVol = aBoundVol;
+ if(p3DObject)
+ {
+ basegfx::B3DRange aLocalRange(p3DObject->GetBoundVolume());
+ aLocalRange.transform(p3DObject->GetTransform());
+ aRetval.expand(aLocalRange);
+ }
+ }
}
else
{
- // use local value
- aBoundVol = aLocalBoundVol;
+ // single 3D object
+ const sdr::contact::ViewContactOfE3d* pVCOfE3D = dynamic_cast< const sdr::contact::ViewContactOfE3d* >(&GetViewContact());
- // detect if lines are displayed
- const SfxItemSet& rSet = GetMergedItemSet();
- XLineStyle aLineStyle = ((const XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
-
- if(aLineStyle != XLINE_NONE)
+ if(pVCOfE3D)
{
- // expand BoundVolume with 1/2 line width
- sal_Int32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
+ // BoundVolume is without 3D object transformation, use correct sequence
+ const drawinglayer::primitive3d::Primitive3DSequence xLocalSequence(pVCOfE3D->getVIP3DSWithoutObjectTransform());
- if(nLineWidth)
+ if(xLocalSequence.hasElements())
{
- double fExpand(nLineWidth / 2.0);
- aBoundVol.grow(fExpand);
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ const drawinglayer::geometry::ViewInformation3D aLocalViewInformation3D(aEmptyParameters);
+
+ aRetval = drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(
+ xLocalSequence, aLocalViewInformation3D);
}
}
}
- bBoundVolValid = TRUE;
+ return aRetval;
}
/*************************************************************************
@@ -712,25 +698,19 @@ void E3dObject::RecalcBoundVolume()
|*
\************************************************************************/
-const Volume3D& E3dObject::GetBoundVolume() const
+const basegfx::B3DRange& E3dObject::GetBoundVolume() const
{
- if ( !bBoundVolValid )
+ if(maLocalBoundVol.isEmpty())
{
- ((E3dObject*)this)->RecalcBoundVolume();
+ const_cast< E3dObject* >(this)->maLocalBoundVol = RecalcBoundVolume();
}
- return aBoundVol;
+ return maLocalBoundVol;
}
-/*************************************************************************
-|*
-|* Mittelpunkt liefern
-|*
-\************************************************************************/
-
-basegfx::B3DPoint E3dObject::GetCenter()
+void E3dObject::InvalidateBoundVolume()
{
- return GetBoundVolume().getCenter();
+ maLocalBoundVol.reset();
}
/*************************************************************************
@@ -741,17 +721,16 @@ basegfx::B3DPoint E3dObject::GetCenter()
void E3dObject::SetBoundVolInvalid()
{
- bBoundVolValid = FALSE;
+ InvalidateBoundVolume();
- E3dObjList* pOL = pSub;
- ULONG nObjCnt = pOL->GetObjCount();
-
- for (ULONG i = 0; i < nObjCnt; i++)
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
{
- SdrObject* pObj = pOL->GetObj(i);
- DBG_ASSERT(pObj->ISA(E3dObject), "In E3dObject sind nur 3D-Objekte erlaubt!");
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
- ((E3dObject*) pObj)->SetBoundVolInvalid();
+ if(pCandidate)
+ {
+ pCandidate->SetBoundVolInvalid();
+ }
}
}
@@ -763,40 +742,43 @@ void E3dObject::SetBoundVolInvalid()
void E3dObject::SetTransformChanged()
{
- bTfHasChanged = TRUE;
- bBoundVolValid = FALSE;
+ InvalidateBoundVolume();
+ mbTfHasChanged = true;
- E3dObjList* pOL = pSub;
- ULONG nObjCnt = pOL->GetObjCount();
-
- for (ULONG i = 0; i < nObjCnt; i++)
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
{
- SdrObject* pObj = pOL->GetObj(i);
- DBG_ASSERT(pObj->ISA(E3dObject), "In E3dObject sind nur 3D-Objekte erlaubt!");
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
- ((E3dObject*) pObj)->SetTransformChanged();
+ if(pCandidate)
+ {
+ pCandidate->SetTransformChanged();
+ }
}
}
/*************************************************************************
|*
|* hierarchische Transformation ueber alle Parents bestimmen, in
-|* aFullTfMatrix ablegen und diese zurueckgeben
+|* maFullTransform ablegen und diese zurueckgeben
|*
\************************************************************************/
const basegfx::B3DHomMatrix& E3dObject::GetFullTransform() const
{
- if(bTfHasChanged)
+ if(mbTfHasChanged)
{
- E3dObject* pThis = (E3dObject*)this;
- pThis->aFullTfMatrix = aTfMatrix;
+ basegfx::B3DHomMatrix aNewFullTransformation(maTransformation);
+
if ( GetParentObj() )
- pThis->aFullTfMatrix *= GetParentObj()->GetFullTransform();
- pThis->bTfHasChanged = FALSE;
+ {
+ aNewFullTransformation = GetParentObj()->GetFullTransform() * aNewFullTransformation;
+ }
+
+ const_cast< E3dObject* >(this)->maFullTransform = aNewFullTransformation;
+ const_cast< E3dObject* >(this)->mbTfHasChanged = false;
}
- return aFullTfMatrix;
+ return maFullTransform;
}
/*************************************************************************
@@ -807,7 +789,7 @@ const basegfx::B3DHomMatrix& E3dObject::GetFullTransform() const
const basegfx::B3DHomMatrix& E3dObject::GetTransform() const
{
- return aTfMatrix;
+ return maTransformation;
}
/*************************************************************************
@@ -818,22 +800,12 @@ const basegfx::B3DHomMatrix& E3dObject::GetTransform() const
void E3dObject::NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix)
{
- aTfMatrix = rMatrix;
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/*************************************************************************
-|*
-|* Transformationsmatrix auf Einheitsmatrix zuruecksetzen
-|*
-\************************************************************************/
-
-void E3dObject::NbcResetTransform()
-{
- aTfMatrix.identity();
- SetTransformChanged();
- StructureChanged(this);
+ if(maTransformation != rMatrix)
+ {
+ maTransformation = rMatrix;
+ SetTransformChanged();
+ StructureChanged();
+ }
}
/*************************************************************************
@@ -844,245 +816,27 @@ void E3dObject::NbcResetTransform()
void E3dObject::SetTransform(const basegfx::B3DHomMatrix& rMatrix)
{
- // #110094#-14 SendRepaintBroadcast();
- NbcSetTransform(rMatrix);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/*************************************************************************
-|*
-|* Transformationsmatrix zuruecksetzen mit Repaint-Broadcast
-|*
-\************************************************************************/
-
-void E3dObject::ResetTransform()
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcResetTransform();
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/*************************************************************************
-|*
-|* Translation
-|*
-\************************************************************************/
-
-void E3dObject::NbcTranslate(const basegfx::B3DVector& rTrans)
-{
- aTfMatrix.translate(rTrans.getX(), rTrans.getY(), rTrans.getZ());
- SetTransformChanged();
- StructureChanged(this);
-}
-/*************************************************************************
-|*
-|* Translation mit Repaint-Broadcast
-|*
-\************************************************************************/
-
-void E3dObject::Translate(const basegfx::B3DVector& rTrans)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcTranslate(rTrans);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/*************************************************************************
-|*
-|* Skalierungen
-|*
-\************************************************************************/
-
-void E3dObject::NbcScaleX(double fSx)
-{
- aTfMatrix.scale(fSx, 1.0, 1.0);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/************************************************************************/
-
-void E3dObject::NbcScaleY(double fSy)
-{
- aTfMatrix.scale(1.0, fSy, 1.0);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/************************************************************************/
-
-void E3dObject::NbcScaleZ(double fSz)
-{
- aTfMatrix.scale(1.0, 1.0, fSz);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/************************************************************************/
-
-void E3dObject::NbcScale(double fSx, double fSy, double fSz)
-{
- aTfMatrix.scale(fSx, fSy, fSz);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/*************************************************************************
-|*
-|* gleichmaessige Skalierung
-|*
-\************************************************************************/
-
-void E3dObject::NbcScale(double fS)
-{
- aTfMatrix.scale(fS, fS, fS);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/*************************************************************************
-|*
-|* Skalierungen mit mit Repaint-Broadcast
-|*
-\************************************************************************/
-
-void E3dObject::ScaleX(double fSx)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcScaleX(fSx);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/************************************************************************/
-
-void E3dObject::ScaleY(double fSy)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcScaleY(fSy);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/************************************************************************/
-
-void E3dObject::ScaleZ(double fSz)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcScaleZ(fSz);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/************************************************************************/
-
-void E3dObject::Scale(double fSx, double fSy, double fSz)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcScale(fSx, fSy, fSz);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/************************************************************************/
-
-void E3dObject::Scale(double fS)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcScale(fS);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/*************************************************************************
-|*
-|* Rotationen mit Winkel in Radiant
-|*
-\************************************************************************/
-
-void E3dObject::NbcRotateX(double fAng)
-{
- aTfMatrix.rotate(fAng, 0.0, 0.0);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/************************************************************************/
-
-void E3dObject::NbcRotateY(double fAng)
-{
- aTfMatrix.rotate(0.0, fAng, 0.0);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/************************************************************************/
-
-void E3dObject::NbcRotateZ(double fAng)
-{
- aTfMatrix.rotate(0.0, 0.0, fAng);
- SetTransformChanged();
- StructureChanged(this);
-}
-
-/*************************************************************************
-|*
-|* Rotationen mit Repaint-Broadcast
-|*
-\************************************************************************/
-
-void E3dObject::RotateX(double fAng)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcRotateX(fAng);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/************************************************************************/
-
-void E3dObject::RotateY(double fAng)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcRotateY(fAng);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
-}
-
-/************************************************************************/
-
-void E3dObject::RotateZ(double fAng)
-{
- // #110094#-14 SendRepaintBroadcast();
- NbcRotateZ(fAng);
- SetChanged();
- BroadcastObjectChange();
- if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
+ if(rMatrix != maTransformation)
+ {
+ // #110094#-14 SendRepaintBroadcast();
+ NbcSetTransform(rMatrix);
+ SetChanged();
+ BroadcastObjectChange();
+ if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
+ }
}
/*************************************************************************
|*
|* Linien fuer die Wireframe-Darstellung des Objekts dem uebergebenen
-|* basegfx::B3DPolygon hinzufuegen. Als default wird das BoundVolume verwendet.
+|* basegfx::B3DPolygon hinzufuegen
|*
\************************************************************************/
-void E3dObject::CreateWireframe(basegfx::B3DPolygon& rWirePoly, const basegfx::B3DHomMatrix* pTf) const
+basegfx::B3DPolyPolygon E3dObject::CreateWireframe() const
{
- GetBoundVolume().CreateWireframe(rWirePoly, pTf);
+ const basegfx::B3DRange aBoundVolume(GetBoundVolume());
+ return basegfx::tools::createCubePolyPolygonFromB3DRange(aBoundVolume);
}
/*************************************************************************
@@ -1118,57 +872,6 @@ void E3dObject::TakeObjNamePlural(XubString& rName) const
/*************************************************************************
|*
-|* Wireframe-PolyPolygon erzeugen
-|*
-\************************************************************************/
-
-basegfx::B2DPolyPolygon E3dObject::ImpCreateWireframePoly() const
-{
- basegfx::B2DPolyPolygon aRetval;
- E3dScene* pScene = GetScene();
-
- if(pScene)
- {
- basegfx::B3DPolygon aPoly3D;
- CreateWireframe(aPoly3D, 0L);
- const sal_uInt32 nPntCnt(aPoly3D.count());
-
- if(nPntCnt)
- {
- const Volume3D aVolume(pScene->FitInSnapRect());
- pScene->GetCameraSet().SetDeviceVolume(aVolume, sal_False);
- pScene->GetCameraSet().SetObjectTrans(GetFullTransform());
-
- for(sal_uInt32 a(0L); a < nPntCnt;)
- {
- basegfx::B3DPoint aPointA(aPoly3D.getB3DPoint(a++));
- aPointA = pScene->GetCameraSet().ObjectToViewCoor(aPointA);
- basegfx::B3DPoint aPointB(aPoly3D.getB3DPoint(a++));
- aPointB = pScene->GetCameraSet().ObjectToViewCoor(aPointB);
- basegfx::B2DPolygon aTmpPoly;
- aTmpPoly.append(basegfx::B2DPoint(aPointA.getX(), aPointA.getY()));
- aTmpPoly.append(basegfx::B2DPoint(aPointB.getX(), aPointB.getY()));
- aRetval.append(aTmpPoly);
- }
- }
- }
-
- return aRetval;
-}
-
-/*************************************************************************
-|*
-|* Drag-Polygon zurueckgeben
-|*
-\************************************************************************/
-
-basegfx::B2DPolyPolygon E3dObject::TakeXorPoly(sal_Bool /*bDetail*/) const
-{
- return ImpCreateWireframePoly();
-}
-
-/*************************************************************************
-|*
|* Zuweisungsoperator
|*
\************************************************************************/
@@ -1180,74 +883,19 @@ void E3dObject::operator=(const SdrObject& rObj)
const E3dObject& r3DObj = (const E3dObject&) rObj;
if (r3DObj.GetSubList())
{
- // feststellen, ob alle SubObjekte selektiert oder
- // deselektiert sind
- BOOL bAllSelected = TRUE;
- BOOL bNoneSelected = TRUE;
- UINT32 nObjCnt = r3DObj.GetSubList()->GetObjCount();
-
- ULONG i;
- for (i = 0; i < nObjCnt; i++)
- {
- SdrObject* pObj = r3DObj.GetSubList()->GetObj(i);
- if(pObj && pObj->ISA(E3dObject))
- {
- E3dObject* p3DObj = (E3dObject*)pObj;
- if(p3DObj->GetSelected())
- bNoneSelected = FALSE;
- else
- bAllSelected = FALSE;
- }
- }
-
- if(bAllSelected || bNoneSelected)
- {
- // Normales verhalten
- pSub->CopyObjects(*r3DObj.GetSubList());
- }
- else
- {
- // Spezielle SubListe aufstellen, kopieren
- SdrObjList aOwnSubList(*r3DObj.GetSubList());
-
- // Alle nicht selektierten Objekte rausschmeissen
- for(i = 0;i < aOwnSubList.GetObjCount();i++)
- {
- SdrObject* pObj = aOwnSubList.GetObj(i);
- if(pObj && pObj->ISA(E3dObject))
- {
- E3dObject* p3DObj = (E3dObject*)pObj;
- if(!p3DObj->GetSelected())
- {
- aOwnSubList.NbcRemoveObject(pObj->GetOrdNum());
- i--;
- SdrObject::Free( pObj );
- }
- }
- }
-
- // jetzt diese Liste kopieren
- pSub->CopyObjects(aOwnSubList);
-
- // Hier noch ein FitSnapRect einleiten
- if(ISA(E3dScene))
- ((E3dScene&)r3DObj).FitSnapRectToBoundVol();
- }
+ maSubList.CopyObjects(*r3DObj.GetSubList());
}
// BoundVol kann uebernommen werden, da die Childs auch kopiert werden
- bBoundVolValid = r3DObj.bBoundVolValid;
- aBoundVol = r3DObj.aBoundVol;
- aLocalBoundVol = r3DObj.aLocalBoundVol;
-
- aTfMatrix = r3DObj.aTfMatrix;
+ maLocalBoundVol = r3DObj.maLocalBoundVol;
+ maTransformation = r3DObj.maTransformation;
// Da sich der Parent geaendert haben kann, Gesamttransformation beim
// naechsten Mal auf jeden Fall neu bestimmen
SetTransformChanged();
// Selektionsstatus kopieren
- bIsSelected = r3DObj.bIsSelected;
+ mbIsSelected = r3DObj.mbIsSelected;
}
/*************************************************************************
@@ -1273,8 +921,8 @@ void E3dObject::SaveGeoData(SdrObjGeoData& rGeo) const
{
SdrAttrObj::SaveGeoData (rGeo);
- ((E3DObjGeoData &) rGeo).aLocalBoundVol = aLocalBoundVol;
- ((E3DObjGeoData &) rGeo).aTfMatrix = aTfMatrix;
+ ((E3DObjGeoData &) rGeo).maLocalBoundVol = maLocalBoundVol;
+ ((E3DObjGeoData &) rGeo).maTransformation = maTransformation;
}
/*************************************************************************
@@ -1285,11 +933,10 @@ void E3dObject::SaveGeoData(SdrObjGeoData& rGeo) const
void E3dObject::RestGeoData(const SdrObjGeoData& rGeo)
{
- aLocalBoundVol = ((E3DObjGeoData &) rGeo).aLocalBoundVol;
- NbcSetTransform (((E3DObjGeoData &) rGeo).aTfMatrix);
-
+ maLocalBoundVol = ((E3DObjGeoData &) rGeo).maLocalBoundVol;
+ E3DModifySceneSnapRectUpdater aUpdater(this);
+ NbcSetTransform(((E3DObjGeoData &) rGeo).maTransformation);
SdrAttrObj::RestGeoData (rGeo);
- GetScene()->FitSnapRectToBoundVol();
}
/*************************************************************************
@@ -1304,14 +951,18 @@ void E3dObject::RestGeoData(const SdrObjGeoData& rGeo)
void E3dObject::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
{
- // Also derzeit sind die Klebepunkte relativ zum aOutRect der Szene definiert. Vor dem Drehen
- // werden die Klebepunkte relativ zur Seite definiert. Sie nehmen an der Drehung der Szene noch nicht Teil
- // dafuer gibt es den
+ // Also derzeit sind die Klebepunkte relativ zum aOutRect der Szene definiert. Vor dem Drehen
+ // werden die Klebepunkte relativ zur Seite definiert. Sie nehmen an der Drehung der Szene noch nicht Teil
+ // dafuer gibt es den
SetGlueReallyAbsolute(TRUE);
// SendRepaintBroadcast();
double fWinkelInRad = nWink/100 * F_PI180;
- NbcRotateZ(fWinkelInRad);
+
+ basegfx::B3DHomMatrix aRotateZ;
+ aRotateZ.rotate(0.0, 0.0, fWinkelInRad);
+ NbcSetTransform(aRotateZ * GetTransform());
+
SetRectsDirty(); // Veranlasst eine Neuberechnung aller BoundRects
NbcRotateGluePoints(rRef,nWink,sn,cs); // Rotiert die Klebepunkte (die haben noch Koordinaten relativ
// zum Urpsung des Blattes
@@ -1337,22 +988,25 @@ TYPEINIT1(E3dCompoundObject, E3dObject);
|*
\************************************************************************/
-E3dCompoundObject::E3dCompoundObject() : E3dObject()
+E3dCompoundObject::E3dCompoundObject()
+: E3dObject(),
+ aMaterialAmbientColor(),
+ bCreateNormals(false),
+ bCreateTexture(false)
{
// Defaults setzen
E3dDefaultAttributes aDefault;
SetDefaultAttributes(aDefault);
-
- bGeometryValid = FALSE;
- bFullTfIsPositive = TRUE;
}
-E3dCompoundObject::E3dCompoundObject(E3dDefaultAttributes& rDefault) : E3dObject()
+E3dCompoundObject::E3dCompoundObject(E3dDefaultAttributes& rDefault)
+: E3dObject(),
+ aMaterialAmbientColor(),
+ bCreateNormals(false),
+ bCreateTexture(false)
{
// Defaults setzen
SetDefaultAttributes(rDefault);
-
- bGeometryValid = FALSE;
}
void E3dCompoundObject::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
@@ -1360,10 +1014,8 @@ void E3dCompoundObject::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
// Defaults setzen
aMaterialAmbientColor = rDefault.GetDefaultAmbientColor();
- aBackMaterial = rDefault.GetDefaultBackMaterial();
bCreateNormals = rDefault.GetDefaultCreateNormals();
bCreateTexture = rDefault.GetDefaultCreateTexture();
- bUseDifferentBackMaterial = rDefault.GetDefaultUseDifferentBackMaterial();
}
/*************************************************************************
@@ -1378,879 +1030,165 @@ E3dCompoundObject::~E3dCompoundObject ()
/*************************************************************************
|*
-|* Start der Geometrieerzeugung ankuendigen
-|*
-\************************************************************************/
-
-void E3dCompoundObject::StartCreateGeometry()
-{
- // Geometriestart mitteilen
- aDisplayGeometry.StartDescription();
-
- // Lokales Volumen reset
- aLocalBoundVol = Volume3D();
-
- // Geometrie ist ab jetzt gueltig, um ein rekursives weiteres
- // Erzeugen zu verhindern
- bGeometryValid = TRUE;
-}
-
-/*************************************************************************
-|*
-|* Identifier zurueckgeben
+|* Drag-Polygon zurueckgeben
|*
\************************************************************************/
-UINT16 E3dCompoundObject::GetObjIdentifier() const
+basegfx::B2DPolyPolygon E3dCompoundObject::TakeXorPoly() const
{
- return E3D_COMPOUNDOBJ_ID;
-}
-
-/*************************************************************************
-|*
-|* SnapRect berechnen
-|*
-\************************************************************************/
+ basegfx::B2DPolyPolygon aRetval;
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
-void E3dCompoundObject::RecalcSnapRect()
-{
- E3dScene* pScene = GetScene();
- if(pScene)
+ if(pRootScene)
{
- // Objekttransformation uebernehmen
- const Volume3D& rBoundVol = GetBoundVolume();
- maSnapRect = Rectangle();
-
- if(!rBoundVol.isEmpty())
- {
- const basegfx::B3DHomMatrix& rTrans = GetFullTransform();
- Vol3DPointIterator aIter(rBoundVol, &rTrans);
- basegfx::B3DPoint aTfVec;
- while ( aIter.Next(aTfVec) )
- {
- aTfVec = pScene->GetCameraSet().WorldToViewCoor(aTfVec);
- Point aPoint((long)(aTfVec.getX() + 0.5), (long)(aTfVec.getY() + 0.5));
- maSnapRect.Union(Rectangle(aPoint, aPoint));
- }
- }
- bSnapRectDirty = FALSE;
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+ const basegfx::B3DPolyPolygon aCubePolyPolygon(CreateWireframe());
+ aRetval = basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aCubePolyPolygon,
+ aViewInfo3D.getObjectToView() * GetTransform());
+ aRetval.transform(rVCScene.getObjectTransformation());
}
+
+ return aRetval;
}
/*************************************************************************
|*
-|* BoundVolume holen. Falls die Geometrie ungueltig ist, diese neu
-|* erzeugen und das BoundVol neu berechnen
+|* Anzahl der Handles zurueckgeben
|*
\************************************************************************/
-const Volume3D& E3dCompoundObject::GetBoundVolume() const
+sal_uInt32 E3dCompoundObject::GetHdlCount() const
{
- // Geometrie aktuell?
- if(!bGeometryValid)
- {
- // Neu erzeugen und eine Neubestimmung des BoundVol erzwingen
- E3dCompoundObject* pThis = (E3dCompoundObject*)this;
- pThis->ReCreateGeometry();
- pThis->bBoundVolValid = FALSE;
- }
-
- // call parent
- return E3dObject::GetBoundVolume();
+ // 8 Eckpunkte + 1 E3dVolumeMarker (= Wireframe-Darstellung)
+ return 9L;
}
/*************************************************************************
|*
-|* Give out simple line geometry
+|* Handle-Liste fuellen
|*
\************************************************************************/
-basegfx::B3DPolyPolygon E3dCompoundObject::Get3DLineGeometry() const
+void E3dCompoundObject::AddToHdlList(SdrHdlList& rHdlList) const
{
- basegfx::B3DPolyPolygon aRetval;
- const B3dEntityBucket& rEntityBucket = GetDisplayGeometry().GetEntityBucket();
- const GeometryIndexValueBucket& rIndexBucket = GetDisplayGeometry().GetIndexBucket();
- sal_uInt32 nPolyCounter(0L);
- sal_uInt32 nEntityCounter(0L);
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
- while(nPolyCounter < rIndexBucket.Count())
+ if(pRootScene)
{
- // next primitive
- sal_uInt32 nUpperBound(rIndexBucket[nPolyCounter++].GetIndex());
- basegfx::B3DPoint aLastPoint;
- sal_Bool bLastLineVisible(rEntityBucket[nUpperBound - 1].IsEdgeVisible());
-
- if(bLastLineVisible)
- {
- aLastPoint = rEntityBucket[nUpperBound - 1].Point();
- }
+ const basegfx::B3DRange aBoundVolume(GetBoundVolume());
- while(nEntityCounter < nUpperBound)
+ if(!aBoundVolume.isEmpty())
{
- basegfx::B3DPoint aNewPoint(rEntityBucket[nEntityCounter].Point());
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
- if(bLastLineVisible)
+ for(sal_uInt32 a(0); a < 8; a++)
{
- if(aLastPoint != aNewPoint)
+ basegfx::B3DPoint aPos3D;
+
+ switch(a)
{
- // fill polygon
- basegfx::B3DPolygon aNewPoly;
- aNewPoly.append(aLastPoint);
- aNewPoly.append(aNewPoint);
-
- // create line geometry for polygon in eye coor to
- // have it always orthogonal to camera plane
- aRetval.append(aNewPoly);
+ case 0 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
+ case 1 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
+ case 2 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
+ case 3 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
+ case 4 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
+ case 5 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
+ case 6 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
+ case 7 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
}
- }
- bLastLineVisible = rEntityBucket[nEntityCounter++].IsEdgeVisible();
- aLastPoint = aNewPoint;
- }
- }
-
- return aRetval;
-}
+ // to 3d view coor
+ aPos3D *= aViewInfo3D.getObjectToView() * GetTransform();
-/*************************************************************************
-|*
-|* Geometrieerzeugung
-|*
-\************************************************************************/
-
-void E3dCompoundObject::DestroyGeometry()
-{
- // Alle Objekte in der Sub-Liste zerstoeren. Dies sind die
- // zur Visualisierung des Objektes verwendeten Hilfsobjekte
- pSub->Clear();
- delete pSub;
- pSub = new E3dObjList(NULL, NULL);
- pSub->SetOwnerObj(this);
- pSub->SetListKind(SDROBJLIST_GROUPOBJ);
+ // create 2d relative scene
+ basegfx::B2DPoint aPos2D(aPos3D.getX(), aPos3D.getY());
- // Neue Geometrie zerstoeren
- aDisplayGeometry.Erase();
+ // to 2d world coor
+ aPos2D *= rVCScene.getObjectTransformation();
- // BoundVols resetten
- aLocalBoundVol = Volume3D();
- bBoundVolValid = FALSE;
- StructureChanged(this);
-
- // Geometrie ist ungueltig
- bGeometryValid = FALSE;
-}
-
-void E3dCompoundObject::CreateGeometry()
-{
- // Geometrie ist gueltig, um rekursion zu verhindern
- bGeometryValid = TRUE;
-
- // Eventuell entstandene Geometrie noch korrigieren
- // und Default -Normalen oder -Texturkoordinaten erzeugen
- if(bCreateNormals)
- {
- if(GetNormalsKind() > 1)
- aDisplayGeometry.CreateDefaultNormalsSphere();
- if(GetNormalsInvert())
- aDisplayGeometry.InvertNormals();
+ rHdlList.AddHdl(new SdrHdl(Point(basegfx::fround(aPos2D.getX()), basegfx::fround(aPos2D.getY())), HDL_BWGT));
+ }
+ }
}
- if(bCreateTexture)
+ const basegfx::B2DPolyPolygon aPolyPolygon(TakeXorPoly());
+
+ if(aPolyPolygon.count())
{
- aDisplayGeometry.CreateDefaultTexture(
- ((GetTextureProjectionX() > 0) ? B3D_CREATE_DEFAULT_X : FALSE)
- |((GetTextureProjectionY() > 0) ? B3D_CREATE_DEFAULT_Y : FALSE),
- GetTextureProjectionX() > 1);
+ E3dVolumeMarker* pVolMarker = new E3dVolumeMarker(aPolyPolygon);
+ rHdlList.AddHdl(pVolMarker);
}
-
- // Das Ende der Geometrieerzeugung anzeigen
- aDisplayGeometry.EndDescription();
-}
-
-void E3dCompoundObject::ReCreateGeometry()
-{
- // Geometrie zerstoeren
- DestroyGeometry();
-
- // ... und neu erzeugen
- CreateGeometry();
}
/*************************************************************************
|*
-|* Geometrieerzeugung
-|*
\************************************************************************/
-void E3dCompoundObject::AddGeometry(
- const basegfx::B3DPolyPolygon& rPolyPolygon,
- BOOL bHintIsComplex, BOOL bOutline)
-{
- if(rPolyPolygon.count())
- {
- // neue Geometrie erzeugen
- for(sal_uInt32 a(0L); a < rPolyPolygon.count(); a++)
- {
- const basegfx::B3DPolygon aPoly3D(rPolyPolygon.getB3DPolygon(a));
- aDisplayGeometry.StartObject(bHintIsComplex, bOutline);
-
- for(sal_uInt32 b(0L); b < aPoly3D.count(); b++ )
- {
- aDisplayGeometry.AddEdge(aPoly3D.getB3DPoint(b));
- }
- }
- aDisplayGeometry.EndObject();
-
- // LocalBoundVolume pflegen
- aLocalBoundVol.expand(basegfx::tools::getRange(rPolyPolygon));
-
- // Eigenes BoundVol nicht mehr gueltig
- SetBoundVolInvalid();
- SetRectsDirty();
- }
-}
-
-void E3dCompoundObject::AddGeometry(
- const basegfx::B3DPolyPolygon& rPolyPolygon,
- const basegfx::B3DPolyPolygon& rPolyPolygonNormal,
- BOOL bHintIsComplex, BOOL bOutline)
-{
- if(rPolyPolygon.count())
- {
- // neue Geometrie erzeugen
- for(sal_uInt32 a(0L); a < rPolyPolygon.count(); a++ )
- {
- const basegfx::B3DPolygon aPoly3D(rPolyPolygon.getB3DPolygon(a));
- const basegfx::B3DPolygon aNormal3D(rPolyPolygonNormal.getB3DPolygon(a));
- aDisplayGeometry.StartObject(bHintIsComplex, bOutline);
-
- for(sal_uInt32 b(0L); b < aPoly3D.count(); b++ )
- {
- aDisplayGeometry.AddEdge(aPoly3D.getB3DPoint(b), aNormal3D.getB3DPoint(b));
- }
- }
- aDisplayGeometry.EndObject();
-
- // LocalBoundVolume pflegen
- aLocalBoundVol.expand(basegfx::tools::getRange(rPolyPolygon));
-
- // Eigenes BoundVol nicht mehr gueltig
- SetBoundVolInvalid();
- SetRectsDirty();
- }
-}
-
-void E3dCompoundObject::AddGeometry(
- const basegfx::B3DPolyPolygon& rPolyPolygon,
- const basegfx::B3DPolyPolygon& rPolyPolygonNormal,
- const basegfx::B2DPolyPolygon& rPolyPolygonTexture,
- BOOL bHintIsComplex, BOOL bOutline)
+FASTBOOL E3dCompoundObject::HasSpecialDrag() const
{
- if(rPolyPolygon.count())
- {
- // neue Geometrie erzeugen
- for(sal_uInt32 a(0L); a < rPolyPolygon.count(); a++ )
- {
- const basegfx::B3DPolygon aPoly3D(rPolyPolygon.getB3DPolygon(a));
- const basegfx::B3DPolygon aNormal3D(rPolyPolygonNormal.getB3DPolygon(a));
- const basegfx::B2DPolygon aTexture2D(rPolyPolygonTexture.getB2DPolygon(a));
- aDisplayGeometry.StartObject(bHintIsComplex, bOutline);
-
- for(sal_uInt32 b(0L); b < aPoly3D.count(); b++ )
- {
- aDisplayGeometry.AddEdge(aPoly3D.getB3DPoint(b), aNormal3D.getB3DPoint(b), aTexture2D.getB2DPoint(b));
- }
- }
- aDisplayGeometry.EndObject();
-
- // LocalBoundVolume pflegen
- aLocalBoundVol.expand(basegfx::tools::getRange(rPolyPolygon));
-
- // Eigenes BoundVol nicht mehr gueltig
- SetBoundVolInvalid();
- SetRectsDirty();
- }
+ return TRUE;
}
/*************************************************************************
|*
-|* Hilfsfunktionen zur Geometrieerzeugung
+|* Identifier zurueckgeben
|*
\************************************************************************/
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpGrowPoly(
- const basegfx::B3DPolyPolygon& rPolyPolyGrow,
- const basegfx::B3DPolyPolygon& rPolyPolyNormals,
- double fFactor)
-{
- basegfx::B3DPolyPolygon aRetval;
- const sal_uInt32 nPolyCount(rPolyPolyGrow.count());
- const bool bClosed(rPolyPolyGrow.isClosed());
-
- for(sal_uInt32 a(0L); a < nPolyCount; a++)
- {
- const basegfx::B3DPolygon aPolyGrow(rPolyPolyGrow.getB3DPolygon(a));
- const basegfx::B3DPolygon aPolyNormals(rPolyPolyNormals.getB3DPolygon(a));
- const sal_uInt32 nPointCount(aPolyGrow.count());
- basegfx::B3DPolygon aNewPolyGrow;
-
- for(sal_uInt32 b(0L); b < nPointCount; b++)
- {
- aNewPolyGrow.append(aPolyGrow.getB3DPoint(b) + (aPolyNormals.getB3DPoint(b) * fFactor));
- }
-
- aNewPolyGrow.setClosed(bClosed);
- aRetval.append(aNewPolyGrow);
- }
-
- return aRetval;
-}
-
-basegfx::B2VectorOrientation E3dCompoundObject::ImpGetOrientationInPoint(
- const basegfx::B3DPolygon& rPolygon,
- sal_uInt32 nIndex)
-{
- sal_uInt32 nPntCnt(rPolygon.count());
- basegfx::B2VectorOrientation eRetval(basegfx::ORIENTATION_NEUTRAL);
-
- if(nIndex < nPntCnt)
- {
- const basegfx::B3DPoint aMid(rPolygon.getB3DPoint(nIndex));
- const basegfx::B3DPoint aPre(rPolygon.getB3DPoint((nIndex == 0L) ? nPntCnt - 1L : nIndex - 1L));
- const basegfx::B3DPoint aPos(rPolygon.getB3DPoint((nIndex == nPntCnt - 1L) ? 0L : nIndex + 1L));
- const basegfx::B3DVector aVecA(aPre - aMid);
- const basegfx::B3DVector aVecB(aPos - aMid);
- const basegfx::B3DVector aNormal(aVecA.getPerpendicular(aVecB));
-
- if(aNormal.getZ() > 0.0)
- {
- eRetval = basegfx::ORIENTATION_POSITIVE;
- }
- else if(aNormal.getZ() < 0.0)
- {
- eRetval = basegfx::ORIENTATION_NEGATIVE;
- }
- }
-
- return eRetval;
-}
-
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpCorrectGrownPoly(
- const basegfx::B3DPolyPolygon& aToBeCorrected,
- const basegfx::B3DPolyPolygon& aOriginal)
-{
- const sal_uInt32 aOriginalCount(aOriginal.count());
- const sal_uInt32 aToBeCorrectedCount(aToBeCorrected.count());
- const bool bClosed(aToBeCorrected.isClosed());
-
- if(aOriginalCount == aToBeCorrectedCount)
- {
- basegfx::B3DPolyPolygon aRetval;
-
- for(sal_uInt32 a(0L); a < aToBeCorrectedCount; a++)
- {
- const basegfx::B3DPolygon aCorr(aToBeCorrected.getB3DPolygon(a));
- const basegfx::B3DPolygon aOrig(aOriginal.getB3DPolygon(a));
- const sal_uInt32 aOrigCount(aOrig.count());
- const sal_uInt32 aCorrCount(aCorr.count());
-
- if(aOrigCount == aCorrCount && aOrigCount > 2L)
- {
- sal_uInt32 nNumDiff(0L);
- sal_uInt32 nDoneStart(0xffffffff);
-
- // Testen auf Anzahl Aenderungen
- sal_uInt32 b;
-
- for(b = 0L; b < aOrigCount; b++)
- {
- const basegfx::B2VectorOrientation eOrig(ImpGetOrientationInPoint(aOrig, b));
- const basegfx::B2VectorOrientation eCorr(ImpGetOrientationInPoint(aCorr, b));
-
- if(eOrig != eCorr)
- {
- nNumDiff++;
- }
- else
- {
- if(nDoneStart == 0xffffffff)
- {
- // eventuellen Startpunkt auf gleiche Orientierung legen
- nDoneStart = b;
- }
- }
- }
-
- if(nNumDiff == aOrigCount)
- {
- // Komplett umgedreht, alles auf einen Punkt
- const basegfx::B3DRange aCorrRange = basegfx::tools::getRange(aCorr);
- basegfx::B3DPolygon aNew;
-
- aNew.append(aCorrRange.getCenter(), aCorrCount);
- aRetval.append(aNew);
- }
- else if(nNumDiff)
- {
- // es gibt welche, nDoneStart ist gesetzt. Erzeuge (und
- // setze) nDoneEnd
- sal_uInt32 nDoneEnd(nDoneStart);
- sal_uInt32 nStartLoop(0L);
- BOOL bInLoop(FALSE);
- basegfx::B3DPolygon aNew(aCorr);
-
- // einen step mehr in der Schleife, um Loops abzuschliessen
- BOOL bFirstStep(TRUE);
-
- while(nDoneEnd != nDoneStart || bFirstStep)
- {
- bFirstStep = FALSE;
-
- // nCandidate ist Kandidat fuer Test
- const sal_uInt32 nCandidate((nDoneEnd == aOrigCount - 1L) ? 0L : nDoneEnd + 1L);
- const basegfx::B2VectorOrientation eOrig(ImpGetOrientationInPoint(aOrig, nCandidate));
- const basegfx::B2VectorOrientation eCorr(ImpGetOrientationInPoint(aCorr, nCandidate));
-
- if(eOrig == eCorr)
- {
- // Orientierung ist gleich
- if(bInLoop)
- {
- // Punkte innerhalb bInLoop auf ihr Zentrum setzen
- basegfx::B3DPoint aMiddle;
- sal_uInt32 nCounter(0L);
- sal_uInt32 nStart(nStartLoop);
-
- while(nStart != nCandidate)
- {
- aMiddle += aCorr.getB3DPoint(nStart);
- nCounter++;
- nStart = (nStart == aOrigCount - 1L) ? 0L : nStart + 1L;
- }
-
- // Mittelwert bilden
- aMiddle /= (double)nCounter;
-
- // Punkte umsetzen
- nStart = nStartLoop;
- while(nStart != nCandidate)
- {
- aNew.setB3DPoint(nStart, aMiddle);
- nStart = (nStart == aOrigCount - 1L) ? 0L : nStart + 1L;
- }
-
- // Loop beenden
- bInLoop = FALSE;
- }
- }
- else
- {
- // Orientierung unterschiedlich
- if(!bInLoop)
- {
- // Start eines Loop mit geaenderter Orientierung
- nStartLoop = nCandidate;
- bInLoop = TRUE;
- }
- }
-
- // Weitergehen
- nDoneEnd = nCandidate;
- }
-
- aRetval.append(aNew);
- }
- else
- {
- // no change, append original
- aRetval.append(aCorr);
- }
- }
- else
- {
- // less than 2 -> no change, append original
- aRetval.append(aCorr);
- }
- }
-
- aRetval.setClosed(bClosed);
- return aRetval;
- }
- else
- {
- return aToBeCorrected;
- }
-}
-
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpScalePoly(
- const basegfx::B3DPolyPolygon& rPolyPolyScale,
- double fFactor)
-{
- basegfx::B3DPolyPolygon aRetval(rPolyPolyScale);
- const basegfx::B3DRange aPolyPolyRange(basegfx::tools::getRange(rPolyPolyScale));
- const basegfx::B3DPoint aCenter(aPolyPolyRange.getCenter());
- basegfx::B3DHomMatrix aTransform;
-
- aTransform.translate(-aCenter.getX(), -aCenter.getY(), -aCenter.getZ());
- aTransform.scale(fFactor, fFactor, fFactor);
- aTransform.translate(aCenter.getX(), aCenter.getY(), aCenter.getZ());
- aRetval.transform(aTransform);
-
- return aRetval;
-}
-
-void E3dCompoundObject::ImpCreateFront(
- const basegfx::B3DPolyPolygon& rPolyPoly3D,
- const basegfx::B3DPolyPolygon& rFrontNormals,
- BOOL bDoCreateNormals,
- BOOL bDoCreateTexture)
-{
- // Vorderseite
- if(bDoCreateNormals)
- {
- if(bDoCreateTexture)
- {
- // create default texture polygon
- const basegfx::B3DRange aRange(basegfx::tools::getRange(rPolyPoly3D));
- const double fScaleX(0.0 == aRange.getWidth() ? 1.0 : 1.0 / aRange.getWidth());
- const double fScaleY(0.0 == aRange.getHeight() ? 1.0 : 1.0 / aRange.getHeight());
- const double fScaleZ(0.0 == aRange.getDepth() ? 1.0 : 1.0 / aRange.getDepth());
- basegfx::B3DHomMatrix aTrans3DTo2D;
-
- aTrans3DTo2D.translate(-aRange.getMinX(), -aRange.getMinY(), -aRange.getMinZ());
- aTrans3DTo2D.scale(fScaleX, -fScaleY, fScaleZ);
- aTrans3DTo2D.translate(0.0, 1.0, 0.0);
- basegfx::B2DPolyPolygon aPolyTexture(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(rPolyPoly3D, aTrans3DTo2D));
-
- AddGeometry(rPolyPoly3D, rFrontNormals, aPolyTexture, TRUE);
- }
- else
- {
- AddGeometry(rPolyPoly3D, rFrontNormals, TRUE);
- }
- }
- else
- {
- AddGeometry(rPolyPoly3D, TRUE);
- }
-}
-
-void E3dCompoundObject::ImpCreateBack(
- const basegfx::B3DPolyPolygon& rPolyPoly3D,
- const basegfx::B3DPolyPolygon& rBackNormals,
- BOOL bDoCreateNormals,
- BOOL bDoCreateTexture)
-{
- // flip polys
- basegfx::B3DPolyPolygon aPolyPoly3D(rPolyPoly3D);
- basegfx::B3DPolyPolygon aBackNormals(rBackNormals);
- aPolyPoly3D.flip();
- aBackNormals.flip();
-
- // use ImpCreateFront with flipped polys
- ImpCreateFront(aPolyPoly3D, aBackNormals, bDoCreateNormals, bDoCreateTexture);
-}
-
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpCreateByPattern(const basegfx::B3DPolyPolygon& rPattern)
-{
- basegfx::B3DPolyPolygon aRetval;
- const sal_uInt32 nPolyCount(rPattern.count());
- const bool bClosed(rPattern.isClosed());
-
- for(sal_uInt32 a(0L); a < nPolyCount; a++)
- {
- basegfx::B3DPolygon aNew;
- aNew.append(basegfx::B3DPoint(), rPattern.getB3DPolygon(a).count());
- aNew.setClosed(bClosed);
- aRetval.append(aNew);
- }
-
- return aRetval;
-}
-
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpAddFrontNormals(
- const basegfx::B3DPolyPolygon& rNormalsFront,
- const basegfx::B3DPoint& rOffset)
+UINT16 E3dCompoundObject::GetObjIdentifier() const
{
- basegfx::B3DPoint aBackOffset(-rOffset);
- return ImpAddBackNormals(rNormalsFront, aBackOffset);
+ return E3D_COMPOUNDOBJ_ID;
}
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpAddBackNormals(
- const basegfx::B3DPolyPolygon& rNormalsBack,
- const basegfx::B3DPoint& rOffset)
-{
- basegfx::B3DPolyPolygon aRetval;
- basegfx::B3DVector aOffset(rOffset);
- aOffset.normalize();
- basegfx::B3DPoint aValue(aOffset);
- const sal_uInt32 nPolyCount(rNormalsBack.count());
- const bool bClosed(rNormalsBack.isClosed());
-
- for(sal_uInt32 a(0L); a < nPolyCount; a++)
- {
- const basegfx::B3DPolygon aPoly(rNormalsBack.getB3DPolygon(a));
- const sal_uInt32 nPointCount(aPoly.count());
- basegfx::B3DPolygon aNew;
-
- for(sal_uInt32 b(0L); b < nPointCount; b++)
- {
- aNew.append(aPoly.getB3DPoint(b) + aValue);
- }
-
- aNew.setClosed(bClosed);
- aRetval.append(aNew);
- }
-
- return aRetval;
-}
+/*************************************************************************
+|*
+|* SnapRect berechnen
+|*
+\************************************************************************/
-basegfx::B3DPolyPolygon E3dCompoundObject::ImpAddInBetweenNormals(
- const basegfx::B3DPolyPolygon& rPolyPolyFront,
- const basegfx::B3DPolyPolygon& rPolyPolyBack,
- const basegfx::B3DPolyPolygon& rPolyPolyNormals,
- BOOL bSmoothed)
+void E3dCompoundObject::RecalcSnapRect()
{
- basegfx::B3DPolyPolygon aRetval;
- const sal_uInt32 nPolyCnt(rPolyPolyFront.count());
- const bool bClosed(rPolyPolyFront.isClosed());
-
- // Verbindungsstuecke
- for(sal_uInt32 a(0L); a < nPolyCnt; a++)
- {
- const basegfx::B3DPolygon aPoly3DFront(rPolyPolyFront.getB3DPolygon(a));
- const basegfx::B3DPolygon aPoly3DBack(rPolyPolyBack.getB3DPolygon(a));
- const basegfx::B3DPolygon aNormalPoly(rPolyPolyNormals.getB3DPolygon(a));
- const sal_uInt32 nPntCnt(aPoly3DFront.count());
-
- if(aPoly3DBack.isClosed())
- {
- const basegfx::B3DVector aVecA(aPoly3DBack.getB3DPoint(nPntCnt - 1L) - aPoly3DFront.getB3DPoint(nPntCnt - 1L));
- const basegfx::B3DVector aVecB(aPoly3DFront.getB3DPoint(0L) - aPoly3DFront.getB3DPoint(nPntCnt - 1L));
- basegfx::B3DVector aNormal(aVecA.getPerpendicular(aVecB));
- aNormal.normalize();
- basegfx::B3DPolygon aNewPoly;
-
- for(sal_uInt32 i(0L); i < nPntCnt; i++)
- {
- const basegfx::B3DVector aVecC(aPoly3DBack.getB3DPoint(i) - aPoly3DFront.getB3DPoint(i));
- const basegfx::B3DVector aVecD(aPoly3DFront.getB3DPoint((i + 1L == nPntCnt) ? 0L : i + 1L) - aPoly3DFront.getB3DPoint(i));
- basegfx::B3DVector aNextNormal(aVecC.getPerpendicular(aVecD));
- aNextNormal.normalize();
- basegfx::B3DVector aNew;
-
- if(bSmoothed)
- {
- basegfx::B3DVector aMidNormal(aNormal + aNextNormal);
- aMidNormal.normalize();
- aNew = aNormalPoly.getB3DPoint(i) + aMidNormal;
- }
- else
- {
- aNew = aNormalPoly.getB3DPoint(i) + aNormal;
- }
-
- aNew.normalize();
- aNewPoly.append(aNew);
- aNormal = aNextNormal;
- }
-
- aNewPoly.setClosed(bClosed);
- aRetval.append(aNewPoly);
- }
- else
- {
- basegfx::B3DVector aNormal;
-
- if(aPoly3DBack.getB3DPoint(0L) == aPoly3DFront.getB3DPoint(0L))
- {
- const basegfx::B3DVector aVecA(aPoly3DBack.getB3DPoint(1L) - aPoly3DFront.getB3DPoint(1L));
- const basegfx::B3DVector aVecB(aPoly3DFront.getB3DPoint(1L) - aPoly3DFront.getB3DPoint(0L));
- aNormal = aVecA.getPerpendicular(aVecB);
- }
- else
- {
- const basegfx::B3DVector aVecA(aPoly3DBack.getB3DPoint(0L) - aPoly3DFront.getB3DPoint(0L));
- const basegfx::B3DVector aVecB(aPoly3DFront.getB3DPoint(1L) - aPoly3DFront.getB3DPoint(0L));
- aNormal = aVecA.getPerpendicular(aVecB);
- }
-
- aNormal.normalize();
- basegfx::B3DVector aNew(aNormalPoly.getB3DPoint(0L) + aNormal);
- aNew.normalize();
- basegfx::B3DPolygon aNewPoly;
- aNewPoly.append(aNew);
-
- for(sal_uInt32 i(1L); i < nPntCnt; i++)
- {
- basegfx::B3DVector aNextNormal;
-
- if(i + 1L == nPntCnt)
- {
- aNextNormal = aNormal;
- }
- else
- {
- const basegfx::B3DVector aVecA(aPoly3DBack.getB3DPoint(i) - aPoly3DFront.getB3DPoint(i));
- const basegfx::B3DVector aVecB(aPoly3DFront.getB3DPoint(i + 1L) - aPoly3DFront.getB3DPoint(i));
- aNextNormal = aVecA.getPerpendicular(aVecB);
- }
-
- aNextNormal.normalize();
-
- if(bSmoothed)
- {
- basegfx::B3DVector aMidNormal(aNormal + aNextNormal);
- aMidNormal.normalize();
- aNew = aNormalPoly.getB3DPoint(i) + aMidNormal;
- }
- else
- {
- aNew = aNormalPoly.getB3DPoint(i) + aNormal;
- }
-
- aNew.normalize();
- aNewPoly.append(aNew);
- aNormal = aNextNormal;
- }
-
- aNewPoly.setClosed(bClosed);
- aRetval.append(aNewPoly);
- }
- }
-
- return aRetval;
-}
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
+ maSnapRect = Rectangle();
-void E3dCompoundObject::ImpCreateInBetween(
- const basegfx::B3DPolyPolygon& rPolyPolyFront,
- const basegfx::B3DPolyPolygon& rPolyPolyBack,
- const basegfx::B3DPolyPolygon& rFrontNormals,
- const basegfx::B3DPolyPolygon& rBackNormals,
- BOOL bDoCreateNormals,
- double fSurroundFactor,
- double fTextureStart,
- double fTextureDepth,
- BOOL bRotateTexture90)
-{
- const sal_uInt32 nPolyCnt(rPolyPolyFront.count());
- bool bDoCreateTexture(0.0 != fTextureDepth);
- double fPolyLength(0.0), fPolyPos(0.0);
- sal_uInt32 nLastIndex(0L);
-
- // Verbindungsstuecke
- if(bDoCreateNormals)
+ if(pRootScene)
{
- for(sal_uInt32 a(0L); a < nPolyCnt; a++)
- {
- const basegfx::B3DPolygon aPoly3DFront(rPolyPolyFront.getB3DPolygon(a));
- const basegfx::B3DPolygon aPoly3DBack(rPolyPolyBack.getB3DPolygon(a));
- const basegfx::B3DPolygon aPolyNormalsFront(rFrontNormals.getB3DPolygon(a));
- const basegfx::B3DPolygon aPolyNormalsBack(rBackNormals.getB3DPolygon(a));
- const sal_uInt32 nPntCnt(aPoly3DFront.count());
- const sal_uInt32 nPrefillIndex(aPoly3DFront.isClosed() ? nPntCnt - 1L : 0L);
- basegfx::B3DPolygon aRect3D;
- basegfx::B3DPolygon aNormal3D;
- basegfx::B2DPolygon aTexture2D;
-
- aRect3D.append(basegfx::B3DPoint(), 4L);
- aNormal3D.append(basegfx::B3DPoint(), 4L);
- aTexture2D.append(basegfx::B2DPoint(), 4L);
- aRect3D.setB3DPoint(3L, aPoly3DFront.getB3DPoint(nPrefillIndex));
- aRect3D.setB3DPoint(2L, aPoly3DBack.getB3DPoint(nPrefillIndex));
- aNormal3D.setB3DPoint(3L, aPolyNormalsFront.getB3DPoint(nPrefillIndex));
- aNormal3D.setB3DPoint(2L, aPolyNormalsBack.getB3DPoint(nPrefillIndex));
-
- if(bDoCreateTexture)
- {
- fPolyLength = basegfx::tools::getLength(aPoly3DFront);
- fPolyPos = 0.0;
- nLastIndex = aPoly3DFront.isClosed() ? nPntCnt - 1L : 0L;
+ // get VC of 3D candidate
+ const sdr::contact::ViewContactOfE3d* pVCOfE3D = dynamic_cast< const sdr::contact::ViewContactOfE3d* >(&GetViewContact());
- if(bRotateTexture90)
- {
- // X,Y vertauschen
- aTexture2D.setB2DPoint(3L, basegfx::B2DPoint(fTextureStart, (1.0 - fPolyPos) * fSurroundFactor));
- aTexture2D.setB2DPoint(2L, basegfx::B2DPoint(fTextureStart + fTextureDepth, (1.0 - fPolyPos) * fSurroundFactor));
- }
- else
- {
- aTexture2D.setB2DPoint(3L, basegfx::B2DPoint(fPolyPos * fSurroundFactor, fTextureStart));
- aTexture2D.setB2DPoint(2L, basegfx::B2DPoint(fPolyPos * fSurroundFactor, fTextureStart + fTextureDepth));
- }
- }
-
- for(sal_uInt32 i(aPoly3DFront.isClosed() ? 0L : 1L); i < nPntCnt; i++)
- {
- aRect3D.setB3DPoint(0L, aRect3D.getB3DPoint(3L));
- aRect3D.setB3DPoint(1L, aRect3D.getB3DPoint(2L));
-
- aRect3D.setB3DPoint(3L, aPoly3DFront.getB3DPoint(i));
- aRect3D.setB3DPoint(2L, aPoly3DBack.getB3DPoint(i));
-
- aNormal3D.setB3DPoint(0L, aNormal3D.getB3DPoint(3L));
- aNormal3D.setB3DPoint(1L, aNormal3D.getB3DPoint(2L));
-
- aNormal3D.setB3DPoint(3L, aPolyNormalsFront.getB3DPoint(i));
- aNormal3D.setB3DPoint(2L, aPolyNormalsBack.getB3DPoint(i));
-
- if(bDoCreateTexture)
- {
- // Texturkoordinaten ermitteln
- basegfx::B3DVector aPart(aPoly3DFront.getB3DPoint(i) - aPoly3DFront.getB3DPoint(nLastIndex));
- fPolyPos += aPart.getLength() / fPolyLength;
- nLastIndex = i;
-
- // Der Abschnitt am Polygon entspricht dem Teil
- // von fPolyPos bis fPolyPos+fPartLength
-
- aTexture2D.setB2DPoint(0L, aTexture2D.getB2DPoint(3L));
- aTexture2D.setB2DPoint(1L, aTexture2D.getB2DPoint(2L));
-
- if(bRotateTexture90)
- {
- // X,Y vertauschen
- aTexture2D.setB2DPoint(3L, basegfx::B2DPoint(fTextureStart, (1.0 - fPolyPos) * fSurroundFactor));
- aTexture2D.setB2DPoint(2L, basegfx::B2DPoint(fTextureStart + fTextureDepth, (1.0 - fPolyPos) * fSurroundFactor));
- }
- else
- {
- aTexture2D.setB2DPoint(3L, basegfx::B2DPoint(fPolyPos * fSurroundFactor, fTextureStart));
- aTexture2D.setB2DPoint(2L, basegfx::B2DPoint(fPolyPos * fSurroundFactor, fTextureStart + fTextureDepth));
- }
-
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormal3D), basegfx::B2DPolyPolygon(aTexture2D), FALSE);
- }
- else
- {
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormal3D), FALSE);
- }
- }
- }
- }
- else
- {
- for(sal_uInt32 a(0L); a < nPolyCnt; a++)
+ if(pVCOfE3D)
{
- const basegfx::B3DPolygon aPoly3DFront(rPolyPolyFront.getB3DPolygon(a));
- const basegfx::B3DPolygon aPoly3DBack(rPolyPolyBack.getB3DPolygon(a));
- basegfx::B3DPolygon aRect3D;
- const sal_uInt32 nPntCnt(aPoly3DFront.count());
- const sal_uInt32 nPrefillIndex(aPoly3DFront.isClosed() ? nPntCnt - 1L : 0L);
-
- aRect3D.append(basegfx::B3DPoint(), 4L);
- aRect3D.setB3DPoint(3L, aPoly3DFront.getB3DPoint(nPrefillIndex));
- aRect3D.setB3DPoint(2L, aPoly3DBack.getB3DPoint(nPrefillIndex));
+ // get 3D primitive sequence
+ const drawinglayer::primitive3d::Primitive3DSequence xLocalSequence(pVCOfE3D->getViewIndependentPrimitive3DSequence());
- for(sal_uInt32 i(aPoly3DFront.isClosed() ? 0L : 1L); i < nPntCnt; i++)
+ if(xLocalSequence.hasElements())
{
- aRect3D.setB3DPoint(0L, aRect3D.getB3DPoint(3L));
- aRect3D.setB3DPoint(1L, aRect3D.getB3DPoint(2L));
-
- aRect3D.setB3DPoint(3L, aPoly3DFront.getB3DPoint(i));
- aRect3D.setB3DPoint(2L, aPoly3DBack.getB3DPoint(i));
-
- AddGeometry(basegfx::B3DPolyPolygon(aRect3D), FALSE);
+ // get BoundVolume
+ basegfx::B3DRange aBoundVolume(drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(
+ xLocalSequence, aViewInfo3D));
+
+ // transform bound volume to relative scene coordinates
+ aBoundVolume.transform(aViewInfo3D.getObjectToView());
+
+ // build 2d relative scene range
+ basegfx::B2DRange aSnapRange(
+ aBoundVolume.getMinX(), aBoundVolume.getMinY(),
+ aBoundVolume.getMaxX(), aBoundVolume.getMaxY());
+
+ // transform to 2D world coordiantes
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+ aSnapRange.transform(rVCScene.getObjectTransformation());
+
+ // snap to integer
+ maSnapRect = Rectangle(
+ sal_Int32(floor(aSnapRange.getMinX())), sal_Int32(floor(aSnapRange.getMinY())),
+ sal_Int32(ceil(aSnapRange.getMaxX())), sal_Int32(ceil(aSnapRange.getMaxY())));
}
}
}
@@ -2270,16 +1208,9 @@ void E3dCompoundObject::operator=(const SdrObject& rObj)
// weitere Parameter kopieren
const E3dCompoundObject& r3DObj = (const E3dCompoundObject&) rObj;
- aDisplayGeometry = r3DObj.aDisplayGeometry;
bCreateNormals = r3DObj.bCreateNormals;
bCreateTexture = r3DObj.bCreateTexture;
- bGeometryValid = r3DObj.bGeometryValid;
-
- // neu ab 383:
aMaterialAmbientColor = r3DObj.aMaterialAmbientColor;
-
- aBackMaterial = r3DObj.aBackMaterial;
- bUseDifferentBackMaterial = r3DObj.bUseDifferentBackMaterial;
}
/*************************************************************************
@@ -2288,572 +1219,14 @@ void E3dCompoundObject::operator=(const SdrObject& rObj)
|*
\************************************************************************/
-// #110988# test if given hit candidate point is inside bound volume of object
-sal_Bool E3dCompoundObject::ImpIsInsideBoundVolume(const basegfx::B3DPoint& rFront, const basegfx::B3DPoint& rBack, const Point& /*rPnt*/) const
-{
- const Volume3D& rBoundVol = ((E3dCompoundObject*)this)->GetBoundVolume();
-
- if(!rBoundVol.isEmpty())
- {
- double fXMax = rFront.getX();
- double fXMin = rBack.getX();
-
- if(fXMax < fXMin)
- {
- fXMax = rBack.getX();
- fXMin = rFront.getX();
- }
-
- if(rBoundVol.getMinX() <= fXMax && rBoundVol.getMaxX() >= fXMin)
- {
- double fYMax = rFront.getY();
- double fYMin = rBack.getY();
-
- if(fYMax < fYMin)
- {
- fYMax = rBack.getY();
- fYMin = rFront.getY();
- }
-
- if(rBoundVol.getMinY() <= fYMax && rBoundVol.getMaxY() >= fYMin)
- {
- double fZMax = rFront.getZ();
- double fZMin = rBack.getZ();
-
- if(fZMax < fZMin)
- {
- fZMax = rBack.getZ();
- fZMin = rFront.getZ();
- }
-
- if(rBoundVol.getMinZ() <= fZMax && rBoundVol.getMaxZ() >= fZMin)
- {
- return sal_True;
- }
- }
- }
- }
-
- return sal_False;
-}
-
-SdrObject* E3dCompoundObject::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* /*pVisiLayer*/) const
-{
- E3dPolyScene* pScene = (E3dPolyScene*)GetScene();
-
- if(pScene)
- {
- // get HitLine in ObjectKoordinates
- // set ObjectTrans
- basegfx::B3DHomMatrix mTransform = GetFullTransform();
- pScene->GetCameraSet().SetObjectTrans(mTransform);
-
- // create HitPoint Front und Back, transform to object coordinates
- basegfx::B3DPoint aFront(rPnt.X(), rPnt.Y(), 0.0);
- basegfx::B3DPoint aBack(rPnt.X(), rPnt.Y(), ZBUFFER_DEPTH_RANGE);
- aFront = pScene->GetCameraSet().ViewToObjectCoor(aFront);
- aBack = pScene->GetCameraSet().ViewToObjectCoor(aBack);
-
- if(ImpIsInsideBoundVolume(aFront, aBack, rPnt))
- {
- // Geometrie herstellen
- if(!bGeometryValid)
- ((E3dCompoundObject*)this)->ReCreateGeometry();
-
- // 3D Volumes schneiden sich, teste in der Geometrie
- // auf Basis der Projektion weiter
- if(((E3dCompoundObject*)this)->aDisplayGeometry.CheckHit(aFront, aBack, nTol))
- {
- return ((E3dCompoundObject*)this);
- }
- }
- }
-
- return 0L;
-}
-
-/*************************************************************************
-|*
-|* Schattenattribute holen
-|*
-\************************************************************************/
-
-Color E3dCompoundObject::GetShadowColor() const
-{
- return ((SdrShadowColorItem&)(GetObjectItem(SDRATTR_SHADOWCOLOR))).GetColorValue();
-}
-
-BOOL E3dCompoundObject::DrawShadowAsOutline() const
-{
- const SfxItemSet& rSet = GetObjectItemSet();
- XFillStyle eFillStyle = ((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
-{
- return (long)((SdrShadowYDistItem&)(GetObjectItem(SDRATTR_SHADOWYDIST))).GetValue();
-}
-
-BOOL E3dCompoundObject::DoDrawShadow()
+SdrObject* E3dCompoundObject::CheckHit(const Point& rPnt, USHORT /*nTol*/, const SetOfByte* /*pVisiLayer*/) const
{
- 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 eb39b7465a..68e9e3833a 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 49150d90d6..5dcc814d35 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 a8c358a2fb..3d0ecf23e6 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()
+void E3dScene::removeAllNonSelectedObjects()
{
- 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());
+ E3DModifySceneSnapRectUpdater aUpdater(this);
- // #i85887#
- static basegfx::B3DRange aLastVolume;
- if(aVolume != aLastVolume)
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
{
- // 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()
-{
- basegfx::B3DPoint aTfVec;
- Volume3D aFitVol;
+ SdrObject* pObj = maSubList.GetObj(a);
- SetBoundVolInvalid();
- basegfx::B3DHomMatrix aTransform = aCamera.GetViewTransform() * GetFullTransform(); // #112587#
- Vol3DPointIterator aIter(GetBoundVolume(), &aTransform);
- Rectangle aRect;
-
- while ( aIter.Next(aTfVec) )
- {
- 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();
-
- // #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 3807504a7c..b6910274f4 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 f171fe4d64..d5c9136aee 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)
+ pScene = ((E3dObject*)pObj)->GetScene();
+
+ if(pScene && !IsObjMarked(pScene) && GetSdrPageView())
{
- if(pObj->ISA(E3dCompoundObject))
- {
- // zugehoerige Szene holen
- pScene = ((E3dCompoundObject*)pObj)->GetScene();
- if(pScene)
- pObj = pScene;
- }
-
- // Keine Objekte doppelt markieren
- // (dies koennten nur Szenen sein)
- if(!IsObjMarked(pObj))
- {
- if(GetSdrPageView())
- {
- ((E3dView*)this)->MarkObj(pObj, GetSdrPageView(), FALSE, TRUE);
- }
- }
+ ((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;
-
- // 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();
+ // 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;
+ }
- // #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);
-
- if(aOffset.X() != 0 || aOffset.Y() != 0)
- {
- aSrcCenter += basegfx::B3DPoint((double)aOffset.X(), (double)aOffset.Y(), 0.0);
- }
+ const double fObjSize(aObjectScale.getY() * fScale);
+ const double fFactor((aSceneScale.getY() * 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);
-
- // convert aSrcCenter to a eye position of dst scene
- basegfx::B3DPoint aNewDstCenter(rCameraSetDst.ViewToEyeCoor(aSrcCenter));
- aNewDstCenter.setZ(aDstCenter.getZ());
-
- // transform back to object coor
- aNewDstCenter = rCameraSetDst.EyeToObjectCoor(aNewDstCenter);
-
- // get transform vector
- basegfx::B3DPoint aTransformCorrection(aNewDstCenter - pNew->GetCenter());
- basegfx::B3DHomMatrix aTransCorrMat;
- aTransCorrMat.translate(aTransformCorrection.getX(), aTransformCorrection.getY(), aTransformCorrection.getZ());
-
- // treanslate new object, add translate in front of obj transform
- pNew->SetTransform(pNew->GetTransform() * aTransCorrMat); // #112587#
-
- // force new camera and SnapRect on scene, geometry may have really
- // changed
- pDstScene->CorrectSceneDimensions();
-
- //Rectangle aOldPosSize = pObj->GetSnapRect();
- //if(aOffset.X() != 0 || aOffset.Y() != 0)
- // aOldPosSize.Move(aOffset.X(), aOffset.Y());
- //Rectangle aNewPosSize = pNew->GetSnapRect();
+ 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;
}
+ // get translation adaption
+ const basegfx::B3DPoint aSceneCenter(aSceneRange.getCenter());
+ const basegfx::B3DPoint aObjectCenter(aObjectRange.getCenter());
+
+ // 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);
+
+ // translate to absolute center in 3d world coor
+ aModifyingTransform.translate(-aObjectCenter.getX(), -aObjectCenter.getY(), -aObjectCenter.getZ());
+
+ // scale to dest size in 3d world coor
+ aModifyingTransform.scale(fScale, fScale, fScale);
+
+ // translate to dest scene center in 3d world coor
+ aModifyingTransform.translate(aSceneCenter.getX(), aSceneCenter.getY(), aSceneCenter.getZ());
+
+ // transform from 3d world to dest object coordinates
+ basegfx::B3DHomMatrix aWorldToObject(aObjectToWorldTrans);
+ aWorldToObject.invert();
+ aModifyingTransform = aWorldToObject * aModifyingTransform;
+
+ // 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 2f4e8bae61..a54696edeb 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 1c5c0ec65e..1010b44f22 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 7d10742452..ef4f704d42 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 ae0b06f6e7..092ccadc36 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 e1de275775..bc157bb8cc 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 92f46c2159..7f4b9bf9f0 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 d916a5fe6b..783a008866 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 current Primitive2DSequence
+ return xRetval;
+ }
- return 0L;
+ 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 fab53438b0..8bde7b3c45 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 92429ecb7f..954b54396a 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 90c24131fc..5ef516f9a0 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 394813270e..5c84da834f 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 d53cd151e2..cf5768910f 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 4cd8e56b3e..8dad4c0d93 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 6b15d95704..3f6ac13caf 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 1bce002f8a..136971a353 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 37ba346566..9ef9832871 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 b0623002fd..044e55ead2 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 862ec750ca..2a600fd5d5 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 e8d150733d..7a6e115490 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 a2cce0b2fa..6f904d8910 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;
+ namespace contact
+ {
+ 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);
- public:
- // basic constructor/destructor
- PagePrimitiveExtractor(
- sdr::contact::ViewObjectContactOfPageObj& rVOC);
- virtual ~PagePrimitiveExtractor();
+ // init timer
+ SetTimeout(1);
+ Stop();
+ }
- // 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);
+ PagePrimitiveExtractor::~PagePrimitiveExtractor()
+ {
+ // execute missing LazyInvalidates and stop timer
+ Timeout();
+ }
+
+ 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
- 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)
- {
- // make this renderer a preview renderer
- setPreviewRenderer(true);
-
- // init timer
- SetTimeout(1);
- Stop();
- }
-
- 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();
- }
-
- // From baseclass Timer, the timeout call triggered by te LazyInvalidate mechanism
- void PagePrimitiveExtractor::Timeout()
- {
- // stop the timer
- Stop();
+ 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 33f01344db..e9d5188b9f 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 b1ac95ce88..61266c50d2 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);
-
- 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()));
- }
+ 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(((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 e51a8bdef9..b76a5da484 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 0484f7f77d..491dd71744 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 9700c6dca3..d96691b6ca 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 d488f27f62..ee65b711ef 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 6bed71ff9c..2693eac391 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 c3eb2acd5a..3b8020be70 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 22e72bc069..df649c91a5 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 9b19f3fd20..cec6082ed1 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 eb63054727..bdb4017769 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 56f5e0493f..f7f1e12af7 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 6550e88f79..80ad3b0dc2 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 8bacf5fe8c..5726758b72 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 b1a017f8f6..830a97c4e3 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 287c5db01a..4f3a8d7a5d 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 aa7fe8a8d8..e0590d5987 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 ac42b019aa..28ebae1b9a 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 7e78bc2fbb..c2c74b8d16 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 9f8b561bfc..75da911e8c 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 06c72f9419..d0d2cd01d2 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 4774f7eaae..38562707ac 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 ecdaf55e15..4e75949ca2 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 e601eddebf..75394431e5 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 9d116a06a0..d27f870c1e 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 73d738888d..f41a076f9c 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 9e8494d69f..706a689077 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 199d566005..71cb627695 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 43b6748e76..6afdb11856 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 205dd7e454..958148e835 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 ccb2e53bd4..920a05bd24 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 b3dab4e4e7..ee45c6be3e 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 803da80177..4ca31e90ef 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 ee0d3179c9..832e1dead0 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 3196909c25..c6c1c06ddf 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 4ef0ef4f5c..9d87f7f5e2 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 cdd095b2b8..73d0ff761b 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 4d1c1892f7..61fdf00f0c 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 4f70684094..b34ba12ccf 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 547465c73a..859ad24934 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 d841f01274..b38390c360 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 2e23f98286..9fed4c8c9a 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 b405937e41..8f5979ad0f 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 7bfdf621e8..2036ea3ca5 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 ab6a26eef1..a5ec671c71 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 64ac590012..0af6d2f2be 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 14a2ba23f7..0171d424ba 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 30120e6542..cefb0054b4 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 c98137c1ac..e0981d8f7b 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;