[Libreoffice-commits] core.git: 2 commits - svx/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Thu Aug 6 12:21:04 UTC 2020
svx/source/core/extedit.cxx | 30
svx/source/customshapes/EnhancedCustomShape2d.cxx | 320 ++--
svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 72 -
svx/source/engine3d/dragmt3d.cxx | 596 ++++----
svx/source/engine3d/e3dsceneupdater.cxx | 141 +-
svx/source/engine3d/helperhittest3d.cxx | 138 +-
svx/source/engine3d/lathe3d.cxx | 28
svx/source/engine3d/obj3d.cxx | 56
svx/source/engine3d/scene3d.cxx | 28
svx/source/engine3d/view3d.cxx | 646 ++++-----
svx/source/fmcomp/fmgridcl.cxx | 219 +--
svx/source/fmcomp/fmgridif.cxx | 362 ++---
svx/source/fmcomp/gridcell.cxx | 128 -
svx/source/fmcomp/gridctrl.cxx | 406 +++---
svx/source/form/datanavi.cxx | 292 ++--
svx/source/form/filtnav.cxx | 24
svx/source/form/fmPropBrw.cxx | 86 -
svx/source/form/fmexch.cxx | 24
svx/source/form/fmshimp.cxx | 248 +--
svx/source/form/fmsrcimp.cxx | 34
svx/source/form/fmundo.cxx | 369 ++---
svx/source/form/fmview.cxx | 52
svx/source/form/fmvwimp.cxx | 214 +--
svx/source/form/formcontroller.cxx | 150 +-
svx/source/form/navigatortree.cxx | 104 -
svx/source/form/navigatortreemodel.cxx | 22
svx/source/gallery2/codec.cxx | 100 -
svx/source/gallery2/galbrws1.cxx | 70 -
svx/source/gallery2/galbrws2.cxx | 298 ++--
svx/source/gallery2/galctrl.cxx | 20
svx/source/gallery2/gallery1.cxx | 26
svx/source/gallery2/galmisc.cxx | 26
svx/source/gallery2/galobj.cxx | 22
svx/source/items/customshapeitem.cxx | 54
svx/source/items/numfmtsh.cxx | 94 -
svx/source/sidebar/ContextChangeEventMultiplexer.cxx | 34
svx/source/sidebar/area/AreaPropertyPanelBase.cxx | 58
svx/source/sidebar/inspector/InspectorTextPanel.cxx | 30
svx/source/sidebar/line/LinePropertyPanelBase.cxx | 94 -
svx/source/sidebar/nbdtmg.cxx | 38
svx/source/sidebar/possize/PosSizePropertyPanel.cxx | 24
svx/source/smarttags/SmartTagMgr.cxx | 100 -
svx/source/svdraw/charthelper.cxx | 36
svx/source/svdraw/clonelist.cxx | 22
svx/source/svdraw/sdrpagewindow.cxx | 22
svx/source/svdraw/svdcrtv.cxx | 251 +--
svx/source/svdraw/svddrgmt.cxx | 964 +++++++-------
svx/source/svdraw/svddrgv.cxx | 164 +-
svx/source/svdraw/svdedtv.cxx | 432 +++---
svx/source/svdraw/svdedtv1.cxx | 92 -
svx/source/svdraw/svdedtv2.cxx | 982 +++++++-------
svx/source/svdraw/svdedxv.cxx | 737 +++++------
svx/source/svdraw/svdfmtf.cxx | 538 ++++----
svx/source/svdraw/svdglev.cxx | 29
svx/source/svdraw/svdglue.cxx | 28
svx/source/svdraw/svdhdl.cxx | 1071 +++++++---------
svx/source/svdraw/svdlayer.cxx | 28
svx/source/svdraw/svdmark.cxx | 204 +--
svx/source/svdraw/svdmodel.cxx | 116 -
svx/source/svdraw/svdmrkv.cxx | 202 +--
svx/source/svdraw/svdoashp.cxx | 590 ++++----
svx/source/svdraw/svdobj.cxx | 277 ++--
svx/source/svdraw/svdocirc.cxx | 94 -
svx/source/svdraw/svdoedge.cxx | 141 +-
svx/source/svdraw/svdograf.cxx | 62
svx/source/svdraw/svdogrp.cxx | 134 +-
svx/source/svdraw/svdomeas.cxx | 82 -
svx/source/svdraw/svdomedia.cxx | 62
svx/source/svdraw/svdoole2.cxx | 620 ++++-----
svx/source/svdraw/svdopage.cxx | 26
svx/source/svdraw/svdopath.cxx | 34
svx/source/svdraw/svdorect.cxx | 30
svx/source/svdraw/svdotext.cxx | 94 -
svx/source/svdraw/svdotextdecomposition.cxx | 182 +-
svx/source/svdraw/svdotxat.cxx | 116 -
svx/source/svdraw/svdouno.cxx | 26
svx/source/svdraw/svdoutlinercache.cxx | 46
svx/source/svdraw/svdpage.cxx | 134 +-
svx/source/svdraw/svdpagv.cxx | 258 +--
svx/source/svdraw/svdpdf.cxx | 168 +-
svx/source/svdraw/svdpntv.cxx | 76 -
svx/source/svdraw/svdpoev.cxx | 306 ++--
svx/source/svdraw/svdsnpv.cxx | 72 -
svx/source/svdraw/svdtext.cxx | 54
svx/source/svdraw/svdundo.cxx | 156 +-
svx/source/svdraw/svdview.cxx | 36
svx/source/table/accessiblecell.cxx | 20
svx/source/table/accessibletableshape.cxx | 107 -
svx/source/table/cell.cxx | 118 -
svx/source/table/svdotable.cxx | 132 +
svx/source/table/tablecontroller.cxx | 859 ++++++------
svx/source/table/tabledesign.cxx | 26
svx/source/table/tablehandles.cxx | 164 +-
svx/source/table/tablelayouter.cxx | 10
svx/source/table/tablemodel.cxx | 526 +++----
svx/source/table/tablerow.cxx | 56
svx/source/table/tableundo.cxx | 34
svx/source/toolbars/extrusionbar.cxx | 44
svx/source/toolbars/fontworkbar.cxx | 136 +-
svx/source/unodraw/gluepts.cxx | 44
svx/source/unodraw/unomod.cxx | 20
svx/source/unodraw/unopage.cxx | 70 -
svx/source/unodraw/unoshap2.cxx | 76 -
svx/source/unodraw/unoshap4.cxx | 52
svx/source/unodraw/unoshape.cxx | 412 +++---
svx/source/unodraw/unoshtxt.cxx | 92 -
svx/source/xml/xmlgrhlp.cxx | 102 -
svx/source/xoutdev/_xpoly.cxx | 68 -
108 files changed, 9434 insertions(+), 9405 deletions(-)
New commits:
commit 8f719de217b1079bd985b3bc63bbfa97069483bc
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Aug 6 12:58:50 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 6 14:20:20 2020 +0200
loplugin:flatten in svx
Change-Id: I31f33a5f693d5fdb8282181c5bd7f31971efe784
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100236
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/svx/source/core/extedit.cxx b/svx/source/core/extedit.cxx
index b6e1387aba50..3225e47f02bb 100644
--- a/svx/source/core/extedit.cxx
+++ b/svx/source/core/extedit.cxx
@@ -184,21 +184,21 @@ void SdrExternalToolEdit::Update(Graphic & rGraphic)
{
assert(m_pObj && m_pView); // timer should be deleted by Notify() too
SdrPageView *const pPageView = m_pView->GetSdrPageView();
- if (pPageView)
- {
- SdrGrafObj *const pNewObj(static_cast<SdrGrafObj*>(m_pObj->CloneSdrObject(m_pObj->getSdrModelFromSdrObject())));
- assert(pNewObj);
- OUString const description =
- m_pView->GetDescriptionOfMarkedObjects() + " External Edit";
- m_pView->BegUndo(description);
- pNewObj->SetGraphicObject(rGraphic);
- // set to new object before ReplaceObjectAtView() so that Notify() will
- // not delete the running timer and crash
- SdrObject *const pOldObj = m_pObj;
- m_pObj = pNewObj;
- m_pView->ReplaceObjectAtView(pOldObj, *pPageView, pNewObj);
- m_pView->EndUndo();
- }
+ if (!pPageView)
+ return;
+
+ SdrGrafObj *const pNewObj(static_cast<SdrGrafObj*>(m_pObj->CloneSdrObject(m_pObj->getSdrModelFromSdrObject())));
+ assert(pNewObj);
+ OUString const description =
+ m_pView->GetDescriptionOfMarkedObjects() + " External Edit";
+ m_pView->BegUndo(description);
+ pNewObj->SetGraphicObject(rGraphic);
+ // set to new object before ReplaceObjectAtView() so that Notify() will
+ // not delete the running timer and crash
+ SdrObject *const pOldObj = m_pObj;
+ m_pObj = pNewObj;
+ m_pView->ReplaceObjectAtView(pOldObj, *pPageView, pNewObj);
+ m_pView->EndUndo();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 123179c1100a..1e42bc0b720b 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -801,24 +801,24 @@ EnhancedCustomShape2d::EnhancedCustomShape2d(SdrObjCustomShape& rSdrObjCustomSha
sal_Int32 nLength = seqEquations.getLength();
- if ( nLength )
+ if ( !nLength )
+ return;
+
+ vNodesSharedPtr.resize( nLength );
+ vEquationResults.resize( nLength );
+ for ( sal_Int32 i = 0; i < nLength; i++ )
{
- vNodesSharedPtr.resize( nLength );
- vEquationResults.resize( nLength );
- for ( sal_Int32 i = 0; i < nLength; i++ )
+ vEquationResults[ i ].bReady = false;
+ try
{
- vEquationResults[ i ].bReady = false;
- try
- {
- vNodesSharedPtr[ i ] = EnhancedCustomShape::FunctionParser::parseFunction( seqEquations[ i ], *this );
- }
- catch ( EnhancedCustomShape::ParseError& )
- {
- SAL_INFO(
- "svx",
- "error: equation number: " << i << ", parser failed ("
- << seqEquations[i] << ")");
- }
+ vNodesSharedPtr[ i ] = EnhancedCustomShape::FunctionParser::parseFunction( seqEquations[ i ], *this );
+ }
+ catch ( EnhancedCustomShape::ParseError& )
+ {
+ SAL_INFO(
+ "svx",
+ "error: equation number: " << i << ", parser failed ("
+ << seqEquations[i] << ")");
}
}
}
@@ -2556,89 +2556,89 @@ void EnhancedCustomShape2d::CreateSubPath(
aNewB2DPolyPolygon.append(aNewB2DPolygon);
}
- if(aNewB2DPolyPolygon.count())
+ if(!aNewB2DPolyPolygon.count())
+ return;
+
+ // #i37011#
+ bool bForceCreateTwoObjects(false);
+
+ if(!bSortFilledObjectsToBack && !aNewB2DPolyPolygon.isClosed() && !bNoStroke)
+ {
+ bForceCreateTwoObjects = true;
+ }
+
+ if(bLineGeometryNeededOnly)
{
- // #i37011#
- bool bForceCreateTwoObjects(false);
+ bForceCreateTwoObjects = true;
+ bNoFill = true;
+ bNoStroke = false;
+ }
- if(!bSortFilledObjectsToBack && !aNewB2DPolyPolygon.isClosed() && !bNoStroke)
- {
- bForceCreateTwoObjects = true;
+ if(bForceCreateTwoObjects || bSortFilledObjectsToBack)
+ {
+ if(bFilled && !bNoFill)
+ {
+ basegfx::B2DPolyPolygon aClosedPolyPolygon(aNewB2DPolyPolygon);
+ aClosedPolyPolygon.setClosed(true);
+ SdrPathObj* pFill = new SdrPathObj(
+ mrSdrObjCustomShape.getSdrModelFromSdrObject(),
+ OBJ_POLY,
+ aClosedPolyPolygon);
+ SfxItemSet aTempSet(*this);
+ aTempSet.Put(makeSdrShadowItem(false));
+ aTempSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
+ pFill->SetMergedItemSet(aTempSet);
+ rObjectList.push_back(std::pair< SdrPathObj*, double >(pFill, dBrightness));
}
- if(bLineGeometryNeededOnly)
+ if(!bNoStroke)
{
- bForceCreateTwoObjects = true;
- bNoFill = true;
- bNoStroke = false;
+ // there is no reason to use OBJ_PLIN here when the polygon is actually closed,
+ // the non-fill is defined by XFILL_NONE. Since SdrPathObj::ImpForceKind() needs
+ // to correct the polygon (here: open it) using the type, the last edge may get lost.
+ // Thus, use a type that fits the polygon
+ SdrPathObj* pStroke = new SdrPathObj(
+ mrSdrObjCustomShape.getSdrModelFromSdrObject(),
+ aNewB2DPolyPolygon.isClosed() ? OBJ_POLY : OBJ_PLIN,
+ aNewB2DPolyPolygon);
+ SfxItemSet aTempSet(*this);
+ aTempSet.Put(makeSdrShadowItem(false));
+ aTempSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
+ pStroke->SetMergedItemSet(aTempSet);
+ rObjectList.push_back(std::pair< SdrPathObj*, double >(pStroke, dBrightness));
}
+ }
+ else
+ {
+ SdrPathObj* pObj = nullptr;
+ SfxItemSet aTempSet(*this);
+ aTempSet.Put(makeSdrShadowItem(false));
- if(bForceCreateTwoObjects || bSortFilledObjectsToBack)
+ if(bNoFill)
{
- if(bFilled && !bNoFill)
- {
- basegfx::B2DPolyPolygon aClosedPolyPolygon(aNewB2DPolyPolygon);
- aClosedPolyPolygon.setClosed(true);
- SdrPathObj* pFill = new SdrPathObj(
- mrSdrObjCustomShape.getSdrModelFromSdrObject(),
- OBJ_POLY,
- aClosedPolyPolygon);
- SfxItemSet aTempSet(*this);
- aTempSet.Put(makeSdrShadowItem(false));
- aTempSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
- pFill->SetMergedItemSet(aTempSet);
- rObjectList.push_back(std::pair< SdrPathObj*, double >(pFill, dBrightness));
- }
-
- if(!bNoStroke)
- {
- // there is no reason to use OBJ_PLIN here when the polygon is actually closed,
- // the non-fill is defined by XFILL_NONE. Since SdrPathObj::ImpForceKind() needs
- // to correct the polygon (here: open it) using the type, the last edge may get lost.
- // Thus, use a type that fits the polygon
- SdrPathObj* pStroke = new SdrPathObj(
- mrSdrObjCustomShape.getSdrModelFromSdrObject(),
- aNewB2DPolyPolygon.isClosed() ? OBJ_POLY : OBJ_PLIN,
- aNewB2DPolyPolygon);
- SfxItemSet aTempSet(*this);
- aTempSet.Put(makeSdrShadowItem(false));
- aTempSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
- pStroke->SetMergedItemSet(aTempSet);
- rObjectList.push_back(std::pair< SdrPathObj*, double >(pStroke, dBrightness));
- }
+ // see comment above about OBJ_PLIN
+ pObj = new SdrPathObj(
+ mrSdrObjCustomShape.getSdrModelFromSdrObject(),
+ aNewB2DPolyPolygon.isClosed() ? OBJ_POLY : OBJ_PLIN,
+ aNewB2DPolyPolygon);
+ aTempSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
}
else
{
- SdrPathObj* pObj = nullptr;
- SfxItemSet aTempSet(*this);
- aTempSet.Put(makeSdrShadowItem(false));
-
- if(bNoFill)
- {
- // see comment above about OBJ_PLIN
- pObj = new SdrPathObj(
- mrSdrObjCustomShape.getSdrModelFromSdrObject(),
- aNewB2DPolyPolygon.isClosed() ? OBJ_POLY : OBJ_PLIN,
- aNewB2DPolyPolygon);
- aTempSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
- }
- else
- {
- aNewB2DPolyPolygon.setClosed(true);
- pObj = new SdrPathObj(
- mrSdrObjCustomShape.getSdrModelFromSdrObject(),
- OBJ_POLY,
- aNewB2DPolyPolygon);
- }
-
- if(bNoStroke)
- {
- aTempSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
- }
+ aNewB2DPolyPolygon.setClosed(true);
+ pObj = new SdrPathObj(
+ mrSdrObjCustomShape.getSdrModelFromSdrObject(),
+ OBJ_POLY,
+ aNewB2DPolyPolygon);
+ }
- pObj->SetMergedItemSet(aTempSet);
- rObjectList.push_back(std::pair< SdrPathObj*, double >(pObj, dBrightness));
+ if(bNoStroke)
+ {
+ aTempSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
}
+
+ pObj->SetMergedItemSet(aTempSet);
+ rObjectList.push_back(std::pair< SdrPathObj*, double >(pObj, dBrightness));
}
}
@@ -2748,83 +2748,83 @@ void EnhancedCustomShape2d::AdaptObjColor(
sal_uInt32& nColorIndex,
sal_uInt32 nColorCount)
{
- if ( !rObj.IsLine() )
+ if ( rObj.IsLine() )
+ return;
+
+ const drawing::FillStyle eFillStyle = rObj.GetMergedItem(XATTR_FILLSTYLE).GetValue();
+ switch( eFillStyle )
{
- const drawing::FillStyle eFillStyle = rObj.GetMergedItem(XATTR_FILLSTYLE).GetValue();
- switch( eFillStyle )
+ default:
+ case drawing::FillStyle_SOLID:
{
- default:
- case drawing::FillStyle_SOLID:
+ Color aFillColor;
+
+ if ( nColorCount || 0.0 != dBrightness )
{
- Color aFillColor;
+ aFillColor = GetColorData(
+ rCustomShapeSet.Get( XATTR_FILLCOLOR ).GetColorValue(),
+ std::min(nColorIndex, nColorCount-1),
+ dBrightness );
+ rObj.SetMergedItem( XFillColorItem( "", aFillColor ) );
+ }
+ break;
+ }
+ case drawing::FillStyle_GRADIENT:
+ {
+ XGradient aXGradient(rObj.GetMergedItem(XATTR_FILLGRADIENT).GetGradientValue());
- if ( nColorCount || 0.0 != dBrightness )
- {
- aFillColor = GetColorData(
- rCustomShapeSet.Get( XATTR_FILLCOLOR ).GetColorValue(),
+ if ( nColorCount || 0.0 != dBrightness )
+ {
+ aXGradient.SetStartColor(
+ GetColorData(
+ aXGradient.GetStartColor(),
std::min(nColorIndex, nColorCount-1),
- dBrightness );
- rObj.SetMergedItem( XFillColorItem( "", aFillColor ) );
- }
- break;
+ dBrightness ));
+ aXGradient.SetEndColor(
+ GetColorData(
+ aXGradient.GetEndColor(),
+ std::min(nColorIndex, nColorCount-1),
+ dBrightness ));
}
- case drawing::FillStyle_GRADIENT:
- {
- XGradient aXGradient(rObj.GetMergedItem(XATTR_FILLGRADIENT).GetGradientValue());
- if ( nColorCount || 0.0 != dBrightness )
- {
- aXGradient.SetStartColor(
- GetColorData(
- aXGradient.GetStartColor(),
- std::min(nColorIndex, nColorCount-1),
- dBrightness ));
- aXGradient.SetEndColor(
- GetColorData(
- aXGradient.GetEndColor(),
- std::min(nColorIndex, nColorCount-1),
- dBrightness ));
- }
+ rObj.SetMergedItem( XFillGradientItem( "", aXGradient ) );
+ break;
+ }
+ case drawing::FillStyle_HATCH:
+ {
+ XHatch aXHatch(rObj.GetMergedItem(XATTR_FILLHATCH).GetHatchValue());
- rObj.SetMergedItem( XFillGradientItem( "", aXGradient ) );
- break;
- }
- case drawing::FillStyle_HATCH:
+ if ( nColorCount || 0.0 != dBrightness )
{
- XHatch aXHatch(rObj.GetMergedItem(XATTR_FILLHATCH).GetHatchValue());
-
- if ( nColorCount || 0.0 != dBrightness )
- {
- aXHatch.SetColor(
- GetColorData(
- aXHatch.GetColor(),
- std::min(nColorIndex, nColorCount-1),
- dBrightness ));
- }
-
- rObj.SetMergedItem( XFillHatchItem( "", aXHatch ) );
- break;
+ aXHatch.SetColor(
+ GetColorData(
+ aXHatch.GetColor(),
+ std::min(nColorIndex, nColorCount-1),
+ dBrightness ));
}
- case drawing::FillStyle_BITMAP:
+
+ rObj.SetMergedItem( XFillHatchItem( "", aXHatch ) );
+ break;
+ }
+ case drawing::FillStyle_BITMAP:
+ {
+ if ( nColorCount || 0.0 != dBrightness )
{
- if ( nColorCount || 0.0 != dBrightness )
- {
- BitmapEx aBitmap(rObj.GetMergedItem(XATTR_FILLBITMAP).GetGraphicObject().GetGraphic().GetBitmapEx());
+ BitmapEx aBitmap(rObj.GetMergedItem(XATTR_FILLBITMAP).GetGraphicObject().GetGraphic().GetBitmapEx());
- short nLuminancePercent = static_cast< short > ( GetLuminanceChange(
- std::min(nColorIndex, nColorCount-1)));
- aBitmap.Adjust( nLuminancePercent, 0, 0, 0, 0 );
+ short nLuminancePercent = static_cast< short > ( GetLuminanceChange(
+ std::min(nColorIndex, nColorCount-1)));
+ aBitmap.Adjust( nLuminancePercent, 0, 0, 0, 0 );
- rObj.SetMergedItem(XFillBitmapItem(OUString(), Graphic(aBitmap)));
- }
-
- break;
+ rObj.SetMergedItem(XFillBitmapItem(OUString(), Graphic(aBitmap)));
}
- }
- if ( nColorIndex < nColorCount )
- nColorIndex++;
+ break;
+ }
}
+
+ if ( nColorIndex < nColorCount )
+ nColorIndex++;
}
SdrObject* EnhancedCustomShape2d::CreatePathObj( bool bLineGeometryNeededOnly )
@@ -3014,20 +3014,20 @@ SdrObject* EnhancedCustomShape2d::CreateObject( bool bLineGeometryNeededOnly )
void EnhancedCustomShape2d::ApplyGluePoints( SdrObject* pObj )
{
- if ( pObj )
- {
- for ( const auto& rGluePoint : std::as_const(seqGluePoints) )
- {
- SdrGluePoint aGluePoint;
+ if ( !pObj )
+ return;
- aGluePoint.SetPos( GetPoint( rGluePoint, true, true ) );
- aGluePoint.SetPercent( false );
- aGluePoint.SetAlign( SdrAlign::VERT_TOP | SdrAlign::HORZ_LEFT );
- aGluePoint.SetEscDir( SdrEscapeDirection::SMART );
- SdrGluePointList* pList = pObj->ForceGluePointList();
- if( pList )
- /* sal_uInt16 nId = */ pList->Insert( aGluePoint );
- }
+ for ( const auto& rGluePoint : std::as_const(seqGluePoints) )
+ {
+ SdrGluePoint aGluePoint;
+
+ aGluePoint.SetPos( GetPoint( rGluePoint, true, true ) );
+ aGluePoint.SetPercent( false );
+ aGluePoint.SetAlign( SdrAlign::VERT_TOP | SdrAlign::HORZ_LEFT );
+ aGluePoint.SetEscDir( SdrEscapeDirection::SMART );
+ SdrGluePointList* pList = pObj->ForceGluePointList();
+ if( pList )
+ /* sal_uInt16 nId = */ pList->Insert( aGluePoint );
}
}
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index cddb4571e93a..adf9bd12e396 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -571,20 +571,20 @@ static basegfx::B2DPolyPolygon GetOutlinesFromShape2d( const SdrObject* pShape2d
static void CalcDistances( const tools::Polygon& rPoly, std::vector< double >& rDistances )
{
sal_uInt16 i, nCount = rPoly.GetSize();
- if ( nCount > 1 )
+ if ( nCount <= 1 )
+ return;
+
+ for ( i = 0; i < nCount; i++ )
{
- for ( i = 0; i < nCount; i++ )
- {
- double fDistance = i ? rPoly.CalcDistance( i, i - 1 ) : 0.0;
- rDistances.push_back( fDistance );
- }
- std::partial_sum( rDistances.begin(), rDistances.end(), rDistances.begin() );
- double fLength = rDistances[ rDistances.size() - 1 ];
- if ( fLength > 0.0 )
- {
- for ( auto& rDistance : rDistances )
- rDistance /= fLength;
- }
+ double fDistance = i ? rPoly.CalcDistance( i, i - 1 ) : 0.0;
+ rDistances.push_back( fDistance );
+ }
+ std::partial_sum( rDistances.begin(), rDistances.end(), rDistances.begin() );
+ double fLength = rDistances[ rDistances.size() - 1 ];
+ if ( fLength > 0.0 )
+ {
+ for ( auto& rDistance : rDistances )
+ rDistance /= fLength;
}
}
@@ -645,29 +645,29 @@ static void InsertMissingOutlinePoints( const std::vector< double >& rDistances,
static void GetPoint( const tools::Polygon& rPoly, const std::vector< double >& rDistances, const double& fX, double& fx1, double& fy1 )
{
fy1 = fx1 = 0.0;
- if ( rPoly.GetSize() > 1 )
- {
- std::vector< double >::const_iterator aIter = std::lower_bound( rDistances.begin(), rDistances.end(), fX );
- sal_uInt16 nIdx = sal::static_int_cast<sal_uInt16>( std::distance( rDistances.begin(), aIter ) );
- if ( aIter == rDistances.end() )
- nIdx--;
- const Point& rPt = rPoly[ nIdx ];
- fx1 = rPt.X();
- fy1 = rPt.Y();
- if ( nIdx && ( aIter != rDistances.end() ) && !rtl::math::approxEqual( *aIter, fX ) )
- {
- nIdx = sal::static_int_cast<sal_uInt16>( std::distance( rDistances.begin(), aIter ) );
- double fDist0 = *( aIter - 1 );
- double fd = ( 1.0 / ( *aIter - fDist0 ) ) * ( fX - fDist0 );
- const Point& rPt2 = rPoly[ nIdx - 1 ];
- double fWidth = rPt.X() - rPt2.X();
- double fHeight= rPt.Y() - rPt2.Y();
- fWidth *= fd;
- fHeight*= fd;
- fx1 = rPt2.X() + fWidth;
- fy1 = rPt2.Y() + fHeight;
- }
- }
+ if ( rPoly.GetSize() <= 1 )
+ return;
+
+ std::vector< double >::const_iterator aIter = std::lower_bound( rDistances.begin(), rDistances.end(), fX );
+ sal_uInt16 nIdx = sal::static_int_cast<sal_uInt16>( std::distance( rDistances.begin(), aIter ) );
+ if ( aIter == rDistances.end() )
+ nIdx--;
+ const Point& rPt = rPoly[ nIdx ];
+ fx1 = rPt.X();
+ fy1 = rPt.Y();
+ if ( !(nIdx && ( aIter != rDistances.end() ) && !rtl::math::approxEqual( *aIter, fX )) )
+ return;
+
+ nIdx = sal::static_int_cast<sal_uInt16>( std::distance( rDistances.begin(), aIter ) );
+ double fDist0 = *( aIter - 1 );
+ double fd = ( 1.0 / ( *aIter - fDist0 ) ) * ( fX - fDist0 );
+ const Point& rPt2 = rPoly[ nIdx - 1 ];
+ double fWidth = rPt.X() - rPt2.X();
+ double fHeight= rPt.Y() - rPt2.Y();
+ fWidth *= fd;
+ fHeight*= fd;
+ fx1 = rPt2.X() + fWidth;
+ fy1 = rPt2.Y() + fHeight;
}
static void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2d, FWData& rFWData )
diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx
index 231305eeae37..9e7425a02ed0 100644
--- a/svx/source/engine3d/dragmt3d.cxx
+++ b/svx/source/engine3d/dragmt3d.cxx
@@ -278,51 +278,51 @@ E3dDragRotate::E3dDragRotate(SdrDragView &_rView,
// Get center of all selected objects in eye coordinates
const sal_uInt32 nCnt(maGrp.size());
- if(nCnt)
- {
- const E3dScene* pScene(maGrp[0].mr3DObj.getRootE3dSceneFromE3dObject());
+ if(!nCnt)
+ return;
- if(nullptr != pScene)
- {
- const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
- const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
+ const E3dScene* pScene(maGrp[0].mr3DObj.getRootE3dSceneFromE3dObject());
- for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
- {
- E3dDragMethodUnit& rCandidate = maGrp[nOb];
- basegfx::B3DPoint aObjCenter = rCandidate.mr3DObj.GetBoundVolume().getCenter();
- const basegfx::B3DHomMatrix aTransform(aViewInfo3D.getOrientation() * rCandidate.maDisplayTransform * rCandidate.maInitTransform);
+ if(nullptr == pScene)
+ return;
- aObjCenter = aTransform * aObjCenter;
- maGlobalCenter += aObjCenter;
- }
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
- // Divide by the number
- if(nCnt > 1)
- {
- maGlobalCenter /= static_cast<double>(nCnt);
- }
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
+ {
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ basegfx::B3DPoint aObjCenter = rCandidate.mr3DObj.GetBoundVolume().getCenter();
+ const basegfx::B3DHomMatrix aTransform(aViewInfo3D.getOrientation() * rCandidate.maDisplayTransform * rCandidate.maInitTransform);
- // get rotate center and transform to 3D eye coordinates
- basegfx::B2DPoint aRotCenter2D(Ref1().X(), Ref1().Y());
+ aObjCenter = aTransform * aObjCenter;
+ maGlobalCenter += aObjCenter;
+ }
- // from world to relative scene using inverse getObjectTransformation()
- basegfx::B2DHomMatrix aInverseObjectTransform(rVCScene.getObjectTransformation());
- aInverseObjectTransform.invert();
- aRotCenter2D = aInverseObjectTransform * aRotCenter2D;
+ // Divide by the number
+ if(nCnt > 1)
+ {
+ maGlobalCenter /= static_cast<double>(nCnt);
+ }
- // 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;
+ // get rotate center and transform to 3D eye coordinates
+ basegfx::B2DPoint aRotCenter2D(Ref1().X(), Ref1().Y());
- // Use X,Y of the RotCenter and depth of the common object centre
- // as rotation point in the space
- maGlobalCenter.setX(aRotCenter3D.getX());
- maGlobalCenter.setY(aRotCenter3D.getY());
- }
- }
+ // 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;
+
+// Use X,Y of the RotCenter and depth of the common object centre
+// as rotation point in the space
+ maGlobalCenter.setX(aRotCenter3D.getX());
+ maGlobalCenter.setY(aRotCenter3D.getY());
}
@@ -333,115 +333,115 @@ void E3dDragRotate::MoveSdrDrag(const Point& rPnt)
// call parent
E3dDragMethod::MoveSdrDrag(rPnt);
- if(DragStat().CheckMinMoved(rPnt))
+ if(!DragStat().CheckMinMoved(rPnt))
+ return;
+
+ // Get modifier
+ sal_uInt16 nModifier = 0;
+ if(dynamic_cast<const E3dView*>(&getSdrDragView()))
{
- // Get modifier
- sal_uInt16 nModifier = 0;
- if(dynamic_cast<const E3dView*>(&getSdrDragView()))
+ const MouseEvent& rLastMouse = static_cast<E3dView&>(getSdrDragView()).GetMouseEvent();
+ nModifier = rLastMouse.GetModifier();
+ }
+
+ // Rotate all objects
+ const sal_uInt32 nCnt(maGrp.size());
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
+ {
+ // Determine rotation angle
+ double fWAngle, fHAngle;
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+
+ if(E3dDragConstraint::Z == meConstraint)
{
- const MouseEvent& rLastMouse = static_cast<E3dView&>(getSdrDragView()).GetMouseEvent();
- nModifier = rLastMouse.GetModifier();
+ fWAngle = NormAngle36000(GetAngle(rPnt - DragStat().GetRef1()) -
+ rCandidate.mnStartAngle) - rCandidate.mnLastAngle;
+ rCandidate.mnLastAngle = static_cast<long>(fWAngle) + rCandidate.mnLastAngle;
+ fWAngle /= 100.0;
+ fHAngle = 0.0;
+ }
+ else
+ {
+ if ((maFullBound.GetWidth() == 0) || (maFullBound.GetHeight() == 0))
+ throw o3tl::divide_by_zero();
+ fWAngle = 90.0 * static_cast<double>(rPnt.X() - maLastPos.X())
+ / static_cast<double>(maFullBound.GetWidth());
+ fHAngle = 90.0 * static_cast<double>(rPnt.Y() - maLastPos.Y())
+ / static_cast<double>(maFullBound.GetHeight());
}
+ long nSnap = 0;
- // Rotate all objects
- const sal_uInt32 nCnt(maGrp.size());
+ if(!getSdrDragView().IsRotateAllowed())
+ nSnap = 90;
- for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
+ if(nSnap != 0)
{
- // Determine rotation angle
- double fWAngle, fHAngle;
- E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ fWAngle = static_cast<double>((static_cast<long>(fWAngle) + nSnap/2) / nSnap * nSnap);
+ fHAngle = static_cast<double>((static_cast<long>(fHAngle) + nSnap/2) / nSnap * nSnap);
+ }
- if(E3dDragConstraint::Z == meConstraint)
- {
- fWAngle = NormAngle36000(GetAngle(rPnt - DragStat().GetRef1()) -
- rCandidate.mnStartAngle) - rCandidate.mnLastAngle;
- rCandidate.mnLastAngle = static_cast<long>(fWAngle) + rCandidate.mnLastAngle;
- fWAngle /= 100.0;
- fHAngle = 0.0;
- }
+ // to radians
+ fWAngle = basegfx::deg2rad(fWAngle);
+ fHAngle = basegfx::deg2rad(fHAngle);
+
+ // Determine transformation
+ basegfx::B3DHomMatrix aRotMat;
+ if(E3dDragConstraint::Y & meConstraint)
+ {
+ if(nModifier & KEY_MOD2)
+ aRotMat.rotate(0.0, 0.0, fWAngle);
else
- {
- if ((maFullBound.GetWidth() == 0) || (maFullBound.GetHeight() == 0))
- throw o3tl::divide_by_zero();
- fWAngle = 90.0 * static_cast<double>(rPnt.X() - maLastPos.X())
- / static_cast<double>(maFullBound.GetWidth());
- fHAngle = 90.0 * static_cast<double>(rPnt.Y() - maLastPos.Y())
- / static_cast<double>(maFullBound.GetHeight());
- }
- long nSnap = 0;
+ aRotMat.rotate(0.0, fWAngle, 0.0);
+ }
+ else if(E3dDragConstraint::Z & meConstraint)
+ {
+ if(nModifier & KEY_MOD2)
+ aRotMat.rotate(0.0, fWAngle, 0.0);
+ else
+ aRotMat.rotate(0.0, 0.0, fWAngle);
+ }
+ if(E3dDragConstraint::X & meConstraint)
+ {
+ aRotMat.rotate(fHAngle, 0.0, 0.0);
+ }
- if(!getSdrDragView().IsRotateAllowed())
- nSnap = 90;
+ const E3dScene* pScene(rCandidate.mr3DObj.getRootE3dSceneFromE3dObject());
- if(nSnap != 0)
- {
- fWAngle = static_cast<double>((static_cast<long>(fWAngle) + nSnap/2) / nSnap * nSnap);
- fHAngle = static_cast<double>((static_cast<long>(fHAngle) + nSnap/2) / nSnap * nSnap);
- }
+ if(nullptr != pScene)
+ {
+ // Transformation in eye coordinates, there rotate then and back
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
- // to radians
- fWAngle = basegfx::deg2rad(fWAngle);
- fHAngle = basegfx::deg2rad(fHAngle);
+ basegfx::B3DHomMatrix aTransMat(rCandidate.maDisplayTransform);
+ aTransMat *= aViewInfo3D.getOrientation();
+ aTransMat.translate(-maGlobalCenter.getX(), -maGlobalCenter.getY(), -maGlobalCenter.getZ());
+ aTransMat *= aRotMat;
+ aTransMat.translate(maGlobalCenter.getX(), maGlobalCenter.getY(), maGlobalCenter.getZ());
+ aTransMat *= aInverseOrientation;
+ aTransMat *= rCandidate.maInvDisplayTransform;
- // Determine transformation
- basegfx::B3DHomMatrix aRotMat;
- if(E3dDragConstraint::Y & meConstraint)
- {
- if(nModifier & KEY_MOD2)
- aRotMat.rotate(0.0, 0.0, fWAngle);
- else
- aRotMat.rotate(0.0, fWAngle, 0.0);
- }
- else if(E3dDragConstraint::Z & meConstraint)
+ // ...and apply
+ rCandidate.maTransform *= aTransMat;
+
+ if(mbMoveFull)
{
- if(nModifier & KEY_MOD2)
- aRotMat.rotate(0.0, fWAngle, 0.0);
- else
- aRotMat.rotate(0.0, 0.0, fWAngle);
+ E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
+ rCandidate.mr3DObj.SetTransform(rCandidate.maTransform);
}
- if(E3dDragConstraint::X & meConstraint)
+ else
{
- aRotMat.rotate(fHAngle, 0.0, 0.0);
- }
-
- const E3dScene* pScene(rCandidate.mr3DObj.getRootE3dSceneFromE3dObject());
-
- if(nullptr != pScene)
- {
- // Transformation in eye coordinates, there rotate then and back
- const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->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(maGlobalCenter.getX(), maGlobalCenter.getY(), maGlobalCenter.getZ());
- aTransMat *= aInverseOrientation;
- aTransMat *= rCandidate.maInvDisplayTransform;
-
- // ...and apply
- rCandidate.maTransform *= aTransMat;
-
- if(mbMoveFull)
- {
- E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
- rCandidate.mr3DObj.SetTransform(rCandidate.maTransform);
- }
- else
- {
- Hide();
- rCandidate.maWireframePoly.transform(aTransMat);
- Show();
- }
+ Hide();
+ rCandidate.maWireframePoly.transform(aTransMat);
+ Show();
}
}
- maLastPos = rPnt;
- DragStat().NextMove(rPnt);
}
+ maLastPos = rPnt;
+ DragStat().NextMove(rPnt);
}
PointerStyle E3dDragRotate::GetSdrDragPointer() const
@@ -508,220 +508,220 @@ void E3dDragMove::MoveSdrDrag(const Point& rPnt)
// call parent
E3dDragMethod::MoveSdrDrag(rPnt);
- if(DragStat().CheckMinMoved(rPnt))
+ if(!DragStat().CheckMinMoved(rPnt))
+ return;
+
+ if(SdrHdlKind::Move == meWhatDragHdl)
{
- if(SdrHdlKind::Move == meWhatDragHdl)
- {
- // Translation
- // Determine the motion vector
- const sal_uInt32 nCnt(maGrp.size());
+ // Translation
+ // Determine the motion vector
+ const sal_uInt32 nCnt(maGrp.size());
- // Get modifier
- sal_uInt16 nModifier(0);
+ // Get modifier
+ sal_uInt16 nModifier(0);
- if(dynamic_cast<const E3dView*>(&getSdrDragView()))
- {
- const MouseEvent& rLastMouse = static_cast<E3dView&>(getSdrDragView()).GetMouseEvent();
- nModifier = rLastMouse.GetModifier();
- }
+ if(dynamic_cast<const E3dView*>(&getSdrDragView()))
+ {
+ const MouseEvent& rLastMouse = static_cast<E3dView&>(getSdrDragView()).GetMouseEvent();
+ nModifier = rLastMouse.GetModifier();
+ }
- for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
- {
- E3dDragMethodUnit& rCandidate = maGrp[nOb];
- const E3dScene* pScene(rCandidate.mr3DObj.getRootE3dSceneFromE3dObject());
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
+ {
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ const E3dScene* pScene(rCandidate.mr3DObj.getRootE3dSceneFromE3dObject());
- if(nullptr != pScene)
- {
- const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
- const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
+ if(nullptr != pScene)
+ {
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
- // move coor from 2d world to 3d Eye
- basegfx::B2DPoint aGlobalMoveHead2D(static_cast<double>(rPnt.X() - maLastPos.X()), static_cast<double>(rPnt.Y() - maLastPos.Y()));
- basegfx::B2DPoint aGlobalMoveTail2D(0.0, 0.0);
- basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+ // move coor from 2d world to 3d Eye
+ basegfx::B2DPoint aGlobalMoveHead2D(static_cast<double>(rPnt.X() - maLastPos.X()), static_cast<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;
+ 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();
+ 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;
+ aMoveHead3D = aInverseViewToEye * aMoveHead3D;
+ aMoveTail3D = aInverseViewToEye * aMoveTail3D;
- // eventually switch movement from XY to XZ plane
- if(nModifier & KEY_MOD2)
- {
- double fZwi = aMoveHead3D.getY();
- aMoveHead3D.setY(aMoveHead3D.getZ());
- aMoveHead3D.setZ(fZwi);
+ // eventually switch movement from XY to XZ plane
+ if(nModifier & KEY_MOD2)
+ {
+ double fZwi = aMoveHead3D.getY();
+ aMoveHead3D.setY(aMoveHead3D.getZ());
+ aMoveHead3D.setZ(fZwi);
- fZwi = aMoveTail3D.getY();
- aMoveTail3D.setY(aMoveTail3D.getZ());
- aMoveTail3D.setZ(fZwi);
- }
+ fZwi = aMoveTail3D.getY();
+ aMoveTail3D.setY(aMoveTail3D.getZ());
+ aMoveTail3D.setZ(fZwi);
+ }
- // Motion vector from eye coordinates to parent coordinates
- basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
- aInverseOrientation.invert();
- basegfx::B3DHomMatrix aCompleteTrans(rCandidate.maInvDisplayTransform * aInverseOrientation);
+ // Motion vector from eye coordinates to parent coordinates
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+ basegfx::B3DHomMatrix aCompleteTrans(rCandidate.maInvDisplayTransform * aInverseOrientation);
- aMoveHead3D = aCompleteTrans * aMoveHead3D;
- aMoveTail3D = aCompleteTrans* aMoveTail3D;
+ aMoveHead3D = aCompleteTrans * aMoveHead3D;
+ aMoveTail3D = aCompleteTrans* aMoveTail3D;
- // build transformation
- basegfx::B3DHomMatrix aTransMat;
- basegfx::B3DPoint aTranslate(aMoveHead3D - aMoveTail3D);
- aTransMat.translate(aTranslate.getX(), aTranslate.getY(), aTranslate.getZ());
+ // build transformation
+ basegfx::B3DHomMatrix aTransMat;
+ basegfx::B3DPoint aTranslate(aMoveHead3D - aMoveTail3D);
+ aTransMat.translate(aTranslate.getX(), aTranslate.getY(), aTranslate.getZ());
- // ...and apply
- rCandidate.maTransform *= aTransMat;
+ // ...and apply
+ rCandidate.maTransform *= aTransMat;
- if(mbMoveFull)
- {
- E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
- rCandidate.mr3DObj.SetTransform(rCandidate.maTransform);
- }
- else
- {
- Hide();
- rCandidate.maWireframePoly.transform(aTransMat);
- Show();
- }
+ if(mbMoveFull)
+ {
+ E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
+ rCandidate.mr3DObj.SetTransform(rCandidate.maTransform);
+ }
+ else
+ {
+ Hide();
+ rCandidate.maWireframePoly.transform(aTransMat);
+ Show();
}
}
}
- else
+ }
+ else
+ {
+ // Scaling
+ // Determine scaling vector
+ Point aStartPos = DragStat().GetStart();
+ const sal_uInt32 nCnt(maGrp.size());
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
- // Scaling
- // Determine scaling vector
- Point aStartPos = DragStat().GetStart();
- const sal_uInt32 nCnt(maGrp.size());
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ const basegfx::B3DPoint aObjectCenter(rCandidate.mr3DObj.GetBoundVolume().getCenter());
+ const E3dScene* pScene(rCandidate.mr3DObj.getRootE3dSceneFromE3dObject());
- for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
+ if(nullptr != pScene)
{
- E3dDragMethodUnit& rCandidate = maGrp[nOb];
- const basegfx::B3DPoint aObjectCenter(rCandidate.mr3DObj.GetBoundVolume().getCenter());
- const E3dScene* pScene(rCandidate.mr3DObj.getRootE3dSceneFromE3dObject());
+ // transform from 2D world view to 3D eye
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
- if(nullptr != pScene)
- {
- // transform from 2D world view to 3D eye
- const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
- const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
+ basegfx::B2DPoint aGlobalScaleStart2D(static_cast<double>(aStartPos.X()), static_cast<double>(aStartPos.Y()));
+ basegfx::B2DPoint aGlobalScaleNext2D(static_cast<double>(rPnt.X()), static_cast<double>(rPnt.Y()));
+ basegfx::B2DPoint aGlobalScaleFixPos2D(static_cast<double>(maScaleFixPos.X()), static_cast<double>(maScaleFixPos.Y()));
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
- basegfx::B2DPoint aGlobalScaleStart2D(static_cast<double>(aStartPos.X()), static_cast<double>(aStartPos.Y()));
- basegfx::B2DPoint aGlobalScaleNext2D(static_cast<double>(rPnt.X()), static_cast<double>(rPnt.Y()));
- basegfx::B2DPoint aGlobalScaleFixPos2D(static_cast<double>(maScaleFixPos.X()), static_cast<double>(maScaleFixPos.Y()));
- basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+ aInverseSceneTransform.invert();
+ aGlobalScaleStart2D = aInverseSceneTransform * aGlobalScaleStart2D;
+ aGlobalScaleNext2D = aInverseSceneTransform * aGlobalScaleNext2D;
+ aGlobalScaleFixPos2D = aInverseSceneTransform * aGlobalScaleFixPos2D;
- 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());
- 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);
- aInverseViewToEye.invert();
- basegfx::B3DPoint aScStart(aInverseViewToEye * aGlobalScaleStart3D);
- basegfx::B3DPoint aScNext(aInverseViewToEye * aGlobalScaleNext3D);
- basegfx::B3DPoint aScFixPos(aInverseViewToEye * aGlobalScaleFixPos3D);
+ // constraints?
+ switch(meWhatDragHdl)
+ {
+ case SdrHdlKind::Left:
+ case SdrHdlKind::Right:
+ // to constrain on X -> Y equal
+ aScNext.setY(aScFixPos.getY());
+ break;
+ case SdrHdlKind::Upper:
+ case SdrHdlKind::Lower:
+ // constrain to Y -> X equal
+ aScNext.setX(aScFixPos.getX());
+ break;
+ default:
+ break;
+ }
- // constraints?
- switch(meWhatDragHdl)
- {
- case SdrHdlKind::Left:
- case SdrHdlKind::Right:
- // to constrain on X -> Y equal
- aScNext.setY(aScFixPos.getY());
- break;
- case SdrHdlKind::Upper:
- case SdrHdlKind::Lower:
- // constrain to Y -> X equal
- aScNext.setX(aScFixPos.getX());
- break;
- default:
- break;
- }
+ // get scale vector in eye coordinates
+ basegfx::B3DPoint aScaleVec(aScStart - aScFixPos);
+ aScaleVec.setZ(1.0);
- // 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.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);
+ }
- if(aScaleVec.getY() != 0.0)
+ // SHIFT-key used?
+ if(getSdrDragView().IsOrtho())
+ {
+ if(fabs(aScaleVec.getX()) > fabs(aScaleVec.getY()))
{
- aScaleVec.setY((aScNext.getY() - aScFixPos.getY()) / aScaleVec.getY());
+ // X is biggest
+ aScaleVec.setY(aScaleVec.getX());
}
else
{
- aScaleVec.setY(1.0);
- }
-
- // SHIFT-key used?
- if(getSdrDragView().IsOrtho())
- {
- if(fabs(aScaleVec.getX()) > fabs(aScaleVec.getY()))
- {
- // X is biggest
- aScaleVec.setY(aScaleVec.getX());
- }
- else
- {
- // Y is biggest
- aScaleVec.setX(aScaleVec.getY());
- }
+ // Y is biggest
+ aScaleVec.setX(aScaleVec.getY());
}
+ }
- // build transformation
- basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
- aInverseOrientation.invert();
+ // 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 *= aInverseOrientation;
- aNewTrans *= rCandidate.maInvDisplayTransform;
+ 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 *= aInverseOrientation;
+ aNewTrans *= rCandidate.maInvDisplayTransform;
- // ...and apply
- rCandidate.maTransform = aNewTrans;
+ // ...and apply
+ rCandidate.maTransform = aNewTrans;
- if(mbMoveFull)
- {
- E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
- rCandidate.mr3DObj.SetTransform(rCandidate.maTransform);
- }
- else
- {
- Hide();
- rCandidate.maWireframePoly.clear();
- rCandidate.maWireframePoly = rCandidate.mr3DObj.CreateWireframe();
- rCandidate.maWireframePoly.transform(rCandidate.maTransform);
- Show();
- }
+ if(mbMoveFull)
+ {
+ E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
+ rCandidate.mr3DObj.SetTransform(rCandidate.maTransform);
+ }
+ else
+ {
+ Hide();
+ rCandidate.maWireframePoly.clear();
+ rCandidate.maWireframePoly = rCandidate.mr3DObj.CreateWireframe();
+ rCandidate.maWireframePoly.transform(rCandidate.maTransform);
+ Show();
}
}
}
- maLastPos = rPnt;
- DragStat().NextMove(rPnt);
}
+ maLastPos = rPnt;
+ DragStat().NextMove(rPnt);
}
PointerStyle E3dDragMove::GetSdrDragPointer() const
diff --git a/svx/source/engine3d/e3dsceneupdater.cxx b/svx/source/engine3d/e3dsceneupdater.cxx
index 07df1af059b9..f2569e325b4e 100644
--- a/svx/source/engine3d/e3dsceneupdater.cxx
+++ b/svx/source/engine3d/e3dsceneupdater.cxx
@@ -28,83 +28,84 @@ E3DModifySceneSnapRectUpdater::E3DModifySceneSnapRectUpdater(const SdrObject* pO
: mpScene(nullptr)
{
// Secure old 3D transformation stack before modification
- if(const E3dObject* pE3dObject = dynamic_cast< const E3dObject* >(pObject))
+ const E3dObject* pE3dObject = dynamic_cast< const E3dObject* >(pObject);
+ if(!pE3dObject)
+ return;
+
+ mpScene = pE3dObject->getRootE3dSceneFromE3dObject();
+
+ if(nullptr == mpScene || mpScene->getRootE3dSceneFromE3dObject() != mpScene)
+ return;
+
+ // 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())
{
- mpScene = pE3dObject->getRootE3dSceneFromE3dObject();
-
- if(nullptr != mpScene && mpScene->getRootE3dSceneFromE3dObject() == 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 = nullptr;
- }
- else
- {
- // secure current 3D transformation stack
- mpViewInformation3D.reset(
- new drawinglayer::geometry::ViewInformation3D(
- rVCScene.getViewInformation3D(aAllContentRange)));
- }
- }
+ // no content, nothing to do
+ mpScene = nullptr;
+ }
+ else
+ {
+ // secure current 3D transformation stack
+ mpViewInformation3D.reset(
+ new drawinglayer::geometry::ViewInformation3D(
+ rVCScene.getViewInformation3D(aAllContentRange)));
}
}
E3DModifySceneSnapRectUpdater::~E3DModifySceneSnapRectUpdater()
{
- if(mpScene && mpViewInformation3D)
+ if(!(mpScene && mpViewInformation3D))
+ return;
+
+ // 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())
+ return;
+
+ // 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());
+ mpViewInformation3D.reset(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 coordinates using scene's 2D transformation
+ aSnapRange.transform(rVCScene.getObjectTransformation());
+
+ // snap to (old) integer
+ const tools::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)
{
- // 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());
- mpViewInformation3D.reset(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 coordinates using scene's 2D transformation
- aSnapRange.transform(rVCScene.getObjectTransformation());
-
- // snap to (old) integer
- const tools::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();
- }
- }
+ mpScene->SetSnapRect(aNewSnapRect);
+ mpScene->InvalidateBoundVolume();
}
}
diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx
index f553b4d0e744..65ed16af7154 100644
--- a/svx/source/engine3d/helperhittest3d.cxx
+++ b/svx/source/engine3d/helperhittest3d.cxx
@@ -67,29 +67,29 @@ static void getAllHit3DObjectWithRelativePoint(
{
o_rResult.clear();
- if(!rFront.equal(rBack))
- {
- // rObject is an E3dCompoundObject, so it cannot be a scene (which is an E3dObject)
- const sdr::contact::ViewContactOfE3d& rVCObject = static_cast< sdr::contact::ViewContactOfE3d& >(rObject.GetViewContact());
- const drawinglayer::primitive3d::Primitive3DContainer aPrimitives(rVCObject.getViewIndependentPrimitive3DContainer());
+ if(rFront.equal(rBack))
+ return;
- if(!aPrimitives.empty())
- {
- // make BoundVolume empty and overlapping test for speedup
- const basegfx::B3DRange aObjectRange(aPrimitives.getB3DRange(rObjectViewInformation3D));
+ // rObject is an E3dCompoundObject, so it cannot be a scene (which is an E3dObject)
+ const sdr::contact::ViewContactOfE3d& rVCObject = static_cast< sdr::contact::ViewContactOfE3d& >(rObject.GetViewContact());
+ const drawinglayer::primitive3d::Primitive3DContainer aPrimitives(rVCObject.getViewIndependentPrimitive3DContainer());
- if(!aObjectRange.isEmpty())
- {
- const basegfx::B3DRange aFrontBackRange(rFront, rBack);
+ if(aPrimitives.empty())
+ return;
- if(aObjectRange.overlaps(aFrontBackRange))
- {
- // bound volumes hit, geometric cut tests needed
- drawinglayer::processor3d::CutFindProcessor aCutFindProcessor(rObjectViewInformation3D, rFront, rBack, bAnyHit);
- aCutFindProcessor.process(aPrimitives);
- o_rResult = aCutFindProcessor.getCutPoints();
- }
- }
+ // make BoundVolume empty and overlapping test for speedup
+ const basegfx::B3DRange aObjectRange(aPrimitives.getB3DRange(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, bAnyHit);
+ aCutFindProcessor.process(aPrimitives);
+ o_rResult = aCutFindProcessor.getCutPoints();
}
}
}
@@ -164,67 +164,67 @@ void getAllHit3DObjectsSortedFrontToBack(
o_rResult.clear();
SdrObjList* pList = rScene.GetSubList();
- if(nullptr != pList && 0 != pList->GetObjCount())
+ if(nullptr == pList || 0 == pList->GetObjCount())
+ return;
+
+ // 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))
+ return;
+
+ SdrObjListIter aIterator(pList, SdrIterMode::DeepNoGroups);
+ ::std::vector< ImplPairDephAndObject > aDepthAndObjectResults;
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+
+ while(aIterator.IsMore())
{
- // 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);
+ const E3dCompoundObject* pCandidate = dynamic_cast< const E3dCompoundObject* >(aIterator.Next());
- // 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)
+ if(pCandidate)
{
- SdrObjListIter aIterator(pList, SdrIterMode::DeepNoGroups);
- ::std::vector< ImplPairDephAndObject > aDepthAndObjectResults;
- const uno::Sequence< beans::PropertyValue > aEmptyParameters;
- drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ 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));
- while(aIterator.IsMore())
+ if(!aFront.equal(aBack))
{
- const E3dCompoundObject* pCandidate = dynamic_cast< const E3dCompoundObject* >(aIterator.Next());
+ // get all hit points with object
+ ::std::vector< basegfx::B3DPoint > aHitsWithObject;
+ getAllHit3DObjectWithRelativePoint(aFront, aBack, *pCandidate, aViewInfo3D, aHitsWithObject, false);
- if(pCandidate)
+ for(const basegfx::B3DPoint & a : aHitsWithObject)
{
- 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, false);
-
- for(const basegfx::B3DPoint & a : aHitsWithObject)
- {
- const basegfx::B3DPoint aPointInViewCoordinates(aViewInfo3D.getObjectToView() * a);
- aDepthAndObjectResults.emplace_back(pCandidate, aPointInViewCoordinates.getZ());
- }
- }
+ const basegfx::B3DPoint aPointInViewCoordinates(aViewInfo3D.getObjectToView() * a);
+ aDepthAndObjectResults.emplace_back(pCandidate, aPointInViewCoordinates.getZ());
}
}
+ }
+ }
- // fill nRetval
- const sal_uInt32 nCount(aDepthAndObjectResults.size());
+ // fill nRetval
+ const sal_uInt32 nCount(aDepthAndObjectResults.size());
- if(nCount)
- {
- // sort aDepthAndObjectResults by depth
- ::std::sort(aDepthAndObjectResults.begin(), aDepthAndObjectResults.end());
+ if(nCount)
+ {
+ // sort aDepthAndObjectResults by depth
+ ::std::sort(aDepthAndObjectResults.begin(), aDepthAndObjectResults.end());
- // copy SdrObject pointers to return result set
- for(const auto& rResult : aDepthAndObjectResults)
- {
- o_rResult.push_back(rResult.getObject());
- }
- }
+ // copy SdrObject pointers to return result set
+ for(const auto& rResult : aDepthAndObjectResults)
+ {
+ o_rResult.push_back(rResult.getObject());
}
}
}
diff --git a/svx/source/engine3d/lathe3d.cxx b/svx/source/engine3d/lathe3d.cxx
index 37060f96e73a..fbcfe3e44029 100644
--- a/svx/source/engine3d/lathe3d.cxx
+++ b/svx/source/engine3d/lathe3d.cxx
@@ -133,26 +133,26 @@ SdrObjectUniquePtr E3dLatheObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAdd
void E3dLatheObj::SetPolyPoly2D(const basegfx::B2DPolyPolygon& rNew)
{
- if(maPolyPoly2D != rNew)
- {
- maPolyPoly2D = rNew;
- maPolyPoly2D.removeDoublePoints();
+ if(maPolyPoly2D == rNew)
+ return;
- if(maPolyPoly2D.count())
- {
- const basegfx::B2DPolygon rPoly(maPolyPoly2D.getB2DPolygon(0));
- sal_uInt32 nSegCnt(rPoly.count());
+ maPolyPoly2D = rNew;
+ maPolyPoly2D.removeDoublePoints();
- if(nSegCnt && !rPoly.isClosed())
- {
- nSegCnt -= 1;
- }
+ if(maPolyPoly2D.count())
+ {
+ const basegfx::B2DPolygon rPoly(maPolyPoly2D.getB2DPolygon(0));
+ sal_uInt32 nSegCnt(rPoly.count());
- GetProperties().SetObjectItemDirect(makeSvx3DVerticalSegmentsItem(nSegCnt));
+ if(nSegCnt && !rPoly.isClosed())
+ {
+ nSegCnt -= 1;
}
- ActionChanged();
+ GetProperties().SetObjectItemDirect(makeSvx3DVerticalSegmentsItem(nSegCnt));
}
+
+ ActionChanged();
}
// Get the name of the object (singular)
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index eca597bb4eeb..36b45053f720 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -554,40 +554,40 @@ void E3dCompoundObject::RecalcSnapRect()
E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
maSnapRect = tools::Rectangle();
- if(pRootScene)
- {
- // get VC of 3D candidate
- const sdr::contact::ViewContactOfE3d* pVCOfE3D = dynamic_cast< const sdr::contact::ViewContactOfE3d* >(&GetViewContact());
+ if(!pRootScene)
+ return;
- if(pVCOfE3D)
- {
- // get 3D primitive sequence
- const drawinglayer::primitive3d::Primitive3DContainer xLocalSequence(pVCOfE3D->getViewIndependentPrimitive3DContainer());
+ // get VC of 3D candidate
+ const sdr::contact::ViewContactOfE3d* pVCOfE3D = dynamic_cast< const sdr::contact::ViewContactOfE3d* >(&GetViewContact());
- if(!xLocalSequence.empty())
- {
- // get BoundVolume
- basegfx::B3DRange aBoundVolume(xLocalSequence.getB3DRange(aViewInfo3D));
+ if(!pVCOfE3D)
+ return;
- // transform bound volume to relative scene coordinates
- aBoundVolume.transform(aViewInfo3D.getObjectToView());
+ // get 3D primitive sequence
+ const drawinglayer::primitive3d::Primitive3DContainer xLocalSequence(pVCOfE3D->getViewIndependentPrimitive3DContainer());
- // build 2d relative scene range
- basegfx::B2DRange aSnapRange(
- aBoundVolume.getMinX(), aBoundVolume.getMinY(),
- aBoundVolume.getMaxX(), aBoundVolume.getMaxY());
+ if(xLocalSequence.empty())
+ return;
- // transform to 2D world coordinates
- const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
- aSnapRange.transform(rVCScene.getObjectTransformation());
+ // get BoundVolume
+ basegfx::B3DRange aBoundVolume(xLocalSequence.getB3DRange(aViewInfo3D));
- // snap to integer
- maSnapRect = tools::Rectangle(
- sal_Int32(floor(aSnapRange.getMinX())), sal_Int32(floor(aSnapRange.getMinY())),
- sal_Int32(ceil(aSnapRange.getMaxX())), sal_Int32(ceil(aSnapRange.getMaxY())));
- }
- }
- }
+ // 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 coordinates
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+ aSnapRange.transform(rVCScene.getObjectTransformation());
+
+ // snap to integer
+ maSnapRect = tools::Rectangle(
+ sal_Int32(floor(aSnapRange.getMinX())), sal_Int32(floor(aSnapRange.getMinY())),
+ sal_Int32(ceil(aSnapRange.getMaxX())), sal_Int32(ceil(aSnapRange.getMaxY())));
}
E3dCompoundObject* E3dCompoundObject::CloneSdrObject(SdrModel& rTargetModel) const
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index 66b13477067e..09a7bbdfa973 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -844,23 +844,23 @@ void E3dScene::NbcSetLayer(SdrLayerID nLayer)
void E3dScene::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
- if(pOldPage != pNewPage)
+ if(pOldPage == pNewPage)
+ return;
+
+ // call parent
+ E3dObject::handlePageChange(pOldPage, pNewPage);
+
+ for(size_t a(0); a < GetObjCount(); a++)
{
- // call parent
- E3dObject::handlePageChange(pOldPage, pNewPage);
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a));
- for(size_t a(0); a < GetObjCount(); a++)
+ if(pCandidate)
{
- E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a));
-
- if(pCandidate)
- {
- pCandidate->handlePageChange(pOldPage, pNewPage);
- }
- else
- {
- OSL_ENSURE(false, "E3dScene::handlePageChange invalid object list (!)");
- }
+ pCandidate->handlePageChange(pOldPage, pNewPage);
+ }
+ else
+ {
+ OSL_ENSURE(false, "E3dScene::handlePageChange invalid object list (!)");
}
}
}
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 77d94ab1c581..78bc1dd15521 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -92,38 +92,38 @@ Impl3DMirrorConstructOverlay::Impl3DMirrorConstructOverlay(const E3dView& rView)
mpPolygons(nullptr),
maFullOverlay()
{
- if(mnCount)
+ if(!mnCount)
+ return;
+
+ if(mrView.IsSolidDragging())
{
- if(mrView.IsSolidDragging())
- {
- SdrPageView* pPV = rView.GetSdrPageView();
+ SdrPageView* pPV = rView.GetSdrPageView();
- if(pPV && pPV->PageWindowCount())
+ if(pPV && pPV->PageWindowCount())
+ {
+ for(size_t a = 0; a < mnCount; ++a)
{
- for(size_t a = 0; a < mnCount; ++a)
- {
- SdrObject* pObject = mrView.GetMarkedObjectByIndex(a);
+ SdrObject* pObject = mrView.GetMarkedObjectByIndex(a);
- if(pObject)
- {
- // use the view-independent primitive representation (without
- // evtl. GridOffset, that may be applied to the DragEntry individually)
- const drawinglayer::primitive2d::Primitive2DContainer& aNewSequence(
- pObject->GetViewContact().getViewIndependentPrimitive2DContainer());
- maFullOverlay.append(aNewSequence);
- }
+ if(pObject)
+ {
+ // use the view-independent primitive representation (without
+ // evtl. GridOffset, that may be applied to the DragEntry individually)
+ const drawinglayer::primitive2d::Primitive2DContainer& aNewSequence(
+ pObject->GetViewContact().getViewIndependentPrimitive2DContainer());
+ maFullOverlay.append(aNewSequence);
}
}
}
- else
- {
- mpPolygons = new basegfx::B2DPolyPolygon[mnCount];
+ }
+ else
+ {
+ mpPolygons = new basegfx::B2DPolyPolygon[mnCount];
- for(size_t a = 0; a < mnCount; ++a)
- {
- SdrObject* pObject = mrView.GetMarkedObjectByIndex(a);
- mpPolygons[mnCount - (a + 1)] = pObject->TakeXorPoly();
- }
+ for(size_t a = 0; a < mnCount; ++a)
+ {
+ SdrObject* pObject = mrView.GetMarkedObjectByIndex(a);
+ mpPolygons[mnCount - (a + 1)] = pObject->TakeXorPoly();
}
}
}
@@ -613,75 +613,75 @@ bool E3dView::IsConvertTo3DObjPossible() const
void E3dView::ImpIsConvertTo3DPossible(SdrObject const * pObj, bool& rAny3D,
bool& rGroupSelected) const
{
- if(pObj)
+ if(!pObj)
+ return;
+
+ if(dynamic_cast< const E3dObject* >(pObj) != nullptr)
{
- if(dynamic_cast< const E3dObject* >(pObj) != nullptr)
- {
- rAny3D = true;
- }
- else
+ rAny3D = true;
+ }
+ else
+ {
+ if(pObj->IsGroupObject())
{
- if(pObj->IsGroupObject())
+ SdrObjListIter aIter(*pObj, SdrIterMode::DeepNoGroups);
+ while(aIter.IsMore())
{
- SdrObjListIter aIter(*pObj, SdrIterMode::DeepNoGroups);
- while(aIter.IsMore())
- {
- SdrObject* pNewObj = aIter.Next();
- ImpIsConvertTo3DPossible(pNewObj, rAny3D, rGroupSelected);
- }
- rGroupSelected = true;
+ SdrObject* pNewObj = aIter.Next();
+ ImpIsConvertTo3DPossible(pNewObj, rAny3D, rGroupSelected);
}
+ rGroupSelected = true;
}
}
}
void E3dView::ImpChangeSomeAttributesFor3DConversion(SdrObject* pObj)
{
- if(dynamic_cast<const SdrTextObj*>( pObj) != nullptr)
- {
- const SfxItemSet& rSet = pObj->GetMergedItemSet();
- const SvxColorItem& rTextColorItem = rSet.Get(EE_CHAR_COLOR);
- if(rTextColorItem.GetValue() == COL_BLACK)
- {
- //For black text objects, the color set to gray
- if(pObj->getSdrPageFromSdrObject())
- {
- // if black is only default attribute from
- // pattern set it hard so that it is used in undo.
- pObj->SetMergedItem(SvxColorItem(COL_BLACK, EE_CHAR_COLOR));
+ if(dynamic_cast<const SdrTextObj*>( pObj) == nullptr)
+ return;
- // add undo now
- if( GetModel()->IsUndoEnabled() )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
- }
+ const SfxItemSet& rSet = pObj->GetMergedItemSet();
+ const SvxColorItem& rTextColorItem = rSet.Get(EE_CHAR_COLOR);
+ if(rTextColorItem.GetValue() != COL_BLACK)
+ return;
- pObj->SetMergedItem(SvxColorItem(COL_GRAY, EE_CHAR_COLOR));
- }
+ //For black text objects, the color set to gray
+ if(pObj->getSdrPageFromSdrObject())
+ {
+ // if black is only default attribute from
+ // pattern set it hard so that it is used in undo.
+ pObj->SetMergedItem(SvxColorItem(COL_BLACK, EE_CHAR_COLOR));
+
+ // add undo now
+ if( GetModel()->IsUndoEnabled() )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
}
+
+ pObj->SetMergedItem(SvxColorItem(COL_GRAY, EE_CHAR_COLOR));
}
void E3dView::ImpChangeSomeAttributesFor3DConversion2(SdrObject* pObj)
{
- if(dynamic_cast<const SdrPathObj*>( pObj) != nullptr)
+ if(dynamic_cast<const SdrPathObj*>( pObj) == nullptr)
+ return;
+
+ const SfxItemSet& rSet = pObj->GetMergedItemSet();
+ sal_Int32 nLineWidth = rSet.Get(XATTR_LINEWIDTH).GetValue();
+ drawing::LineStyle eLineStyle = rSet.Get(XATTR_LINESTYLE).GetValue();
+ drawing::FillStyle eFillStyle = rSet.Get(XATTR_FILLSTYLE).GetValue();
+
+ if(static_cast<SdrPathObj*>(pObj)->IsClosed()
+ && eLineStyle == drawing::LineStyle_SOLID
+ && !nLineWidth
+ && eFillStyle != drawing::FillStyle_NONE)
{
- const SfxItemSet& rSet = pObj->GetMergedItemSet();
- sal_Int32 nLineWidth = rSet.Get(XATTR_LINEWIDTH).GetValue();
- drawing::LineStyle eLineStyle = rSet.Get(XATTR_LINESTYLE).GetValue();
- drawing::FillStyle eFillStyle = rSet.Get(XATTR_FILLSTYLE).GetValue();
-
- if(static_cast<SdrPathObj*>(pObj)->IsClosed()
- && eLineStyle == drawing::LineStyle_SOLID
- && !nLineWidth
- && eFillStyle != drawing::FillStyle_NONE)
+ if(pObj->getSdrPageFromSdrObject() && GetModel()->IsUndoEnabled() )
{
- if(pObj->getSdrPageFromSdrObject() && GetModel()->IsUndoEnabled() )
- {
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
- }
-
- pObj->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
- pObj->SetMergedItem(XLineWidthItem(0));
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
}
+
+ pObj->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
+ pObj->SetMergedItem(XLineWidthItem(0));
}
}
@@ -690,139 +690,139 @@ void E3dView::ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, boo
// Single PathObject, transform this
SdrPathObj* pPath = dynamic_cast<SdrPathObj*>( pObj );
- if(pPath)
- {
- E3dDefaultAttributes aDefault = Get3DDefaultAttributes();
+ if(!pPath)
+ return;
- if(bExtrude)
- {
- aDefault.SetDefaultExtrudeCharacterMode(true);
- }
- else
- {
- aDefault.SetDefaultLatheCharacterMode(true);
- }
+ E3dDefaultAttributes aDefault = Get3DDefaultAttributes();
- // Get Itemset of the original object
- SfxItemSet aSet(pObj->GetMergedItemSet());
+ if(bExtrude)
+ {
+ aDefault.SetDefaultExtrudeCharacterMode(true);
+ }
+ else
+ {
+ aDefault.SetDefaultLatheCharacterMode(true);
+ }
- drawing::FillStyle eFillStyle = aSet.Get(XATTR_FILLSTYLE).GetValue();
+ // Get Itemset of the original object
+ SfxItemSet aSet(pObj->GetMergedItemSet());
- // line style turned off
- aSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
+ drawing::FillStyle eFillStyle = aSet.Get(XATTR_FILLSTYLE).GetValue();
- //Determining if FILL_Attribut is set.
- if(!pPath->IsClosed() || eFillStyle == drawing::FillStyle_NONE)
- {
- // This SdrPathObj is not filled, leave the front and rear face out.
- // Moreover, a two-sided representation necessary.
- aDefault.SetDefaultExtrudeCloseFront(false);
- aDefault.SetDefaultExtrudeCloseBack(false);
+ // line style turned off
+ aSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
- aSet.Put(makeSvx3DDoubleSidedItem(true));
+ //Determining if FILL_Attribut is set.
+ if(!pPath->IsClosed() || eFillStyle == drawing::FillStyle_NONE)
+ {
+ // This SdrPathObj is not filled, leave the front and rear face out.
+ // Moreover, a two-sided representation necessary.
+ aDefault.SetDefaultExtrudeCloseFront(false);
+ aDefault.SetDefaultExtrudeCloseBack(false);
- // Set fill attribute
- aSet.Put(XFillStyleItem(drawing::FillStyle_SOLID));
+ aSet.Put(makeSvx3DDoubleSidedItem(true));
- // Fill color must be the color line, because the object was
- // previously just a line
- Color aColorLine = aSet.Get(XATTR_LINECOLOR).GetColorValue();
- aSet.Put(XFillColorItem(OUString(), aColorLine));
- }
+ // Set fill attribute
+ aSet.Put(XFillStyleItem(drawing::FillStyle_SOLID));
- // Create a new extrude object
- E3dObject* p3DObj = nullptr;
- if(bExtrude)
- {
- p3DObj = new E3dExtrudeObj(pObj->getSdrModelFromSdrObject(), aDefault, pPath->GetPathPoly(), fDepth);
- }
- else
- {
- // rLatheMat expects coordinates with y-axis up, pPath uses y-axis down
- basegfx::B2DHomMatrix aFlipVerticalMat(1.0, 0.0, 0.0, 0.0, -1.0, 0.0);
- basegfx::B2DPolyPolygon aPolyPoly2D(pPath->GetPathPoly());
- aPolyPoly2D.transform(aFlipVerticalMat);
- aPolyPoly2D.transform(rLatheMat);
- // ctor E3dLatheObj expects coordinates with y-axis down
- aPolyPoly2D.transform(aFlipVerticalMat);
- p3DObj = new E3dLatheObj(pObj->getSdrModelFromSdrObject(), aDefault, aPolyPoly2D);
- }
+ // Fill color must be the color line, because the object was
+ // previously just a line
+ Color aColorLine = aSet.Get(XATTR_LINECOLOR).GetColorValue();
+ aSet.Put(XFillColorItem(OUString(), aColorLine));
+ }
+
+ // Create a new extrude object
+ E3dObject* p3DObj = nullptr;
+ if(bExtrude)
+ {
+ p3DObj = new E3dExtrudeObj(pObj->getSdrModelFromSdrObject(), aDefault, pPath->GetPathPoly(), fDepth);
+ }
+ else
+ {
+ // rLatheMat expects coordinates with y-axis up, pPath uses y-axis down
+ basegfx::B2DHomMatrix aFlipVerticalMat(1.0, 0.0, 0.0, 0.0, -1.0, 0.0);
+ basegfx::B2DPolyPolygon aPolyPoly2D(pPath->GetPathPoly());
+ aPolyPoly2D.transform(aFlipVerticalMat);
+ aPolyPoly2D.transform(rLatheMat);
+ // ctor E3dLatheObj expects coordinates with y-axis down
+ aPolyPoly2D.transform(aFlipVerticalMat);
+ p3DObj = new E3dLatheObj(pObj->getSdrModelFromSdrObject(), aDefault, aPolyPoly2D);
+ }
- // Set attribute
- p3DObj->NbcSetLayer(pObj->GetLayer());
+ // Set attribute
+ p3DObj->NbcSetLayer(pObj->GetLayer());
- p3DObj->SetMergedItemSet(aSet);
+ p3DObj->SetMergedItemSet(aSet);
- p3DObj->NbcSetStyleSheet(pObj->GetStyleSheet(), true);
+ p3DObj->NbcSetStyleSheet(pObj->GetStyleSheet(), true);
- // Insert a new extrude object
- pScene->InsertObject(p3DObj);
- }
+ // Insert a new extrude object
+ pScene->InsertObject(p3DObj);
}
void E3dView::ImpCreate3DObject(E3dScene* pScene, SdrObject* pObj, bool bExtrude, double fDepth, basegfx::B2DHomMatrix const & rLatheMat)
{
- if(pObj)
+ if(!pObj)
+ return;
+
+ // change text color attribute for not so dark colors
+ if(pObj->IsGroupObject())
{
- // change text color attribute for not so dark colors
- if(pObj->IsGroupObject())
+ SdrObjListIter aIter(*pObj, SdrIterMode::DeepWithGroups);
+ while(aIter.IsMore())
{
- SdrObjListIter aIter(*pObj, SdrIterMode::DeepWithGroups);
- while(aIter.IsMore())
- {
- SdrObject* pGroupMember = aIter.Next();
- ImpChangeSomeAttributesFor3DConversion(pGroupMember);
- }
+ SdrObject* pGroupMember = aIter.Next();
+ ImpChangeSomeAttributesFor3DConversion(pGroupMember);
}
- else
- ImpChangeSomeAttributesFor3DConversion(pObj);
+ }
+ else
+ ImpChangeSomeAttributesFor3DConversion(pObj);
+
+ // convert completely to path objects
+ SdrObject* pNewObj1 = pObj->ConvertToPolyObj(false, false).release();
- // convert completely to path objects
- SdrObject* pNewObj1 = pObj->ConvertToPolyObj(false, false).release();
+ if(!pNewObj1)
+ return;
- if(pNewObj1)
+ // change text color attribute for not so dark colors
+ if(pNewObj1->IsGroupObject())
+ {
+ SdrObjListIter aIter(*pNewObj1, SdrIterMode::DeepWithGroups);
+ while(aIter.IsMore())
{
- // change text color attribute for not so dark colors
- if(pNewObj1->IsGroupObject())
- {
- SdrObjListIter aIter(*pNewObj1, SdrIterMode::DeepWithGroups);
- while(aIter.IsMore())
- {
- SdrObject* pGroupMember = aIter.Next();
- ImpChangeSomeAttributesFor3DConversion2(pGroupMember);
- }
- }
- else
- ImpChangeSomeAttributesFor3DConversion2(pNewObj1);
+ SdrObject* pGroupMember = aIter.Next();
+ ImpChangeSomeAttributesFor3DConversion2(pGroupMember);
+ }
+ }
+ else
+ ImpChangeSomeAttributesFor3DConversion2(pNewObj1);
- // convert completely to path objects
- SdrObject* pNewObj2 = pObj->ConvertToContourObj(pNewObj1, true);
+ // convert completely to path objects
+ SdrObject* pNewObj2 = pObj->ConvertToContourObj(pNewObj1, true);
- if(pNewObj2)
+ if(pNewObj2)
+ {
+ // add all to flat scene
+ if(pNewObj2->IsGroupObject())
+ {
+ SdrObjListIter aIter(*pNewObj2, SdrIterMode::DeepWithGroups);
+ while(aIter.IsMore())
{
- // add all to flat scene
- if(pNewObj2->IsGroupObject())
- {
- SdrObjListIter aIter(*pNewObj2, SdrIterMode::DeepWithGroups);
- while(aIter.IsMore())
- {
- SdrObject* pGroupMember = aIter.Next();
- ImpCreateSingle3DObjectFlat(pScene, pGroupMember, bExtrude, fDepth, rLatheMat);
- }
- }
- else
- ImpCreateSingle3DObjectFlat(pScene, pNewObj2, bExtrude, fDepth, rLatheMat);
-
- // delete object in between
- if (pNewObj2 != pObj && pNewObj2 != pNewObj1)
- SdrObject::Free( pNewObj2 );
+ SdrObject* pGroupMember = aIter.Next();
+ ImpCreateSingle3DObjectFlat(pScene, pGroupMember, bExtrude, fDepth, rLatheMat);
}
-
- // delete object in between
- if (pNewObj1 != pObj)
- SdrObject::Free( pNewObj1 );
}
+ else
+ ImpCreateSingle3DObjectFlat(pScene, pNewObj2, bExtrude, fDepth, rLatheMat);
+
+ // delete object in between
+ if (pNewObj2 != pObj && pNewObj2 != pNewObj1)
+ SdrObject::Free( pNewObj2 );
}
+
+ // delete object in between
+ if (pNewObj1 != pObj)
+ SdrObject::Free( pNewObj1 );
}
void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const basegfx::B2DPoint& rPnt1, const basegfx::B2DPoint& rPnt2)
@@ -1029,126 +1029,126 @@ struct E3dDepthLayer
void E3dView::DoDepthArrange(E3dScene const * pScene, double fDepth)
{
- if(pScene && pScene->GetSubList() && pScene->GetSubList()->GetObjCount() > 1)
+ if(!(pScene && pScene->GetSubList() && pScene->GetSubList()->GetObjCount() > 1))
+ return;
+
+ SdrObjList* pSubList = pScene->GetSubList();
+ SdrObjListIter aIter(pSubList, SdrIterMode::Flat);
+ E3dDepthLayer* pBaseLayer = nullptr;
+ E3dDepthLayer* pLayer = nullptr;
+ sal_Int32 nNumLayers = 0;
+
+ while(aIter.IsMore())
{
- SdrObjList* pSubList = pScene->GetSubList();
- SdrObjListIter aIter(pSubList, SdrIterMode::Flat);
- E3dDepthLayer* pBaseLayer = nullptr;
- E3dDepthLayer* pLayer = nullptr;
- sal_Int32 nNumLayers = 0;
+ E3dExtrudeObj* pExtrudeObj = dynamic_cast< E3dExtrudeObj* >(aIter.Next());
- while(aIter.IsMore())
+ if(pExtrudeObj)
{
- E3dExtrudeObj* pExtrudeObj = dynamic_cast< E3dExtrudeObj* >(aIter.Next());
-
- if(pExtrudeObj)
+ const basegfx::B2DPolyPolygon aExtrudePoly(
+ basegfx::utils::prepareForPolygonOperation(pExtrudeObj->GetExtrudePolygon()));
+ const SfxItemSet& rLocalSet = pExtrudeObj->GetMergedItemSet();
+ const drawing::FillStyle eLocalFillStyle = rLocalSet.Get(XATTR_FILLSTYLE).GetValue();
+ const Color aLocalColor = rLocalSet.Get(XATTR_FILLCOLOR).GetColorValue();
+
+ // sort in ExtrudeObj
+ if(pLayer)
{
- const basegfx::B2DPolyPolygon aExtrudePoly(
- basegfx::utils::prepareForPolygonOperation(pExtrudeObj->GetExtrudePolygon()));
- const SfxItemSet& rLocalSet = pExtrudeObj->GetMergedItemSet();
- const drawing::FillStyle eLocalFillStyle = rLocalSet.Get(XATTR_FILLSTYLE).GetValue();
- const Color aLocalColor = rLocalSet.Get(XATTR_FILLCOLOR).GetColorValue();
-
- // sort in ExtrudeObj
- if(pLayer)
- {
- // do we have overlap with an object of this layer?
- bool bOverlap(false);
+ // do we have overlap with an object of this layer?
+ bool bOverlap(false);
- for(const auto& rAct : pLayer->mvNeighbours)
+ for(const auto& rAct : pLayer->mvNeighbours)
+ {
+ // do rAct.mpObj and pExtrudeObj overlap? Check by
+ // using logical AND clipping
+ const basegfx::B2DPolyPolygon aAndPolyPolygon(
+ basegfx::utils::solvePolygonOperationAnd(
+ aExtrudePoly,
+ rAct.maPreparedPolyPolygon));
+
+ if(aAndPolyPolygon.count() != 0)
{
- // do rAct.mpObj and pExtrudeObj overlap? Check by
- // using logical AND clipping
- const basegfx::B2DPolyPolygon aAndPolyPolygon(
- basegfx::utils::solvePolygonOperationAnd(
- aExtrudePoly,
- rAct.maPreparedPolyPolygon));
-
- if(aAndPolyPolygon.count() != 0)
- {
- // second criteria: is another fillstyle or color used?
- const SfxItemSet& rCompareSet = rAct.mpObj->GetMergedItemSet();
+ // second criteria: is another fillstyle or color used?
+ const SfxItemSet& rCompareSet = rAct.mpObj->GetMergedItemSet();
- drawing::FillStyle eCompareFillStyle = rCompareSet.Get(XATTR_FILLSTYLE).GetValue();
+ drawing::FillStyle eCompareFillStyle = rCompareSet.Get(XATTR_FILLSTYLE).GetValue();
- if(eLocalFillStyle == eCompareFillStyle)
+ if(eLocalFillStyle == eCompareFillStyle)
+ {
+ if(eLocalFillStyle == drawing::FillStyle_SOLID)
{
- if(eLocalFillStyle == drawing::FillStyle_SOLID)
- {
- Color aCompareColor = rCompareSet.Get(XATTR_FILLCOLOR).GetColorValue();
+ Color aCompareColor = rCompareSet.Get(XATTR_FILLCOLOR).GetColorValue();
- if(aCompareColor == aLocalColor)
- {
- continue;
- }
- }
- else if(eLocalFillStyle == drawing::FillStyle_NONE)
+ if(aCompareColor == aLocalColor)
{
continue;
}
}
-
- bOverlap = true;
- break;
+ else if(eLocalFillStyle == drawing::FillStyle_NONE)
+ {
+ continue;
+ }
}
- }
- if(bOverlap)
- {
- // yes, start a new layer
- pLayer->mpDown = new E3dDepthLayer;
- pLayer = pLayer->mpDown;
- nNumLayers++;
- pLayer->mvNeighbours.emplace_back(pExtrudeObj, aExtrudePoly);
- }
- else
- {
- // no, add to current layer
- pLayer->mvNeighbours.emplace(pLayer->mvNeighbours.begin(), pExtrudeObj, aExtrudePoly);
+ bOverlap = true;
+ break;
}
}
- else
+
+ if(bOverlap)
{
- // first layer ever
- pBaseLayer = new E3dDepthLayer;
- pLayer = pBaseLayer;
+ // yes, start a new layer
+ pLayer->mpDown = new E3dDepthLayer;
+ pLayer = pLayer->mpDown;
nNumLayers++;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list