summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-10-17 17:36:03 +0000
committerArmin Le Grand <alg@apache.org>2013-10-17 17:36:03 +0000
commita3452f1b587b0da117edf355d3c6430f791ffe66 (patch)
tree346d3f1c6b59ca4f19f3077c23cbf6720a1fc81a
parentcfc0a1aaae0ee8454d0f84c7307228a0f6f959f5 (diff)
GluePoint rework done and checked
-rw-r--r--basctl/source/dlged/dlgedfunc.cxx49
-rw-r--r--filter/source/msfilter/escherex.cxx26
-rw-r--r--filter/source/msfilter/msdffimp.cxx68
-rw-r--r--reportdesign/source/ui/report/ViewsWindow.cxx76
-rw-r--r--sc/source/ui/drawfunc/fudraw.cxx42
-rw-r--r--sd/source/ui/animations/motionpathtag.cxx31
-rw-r--r--sd/source/ui/dlg/gluectrl.cxx11
-rw-r--r--sd/source/ui/func/fuediglu.cxx28
-rw-r--r--sd/source/ui/func/fupoor.cxx40
-rw-r--r--sd/source/ui/view/drviews7.cxx24
-rw-r--r--sd/source/ui/view/sdview3.cxx36
-rw-r--r--svx/Library_svxcore.mk1
-rw-r--r--svx/Package_inc.mk2
-rw-r--r--svx/inc/svx/gluepoint.hxx324
-rw-r--r--svx/inc/svx/svdglev.hxx14
-rw-r--r--svx/inc/svx/svdoashp.hxx10
-rw-r--r--svx/inc/svx/svdobj.hxx53
-rw-r--r--svx/inc/svx/svdoedge.hxx10
-rw-r--r--svx/inc/svx/svdview.hxx1
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx37
-rw-r--r--svx/source/dialog/graphctl.cxx33
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobj.cxx11
-rw-r--r--svx/source/svdraw/gluepoint.cxx667
-rw-r--r--svx/source/svdraw/sdrselection.cxx6
-rw-r--r--svx/source/svdraw/svdcrtv.cxx7
-rw-r--r--svx/source/svdraw/svddrgmt.cxx16
-rw-r--r--svx/source/svdraw/svddrgv.cxx12
-rw-r--r--svx/source/svdraw/svdglev.cxx212
-rw-r--r--svx/source/svdraw/svdmrkv.cxx19
-rw-r--r--svx/source/svdraw/svdmrkv1.cxx178
-rw-r--r--svx/source/svdraw/svdoashp.cxx405
-rw-r--r--svx/source/svdraw/svdobj.cxx157
-rw-r--r--svx/source/svdraw/svdoedge.cxx376
-rw-r--r--svx/source/svdraw/svdpntv.cxx55
-rw-r--r--svx/source/svdraw/svdview.cxx1
-rw-r--r--svx/source/unodraw/gluepts.cxx177
-rw-r--r--sw/source/ui/docvw/edtwin.cxx32
37 files changed, 1647 insertions, 1600 deletions
diff --git a/basctl/source/dlged/dlgedfunc.cxx b/basctl/source/dlged/dlgedfunc.cxx
index c49052a27196..3915dc5dab40 100644
--- a/basctl/source/dlged/dlgedfunc.cxx
+++ b/basctl/source/dlged/dlgedfunc.cxx
@@ -289,55 +289,6 @@ sal_Bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt )
{
// move the handle
pView->MoveHandleByVector(*pHdl, aMove, pWindow, 0);
-
- // TTTT:HANDLE
- //if ( pHdl && !aMove.equalZero() )
- //{
- // const basegfx::B2DPoint aStartPoint( pHdl->getPosition() );
- // const basegfx::B2DPoint aEndPoint( pHdl->getPosition() + aMove );
- // const SdrDragStat& rDragStat = pView->GetDragStat();
- //
- // // start dragging
- // pView->BegDragObj( aStartPoint, pHdl, 0.0 );
- //
- // if ( pView->IsDragObj() )
- // {
- // const bool bWasNoSnap(rDragStat.IsNoSnap());
- // const bool bWasSnapEnabled(pView->IsSnapEnabled());
- //
- // // switch snapping off
- // if ( !bWasNoSnap )
- // {
- // ((SdrDragStat&)rDragStat).SetNoSnap(true);
- // }
- //
- // if ( bWasSnapEnabled )
- // {
- // pView->SetSnapEnabled( false );
- // }
- //
- // pView->MovAction( aEndPoint );
- // pView->EndDragObj();
- //
- // // restore snap
- // if ( !bWasNoSnap )
- // {
- // ((SdrDragStat&)rDragStat).SetNoSnap( bWasNoSnap );
- // }
- //
- // if ( bWasSnapEnabled )
- // {
- // pView->SetSnapEnabled( bWasSnapEnabled );
- // }
- // }
- //
- // // make moved handle visible
- // const basegfx::B2DRange aVisRange(
- // aEndPoint - basegfx::B2DPoint(100.0, 100.0),
- // aEndPoint + basegfx::B2DPoint(100.0, 100.0));
- //
- // pView->MakeVisibleAtView( aVisRange, *pWindow );
- //}
}
}
else
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 8c8d06a12132..6c9781d07c6e 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -4806,8 +4806,8 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst )
if ( nGluePointType == com::sun::star::drawing::EnhancedCustomShapeGluePointType::CUSTOM )
{
- const sdr::glue::List* pList = pCustoShape->GetGluePointList(false);
- const sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector());
+ const sdr::glue::GluePointProvider& rProvider = pCustoShape->GetGluePointProvider();
+ const sdr::glue::GluePointVector aGluePointVector(rProvider.getUserGluePointVector());
if(aGluePointVector.size())
{
@@ -4815,7 +4815,7 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst )
for(sal_uInt32 a(0); a < aGluePointVector.size(); a++)
{
- const sdr::glue::Point* pCandidate = aGluePointVector[a];
+ const sdr::glue::GluePoint* pCandidate = aGluePointVector[a];
if(pCandidate)
{
@@ -4825,31 +4825,13 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst )
}
else
{
- OSL_ENSURE(false, "Got sdr::glue::PointVector with empty entries (!)");
+ OSL_ENSURE(false, "Got sdr::glue::GluePointVector with empty entries (!)");
}
}
nRule = GetClosestPoint( aPoly, aRefPoint );
bRectangularConnection = false;
}
-
- // TTTT:GLUE
- //if ( pList )
- //{
- // Polygon aPoly;
- // sal_uInt16 nNum, nAnz = pList->GetCount();
- // if ( nAnz )
- // {
- // for ( nNum = 0; nNum < nAnz; nNum++ )
- // {
- // const sdr::glue::Point& rGP = (*pList)[ nNum ];
- // const basegfx::B2DPoint aPt( rGP.GetAbsolutePos( sdr::legacy::GetSnapRange(*pCustoShape) ) );
- // aPoly.Insert( POLY_APPEND, Point(basegfx::fround(aPt.getX()), basegfx::fround(aPt.getY())) );
- // }
- // nRule = GetClosestPoint( aPoly, aRefPoint );
- // bRectangularConnection = false;
- // }
- //}
}
else if ( nGluePointType == com::sun::star::drawing::EnhancedCustomShapeGluePointType::SEGMENTS )
{
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index fc152780cfc1..913144270697 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -471,11 +471,10 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
if ( pO )
{
Any aAny;
- sdr::glue::Point aGluePoint;
Reference< XShape > aXShape( pO->getUnoShape(), UNO_QUERY );
Reference< XShape > aXConnector( pPtr->pCObj->getUnoShape(), UNO_QUERY );
- sdr::glue::List* pList = pO->GetGluePointList(true);
- sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector());
+ sdr::glue::GluePointProvider& rProvider = pO->GetGluePointProvider();
+ const sdr::glue::GluePointVector aGluePointVector(rProvider.getUserGluePointVector());
sal_Bool bValidGluePoint = sal_False;
sal_Int32 nId = nC;
sal_uInt32 nInventor = pO->GetObjInventor();
@@ -524,10 +523,9 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
break;
case OBJ_POLY :
{
- // TTTT:GLUE if ( pList && ( pList->GetCount() > nC ) )
if(aGluePointVector.size() > nC)
{
- const sdr::glue::Point* pCandidate = aGluePointVector[nC];
+ const sdr::glue::GluePoint* pCandidate = aGluePointVector[nC];
if(pCandidate)
{
@@ -536,12 +534,8 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
}
else
{
- OSL_ENSURE(false, "Got sdr::glue::PointVector with empty entries (!)");
+ OSL_ENSURE(false, "Got sdr::glue::GluePointVector with empty entries (!)");
}
-
- // TTTT:GLUE
- //bValidGluePoint = sal_True;
- //nId = (sal_Int32)((*pList)[ (sal_uInt16)nC].GetId() + 3 );
}
else
{
@@ -566,36 +560,16 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
if ( eFlags == POLY_NORMAL )
{
- if ( nC == nPointCount )
+ if ( nC == nPointCount && rProvider.allowsUserGluePoints() )
{
const Point& rPoint = rPolygon.GetPoint( j );
const double fX((rPoint.X() - aBoundRect.Left()) / (aBoundRect.GetWidth() ? aBoundRect.GetWidth() : 1));
const double fY((rPoint.Y() - aBoundRect.Top()) / (aBoundRect.GetHeight() ? aBoundRect.GetHeight() : 1));
- // TTTT:GLUE bUserDefined == true okay?
- sdr::glue::Point& rNew = pList->add(sdr::glue::Point(basegfx::B2DPoint(fX, fY)));
+ // create that single GluePoint at polygon point position
+ sdr::glue::GluePoint& rNew = rProvider.addUserGluePoint(sdr::glue::GluePoint(basegfx::B2DPoint(fX, fY)));
nId = rNew.getID() + 4;
bNotFound = sal_False;
-
- //const Point& rPoint = rPolygon.GetPoint( j );
- //double fXRel = rPoint.X() - aBoundRect.Left();
- //double fYRel = rPoint.Y() - aBoundRect.Top();
- //sal_Int32 nWidth = aBoundRect.GetWidth();
- //if ( !nWidth )
- // nWidth = 1;
- //sal_Int32 nHeight= aBoundRect.GetHeight();
- //if ( !nHeight )
- // nHeight = 1;
- //fXRel /= (double)nWidth;
- //fXRel *= 10000;
- //fYRel /= (double)nHeight;
- //fYRel *= 10000;
- //aGluePoint.SetPos( basegfx::B2DPoint( fXRel, fYRel ) );
- //aGluePoint.SetPercent( true );
- //aGluePoint.SetAlign( SDRVERTALIGN_TOP | SDRHORZALIGN_LEFT );
- //aGluePoint.setEscapeDirections(sdr::glue::Point::ESCAPE_DIRECTION_SMART);
- //nId = (sal_Int32)((*pList)[ pList->Insert( aGluePoint ) ].GetId() + 3 );
- //bNotFound = sal_False;
}
nPointCount++;
}
@@ -634,7 +608,7 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
{
if(aGluePointVector.size() > nC)
{
- const sdr::glue::Point* pCandidate = aGluePointVector[nC];
+ const sdr::glue::GluePoint* pCandidate = aGluePointVector[nC];
if(pCandidate)
{
@@ -643,16 +617,9 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
}
else
{
- OSL_ENSURE(false, "Got sdr::glue::PointVector with empty entries (!)");
+ OSL_ENSURE(false, "Got sdr::glue::GluePointVector with empty entries (!)");
}
}
-
- // TTTT:GLUE
- //if ( pList && ( pList->GetCount() > nC ) )
- //{
- // bValidGluePoint = sal_True;
- // nId = (sal_Int32)((*pList)[ (sal_uInt16)nC].GetId() + 3 );
- //}
}
else if ( nGluePointType == EnhancedCustomShapeGluePointType::RECT )
{
@@ -774,14 +741,12 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
aGeometryItem.SetPropertyValue( sPath, aProp );
bValidGluePoint = sal_True;
((SdrObjCustomShape*)pO)->SetMergedItem( aGeometryItem );
+ const sdr::glue::GluePointProvider& rProvider = pO->GetGluePointProvider();
+ const sdr::glue::GluePointVector aGluePointVector(rProvider.getUserGluePointVector());
- // TTTT:GLUE false okay here?
- const sdr::glue::List* pLst = pO->GetGluePointList(false);
- const sdr::glue::PointVector aGPVector(pLst ? pLst->getVector() : sdr::glue::PointVector());
-
- if((sal_Int32)aGPVector.size() > nGluePoints)
+ if(aGluePointVector.size() > nGluePoints)
{
- const sdr::glue::Point* pCandidate = aGPVector[nGluePoints];
+ const sdr::glue::GluePoint* pCandidate = aGluePointVector[nGluePoints];
if(pCandidate)
{
@@ -789,14 +754,9 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
}
else
{
- OSL_ENSURE(false, "Got sdr::glue::PointVector with empty entries (!)");
+ OSL_ENSURE(false, "Got sdr::glue::GluePointVector with empty entries (!)");
}
}
-
- // TTTT:GLUE
- //const sdr::glue::List* pLst = pO->GetGluePointList(true);
- //if ( (sal_Int32)pLst->GetCount() > nGluePoints )
- // nId = (sal_Int32)((*pLst)[ (sal_uInt16)nGluePoints ].GetId() + 3 );
}
}
}
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index c5e348f2c1aa..9d3c634d79e6 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -1748,82 +1748,6 @@ void OViewsWindow::handleKey(const KeyCode& _rCode)
// move the handle
rView.MoveHandleByVector(*pHdl, aMove, &rReportSection, 0);
}
-
- // TTTT:HANDLE
- //if ( pHdl && !aMove.equalZero() )
- //{
- // const basegfx::B2DPoint aStartPoint( pHdl->getPosition() );
- // const basegfx::B2DPoint aEndPoint( pHdl->getPosition() + aMove );
- // const SdrDragStat& rDragStat = rView.GetDragStat();
- //
- // // start dragging
- // rView.BegDragObj( aStartPoint, pHdl, 0.0 );
- //
- // if ( rView.IsDragObj() )
- // {
- // const bool bWasNoSnap = rDragStat.IsNoSnap();
- // const bool bWasSnapEnabled = rView.IsSnapEnabled();
- //
- // // switch snapping off
- // if ( !bWasNoSnap )
- // ((SdrDragStat&)rDragStat).SetNoSnap( true );
- // if ( bWasSnapEnabled )
- // rView.SetSnapEnabled( false );
- //
- // basegfx::B2DRange aNewRange;
- // bool bCheck = false;
- // const SdrObjectVector aSelection(rView.getSelectedSdrObjectVectorFromSdrMarkView());
- //
- // for (sal_uInt32 i(0); !bCheck && i < aSelection.size(); ++i )
- // {
- // bCheck = dynamic_cast< OUnoObject* >(aSelection[i]) || dynamic_cast< OOle2Obj* >(aSelection[i]);
- // if ( bCheck )
- // aNewRange.expand(aSelection[i]->getObjectRange(&rView));
- // }
- //
- // switch(pHdl->GetKind())
- // {
- // case HDL_LEFT:
- // case HDL_UPLFT:
- // case HDL_LWLFT:
- // case HDL_UPPER:
- // aNewRange = basegfx::B2DRange(
- // aNewRange.getMinimum() + aMove,
- // aNewRange.getMaximum());
- // break;
- // case HDL_UPRGT:
- // case HDL_RIGHT:
- // case HDL_LWRGT:
- // case HDL_LOWER:
- // aNewRange = basegfx::B2DRange(
- // aNewRange.getMinimum(),
- // aNewRange.getMaximum() + aMove);
- // break;
- // default:
- // break;
- // }
- //
- // if ( !(bCheck && isOver(aNewRange,*rReportSection.getPage(),rView)) )
- // {
- // rView.MovAction(aEndPoint);
- // }
- //
- // rView.EndDragObj();
- //
- // // restore snap
- // if ( !bWasNoSnap )
- // ((SdrDragStat&)rDragStat).SetNoSnap( bWasNoSnap );
- // if ( bWasSnapEnabled )
- // rView.SetSnapEnabled( bWasSnapEnabled );
- // }
- //
- // // make moved handle visible
- // const basegfx::B2DRange aRange(
- // aEndPoint - basegfx::B2DPoint(DEFAUL_MOVE_SIZE, DEFAUL_MOVE_SIZE),
- // aEndPoint + basegfx::B2DPoint(DEFAUL_MOVE_SIZE, DEFAUL_MOVE_SIZE));
- //
- // rView.MakeVisibleAtView( aRange, rReportSection);
- //}
}
rView.RecreateAllMarkHandles();
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index b9c4e5e55677..40f6c77f567f 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -602,47 +602,7 @@ sal_Bool __EXPORT FuDraw::KeyInput(const KeyEvent& rKEvt)
{
// move handle with index nHandleIndex
pView->MoveHandleByVector(*pHdl, aMove, pWindow, 0);
-
- // TTTT:HANDLE
- //if(pHdl && !aMove.equalZero())
- //{
- // // now move the Handle
- // const basegfx::B2DPoint aStartPoint(pHdl->getPosition());
- // const basegfx::B2DPoint aEndPoint(aStartPoint + aMove);
- // const SdrDragStat& rDragStat = pView->GetDragStat();
- //
- // // start dragging
- // pView->BegDragObj(aStartPoint, pHdl, 0.0);
- //
- // if(pView->IsDragObj())
- // {
- // const bool bWasNoSnap(rDragStat.IsNoSnap());
- // const bool bWasSnapEnabled(pView->IsSnapEnabled());
- //
- // // switch snapping off
- // if(!bWasNoSnap)
- // ((SdrDragStat&)rDragStat).SetNoSnap(true);
- // if(bWasSnapEnabled)
- // pView->SetSnapEnabled(false);
- //
- // pView->MovAction(aEndPoint);
- // pView->EndDragObj();
- //
- // // restore snap
- // if(!bWasNoSnap)
- // ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
- // if(bWasSnapEnabled)
- // pView->SetSnapEnabled(bWasSnapEnabled);
- // }
- //
- // // make moved handle visible
- // const basegfx::B2DRange aVisRange(
- // aEndPoint - basegfx::B2DPoint(100.0, 100.0),
- // aEndPoint + basegfx::B2DPoint(100.0, 100.0));
- // pView->MakeVisibleAtView(aVisRange, *pWindow);
- //
- bReturn = sal_True;
- //}
+ bReturn = sal_True;
}
}
}
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx
index 95405bc2cec9..bcd12aa42e65 100644
--- a/sd/source/ui/animations/motionpathtag.cxx
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -770,37 +770,6 @@ bool MotionPathTag::OnMove( const KeyEvent& rKEvt )
}
mrView.MoveHandleByVector(*pHdl, basegfx::B2DVector(fX, fY), 0, pDragMethod);
-
- // TTTT:HANDLE
- //const basegfx::B2DPoint aStartPoint(pHdl->getPosition());
- //const basegfx::B2DPoint aEndPoint(aStartPoint + basegfx::B2DPoint(fX, fY));
- //
- //// start dragging
- //rtl::Reference< MotionPathTag > xTag( this );
- //SdrDragMethod* pDragMethod = 0;
- //
- //mrView.BegDragObj(aStartPoint, pHdl, 0.0, pDragMethod);
- //
- //if(mrView.IsDragObj())
- //{
- // const bool bWasNoSnap(mrView.GetDragStat().IsNoSnap());
- // const bool bWasSnapEnabled(mrView.IsSnapEnabled());
- //
- // // switch snapping off
- // if(!bWasNoSnap)
- // ((SdrDragStat&)mrView.GetDragStat()).SetNoSnap(true);
- // if(bWasSnapEnabled)
- // mrView.SetSnapEnabled(false);
- //
- // mrView.MovAction(aEndPoint);
- // mrView.EndDragObj();
- //
- // // restore snap
- // if(!bWasNoSnap)
- // ((SdrDragStat&)mrView.GetDragStat()).SetNoSnap(bWasNoSnap);
- // if(bWasSnapEnabled)
- // mrView.SetSnapEnabled(bWasSnapEnabled);
- //}
}
else
{
diff --git a/sd/source/ui/dlg/gluectrl.cxx b/sd/source/ui/dlg/gluectrl.cxx
index 72d2081b9dc6..42fcf45585c7 100644
--- a/sd/source/ui/dlg/gluectrl.cxx
+++ b/sd/source/ui/dlg/gluectrl.cxx
@@ -34,6 +34,7 @@
#include <sfx2/dispatch.hxx>
#include <vcl/toolbox.hxx>
#include <sfx2/viewfrm.hxx>
+#include <svx/gluepoint.hxx>
#include "strings.hrc"
#include "gluectrl.hxx"
@@ -48,11 +49,11 @@ using namespace ::com::sun::star::frame;
#define ESCDIR_COUNT 5
static sal_uInt16 aEscDirArray[] =
{
- sdr::glue::Point::ESCAPE_DIRECTION_SMART,
- sdr::glue::Point::ESCAPE_DIRECTION_LEFT,
- sdr::glue::Point::ESCAPE_DIRECTION_RIGHT,
- sdr::glue::Point::ESCAPE_DIRECTION_TOP,
- sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM
+ sdr::glue::GluePoint::ESCAPE_DIRECTION_SMART,
+ sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT,
+ sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT,
+ sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP,
+ sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM
};
diff --git a/sd/source/ui/func/fuediglu.cxx b/sd/source/ui/func/fuediglu.cxx
index 725d22616540..c7a575885cca 100644
--- a/sd/source/ui/func/fuediglu.cxx
+++ b/sd/source/ui/func/fuediglu.cxx
@@ -381,29 +381,29 @@ void FuEditGluePoints::ReceiveRequest(SfxRequest& rReq)
case SID_GLUE_ESCDIR_LEFT:
{
- mpView->SetMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_LEFT,
- !mpView->IsMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_LEFT ) );
+ mpView->SetMarkedGluePointsEscDir( sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT,
+ !mpView->IsMarkedGluePointsEscDir( sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT ) );
}
break;
case SID_GLUE_ESCDIR_RIGHT:
{
- mpView->SetMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_RIGHT,
- !mpView->IsMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_RIGHT ) );
+ mpView->SetMarkedGluePointsEscDir( sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT,
+ !mpView->IsMarkedGluePointsEscDir( sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT ) );
}
break;
case SID_GLUE_ESCDIR_TOP:
{
- mpView->SetMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_TOP,
- !mpView->IsMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_TOP ) );
+ mpView->SetMarkedGluePointsEscDir( sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP,
+ !mpView->IsMarkedGluePointsEscDir( sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP ) );
}
break;
case SID_GLUE_ESCDIR_BOTTOM:
{
- mpView->SetMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM,
- !mpView->IsMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM ) );
+ mpView->SetMarkedGluePointsEscDir( sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM,
+ !mpView->IsMarkedGluePointsEscDir( sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM ) );
}
break;
@@ -418,37 +418,37 @@ void FuEditGluePoints::ReceiveRequest(SfxRequest& rReq)
case SID_GLUE_HORZALIGN_CENTER:
{
- mpView->SetMarkedGluePointsAlign(false, sdr::glue::Point::Alignment_Center);
+ mpView->SetMarkedGluePointsAlign(false, sdr::glue::GluePoint::Alignment_Center);
}
break;
case SID_GLUE_HORZALIGN_LEFT:
{
- mpView->SetMarkedGluePointsAlign(false, sdr::glue::Point::Alignment_Minimum);
+ mpView->SetMarkedGluePointsAlign(false, sdr::glue::GluePoint::Alignment_Minimum);
}
break;
case SID_GLUE_HORZALIGN_RIGHT:
{
- mpView->SetMarkedGluePointsAlign(false, sdr::glue::Point::Alignment_Maximum);
+ mpView->SetMarkedGluePointsAlign(false, sdr::glue::GluePoint::Alignment_Maximum);
}
break;
case SID_GLUE_VERTALIGN_CENTER:
{
- mpView->SetMarkedGluePointsAlign(true, sdr::glue::Point::Alignment_Center);
+ mpView->SetMarkedGluePointsAlign(true, sdr::glue::GluePoint::Alignment_Center);
}
break;
case SID_GLUE_VERTALIGN_TOP:
{
- mpView->SetMarkedGluePointsAlign(true, sdr::glue::Point::Alignment_Minimum);
+ mpView->SetMarkedGluePointsAlign(true, sdr::glue::GluePoint::Alignment_Minimum);
}
break;
case SID_GLUE_VERTALIGN_BOTTOM:
{
- mpView->SetMarkedGluePointsAlign(true, sdr::glue::Point::Alignment_Maximum);
+ mpView->SetMarkedGluePointsAlign(true, sdr::glue::GluePoint::Alignment_Maximum);
}
break;
}
diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
index defbbda46e4a..0a17dbb97ea4 100644
--- a/sd/source/ui/func/fupoor.cxx
+++ b/sd/source/ui/func/fupoor.cxx
@@ -812,46 +812,6 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
{
// move handle with index nHandleIndex
mpView->MoveHandleByVector(*pHdl, aMove, mpWindow, 0);
-
- // TTTT:HANDLE
- //if(pHdl && !aMove.equalZero())
- //{
- // // now move the Handle
- // const basegfx::B2DPoint aStartPoint(pHdl->getPosition());
- // const basegfx::B2DPoint aEndPoint(aStartPoint + aMove);
- // const SdrDragStat& rDragStat = mpView->GetDragStat();
- //
- // // start dragging
- // mpView->BegDragObj(aStartPoint, pHdl, 0.0);
- //
- // if(mpView->IsDragObj())
- // {
- // const bool bWasNoSnap(rDragStat.IsNoSnap());
- // const bool bWasSnapEnabled(mpView->IsSnapEnabled());
- //
- // // switch snapping off
- // if(!bWasNoSnap)
- // ((SdrDragStat&)rDragStat).SetNoSnap(true);
- // if(bWasSnapEnabled)
- // mpView->SetSnapEnabled(false);
- //
- // mpView->MovAction(aEndPoint);
- // mpView->EndDragObj();
- //
- // // restore snap
- // if(!bWasNoSnap)
- // ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
- // if(bWasSnapEnabled)
- // mpView->SetSnapEnabled(bWasSnapEnabled);
- // }
- //
- // // make moved handle visible
- // const basegfx::B2DRange aVisRange(
- // aEndPoint - basegfx::B2DPoint(100.0, 100.0),
- // aEndPoint + basegfx::B2DPoint(100.0, 100.0));
- //
- // mpView->MakeVisibleAtView(aVisRange, *mpWindow);
- //}
}
// #109007#
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 5aa45c5db044..87b0c6fc9c15 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -459,18 +459,18 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
else
{
// Horizontale Ausrichtung
- const sdr::glue::Point::Alignment nHorz(mpDrawView->GetMarkedGluePointsAlign(false));
+ const sdr::glue::GluePoint::Alignment nHorz(mpDrawView->GetMarkedGluePointsAlign(false));
- rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_CENTER, nHorz == sdr::glue::Point::Alignment_Center ) );
- rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_LEFT, nHorz == sdr::glue::Point::Alignment_Minimum ) );
- rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_RIGHT, nHorz == sdr::glue::Point::Alignment_Maximum ) );
+ rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_CENTER, nHorz == sdr::glue::GluePoint::Alignment_Center ) );
+ rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_LEFT, nHorz == sdr::glue::GluePoint::Alignment_Minimum ) );
+ rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_RIGHT, nHorz == sdr::glue::GluePoint::Alignment_Maximum ) );
// Vertikale Ausrichtung
- const sdr::glue::Point::Alignment nVert(mpDrawView->GetMarkedGluePointsAlign(true));
+ const sdr::glue::GluePoint::Alignment nVert(mpDrawView->GetMarkedGluePointsAlign(true));
- rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_CENTER, nVert == sdr::glue::Point::Alignment_Center ) );
- rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_TOP, nVert == sdr::glue::Point::Alignment_Minimum ) );
- rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_BOTTOM, nVert == sdr::glue::Point::Alignment_Maximum ) );
+ rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_CENTER, nVert == sdr::glue::GluePoint::Alignment_Center ) );
+ rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_TOP, nVert == sdr::glue::GluePoint::Alignment_Minimum ) );
+ rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_BOTTOM, nVert == sdr::glue::GluePoint::Alignment_Maximum ) );
}
// Punkt einfuegen
@@ -478,25 +478,25 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
// Autrittsrichtung
// Links
- eState = mpDrawView->IsMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_LEFT );
+ eState = mpDrawView->IsMarkedGluePointsEscDir( sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT );
if( eState == STATE_DONTKNOW )
rSet.InvalidateItem( SID_GLUE_ESCDIR_LEFT );
else
rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_LEFT, eState == STATE_CHECK ) );
// Rechts
- eState = mpDrawView->IsMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_RIGHT );
+ eState = mpDrawView->IsMarkedGluePointsEscDir( sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT );
if( eState == STATE_DONTKNOW )
rSet.InvalidateItem( SID_GLUE_ESCDIR_RIGHT );
else
rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_RIGHT, eState == STATE_CHECK ) );
// Oben
- eState = mpDrawView->IsMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_TOP );
+ eState = mpDrawView->IsMarkedGluePointsEscDir( sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP );
if( eState == STATE_DONTKNOW )
rSet.InvalidateItem( SID_GLUE_ESCDIR_TOP );
else
rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_TOP, eState == STATE_CHECK ) );
// Unten
- eState = mpDrawView->IsMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM );
+ eState = mpDrawView->IsMarkedGluePointsEscDir( sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM );
if( eState == STATE_DONTKNOW )
rSet.InvalidateItem( SID_GLUE_ESCDIR_BOTTOM );
else
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index dcaa73afd8da..48aa1a9241fd 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -547,10 +547,11 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
else
{
// set position of connection point of original connected object
- const sdr::glue::List* pGlueList = pConnObj->GetGluePointList(false);
- if(pGlueList)
+ const sdr::glue::GluePointProvider& rProvider = pConnObj->GetGluePointProvider();
+
+ if(rProvider.hasUserGluePoints())
{
- const sdr::glue::Point* pCandidate = pGlueList->findByID(rConn0.GetConnectorId());
+ const sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(rConn0.GetConnectorId());
if(pCandidate)
{
@@ -558,17 +559,6 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
pCloneEdge->SetTailPoint(false, aPosition + aVector);
}
-
- // TTTT:GLUE
- //sal_uInt32 nInd = pGlueList->FindGluePoint(rConn0.GetConnectorId());
- //
- //if(SDRGLUEPOINT_NOTFOUND != nInd)
- //{
- // const sdr::glue::Point& rGluePoint = (*pGlueList)[nInd];
- // basegfx::B2DPoint aPosition = rGluePoint.GetAbsolutePos(sdr::legacy::GetSnapRange(*pConnObj));
- // aPosition += aVector;
- // pCloneEdge->SetTailPoint(false, aPosition);
- //}
}
}
}
@@ -588,10 +578,11 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
else
{
// set position of connection point of original connected object
- const sdr::glue::List* pGlueList = pConnObj->GetGluePointList(false);
- if(pGlueList)
+ const sdr::glue::GluePointProvider& rProvider = pConnObj->GetGluePointProvider();
+
+ if(rProvider.hasUserGluePoints())
{
- const sdr::glue::Point* pCandidate = pGlueList->findByID(rConn1.GetConnectorId());
+ const sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(rConn1.GetConnectorId());
if(pCandidate)
{
@@ -599,17 +590,6 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
pCloneEdge->SetTailPoint(true, aPosition + aVector);
}
-
- // TTTT:GLUE
- //sal_uInt32 nInd = pGlueList->FindGluePoint(rConn1.GetConnectorId());
- //
- //if(SDRGLUEPOINT_NOTFOUND != nInd)
- //{
- // const sdr::glue::Point& rGluePoint = (*pGlueList)[nInd];
- // basegfx::B2DPoint aPosition = rGluePoint.GetAbsolutePos(sdr::legacy::GetSnapRange(*pConnObj));
- // aPosition += aVector;
- // pCloneEdge->SetTailPoint(true, aPosition);
- //}
}
}
}
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 7e0925d8a0b9..b2bce1e9b1e3 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -304,7 +304,6 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/svdraw/sdrpagewindow \
svx/source/svdraw/sdrobjecttools \
svx/source/svdraw/sdrpaintwindow \
- svx/source/svdraw/sdrglue \
svx/source/svdraw/selectioncontroller \
svx/source/svdraw/svdattr \
svx/source/svdraw/svdcrtv \
diff --git a/svx/Package_inc.mk b/svx/Package_inc.mk
index 2d10034cc00f..f0c8f620e7b6 100644
--- a/svx/Package_inc.mk
+++ b/svx/Package_inc.mk
@@ -135,6 +135,7 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/galtheme.hxx,svx/galtheme.hxx)
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/globl3d.hxx,svx/globl3d.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/globlmn.hrc,globlmn_tmpl.hrc))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/grafctrl.hxx,svx/grafctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/gluepoint.hxx,svx/gluepoint.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/graphctl.hxx,svx/graphctl.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/grfcrop.hxx,svx/grfcrop.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/grfflt.hxx,svx/grfflt.hxx))
@@ -315,7 +316,6 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrmasterpagedescriptor.hxx,sv
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrobjectfilter.hxx,svx/sdrobjectfilter.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrpagewindow.hxx,svx/sdrpagewindow.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrpaintwindow.hxx,svx/sdrpaintwindow.hxx))
-$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrglue.hxx,svx/sdrglue.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrundomanager.hxx,svx/sdrundomanager.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtaaitm.hxx,svx/sdtaaitm.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtaditm.hxx,svx/sdtaditm.hxx))
diff --git a/svx/inc/svx/gluepoint.hxx b/svx/inc/svx/gluepoint.hxx
index e77e8d31a4ef..73c50fa9611e 100644
--- a/svx/inc/svx/gluepoint.hxx
+++ b/svx/inc/svx/gluepoint.hxx
@@ -22,111 +22,293 @@
#ifndef _GLUEPOINT_HXX
#define _GLUEPOINT_HXX
-#include <sal/types.h>
#include <basegfx/point/b2dpoint.hxx>
-#include <com/sun/star/drawing/Alignment.hpp>
-#include <com/sun/star/drawing/EscapeDirection.hpp>
+#include <basegfx/vector/b2dvector.hxx>
+#include "svx/svxdllapi.h"
+#include <com/sun/star/drawing/GluePoint2.hpp>
+#include <set>
+#include <vector>
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace sdr
{
- namespace gluepoint
+ namespace glue
{
- enum GluePointType
+ // The GluePoint class describes possible GluePoints for objects which support
+ // a GluePointProvider (see below). GluePoints are principally in unit coordinates
+ // so that they do not have to be transformed with the object they belong to.
+ // Their coordinateas will always be truncated to the unit range (0, 0, 1, 1)
+ // when used, so being always inside that range and thus cannot leave the
+ // object. Internally, values outside that range are used to model GluePoint
+ // states when not relative and Alignment is set to keep that alignment alive
+ // even when the positions are moved outside the object
+ class SVX_DLLPUBLIC GluePoint
{
- GLUEPOINTTYPE_AUTO,
- GLUEPOINTTYPE_EDGE,
- GLUEPOINTTYPE_USER
+ public:
+ // defines for GluePoint alignment (see members meHorizontalAlignment,
+ // meVerticalAlignment)
+ enum Alignment
+ {
+ Alignment_Minimum,
+ Alignment_Center,
+ Alignment_Maximum
+ };
+
+ // defines for GluePoint escape direction (meEscapeDirections). These
+ // may be or-ed together to define all allowed escape directions from
+ // which the layouter may choose the best possible.
+ // Or-ing all allowed values is from the meaning identical to ESCAPE_DIRECTION_SMART.
+ static const sal_uInt16 ESCAPE_DIRECTION_SMART = 0;
+ static const sal_uInt16 ESCAPE_DIRECTION_LEFT = 1;
+ static const sal_uInt16 ESCAPE_DIRECTION_RIGHT = 2;
+ static const sal_uInt16 ESCAPE_DIRECTION_TOP = 4;
+ static const sal_uInt16 ESCAPE_DIRECTION_BOTTOM = 8;
+
+ private:
+ // allow class GluePointProvider access to setID() in setIdAtGluePoint()
+ friend class GluePointProvider;
+
+ // position in unit coordinates [0.0 .. 1.0] in X,Y
+ // may be internally outside the unit range when the GluePoint is not relative
+ basegfx::B2DPoint maUnitPosition;
+
+ // allowed escape directions, default is ESCAPE_DIRECTION_SMART
+ sal_uInt16 meEscapeDirections;
+
+ // horizontal and vertical alignments. If != Alignment_None the
+ // position will change as distance from the defined anchor position.
+ Alignment meHorizontalAlignment;
+ Alignment meVerticalAlignment;
+
+ // unique identifier ID. All GluePoints in one list need unique identifiers
+ // and will be sorted by these. This is administrated by the
+ // GluePointProvider class
+ sal_uInt32 maID;
+
+ /// bitfield
+ // if true, position is just relative to unit range (default)
+ // if false, position is also relative, but additionally controlled
+ // by the Alignment settings when the object it belongs to is scaled
+ bool mbRelative : 1;
+
+ // needed to separate user-defined GluePoints from the ones from
+ // CustomShapes (custom-defined GluePoints)
+ bool mbUserDefined : 1;
+
+ // write access to ID is limited to GluePointProvider class only
+ void setID(sal_uInt32 nNew) { maID = nNew; }
+
+ // write access to scale adaption to GluePointProvider class only
+ void adaptToChangedScale(const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale);
+
+ protected:
+ public:
+ GluePoint(
+ const basegfx::B2DPoint& rUnitPosition = basegfx::B2DPoint(0.5, 0.5),
+ sal_uInt16 nEscapeDirections = ESCAPE_DIRECTION_SMART,
+ Alignment eHorizontalAlignment = Alignment_Center,
+ Alignment eVerticalAlignment = Alignment_Center,
+ bool bRelative = true,
+ bool bUserDefined = true);
+
+ // get/set UnitPosition. Always in [0.0 .. 1.0] in Y and Y, will be truncated at set
+ // and truncated at get
+ basegfx::B2DPoint getUnitPosition() const;
+ void setUnitPosition(const basegfx::B2DPoint& rNew);
+
+ // get/set allowed EscapeDirections
+ sal_uInt16 getEscapeDirections() const { return meEscapeDirections; }
+ void setEscapeDirections(sal_uInt16 nNew) { meEscapeDirections = nNew; }
+
+ // get/set HorizontalAlignment
+ Alignment getHorizontalAlignment() const { return meHorizontalAlignment; }
+ void setHorizontalAlignment(Alignment eNew) { meHorizontalAlignment = eNew; }
+
+ // get/set VerticalAlignment
+ Alignment getVerticalAlignment() const { return meVerticalAlignment; }
+ void setVerticalAlignment(Alignment eNew) { meVerticalAlignment = eNew; }
+
+ // acess to relative flag. When setting to true the UnitPostion will be
+ // internally truncated since the non-relative modes allow values outside
+ // the unit range
+ bool getRelative() const { return mbRelative; }
+ void setRelative(bool bNew);
+
+ // access to UserDefined (read only, define at construction time)
+ bool getUserDefined() const { return mbUserDefined; }
+
+ // read access to ID (write is private and limitied to list class)
+ sal_uInt32 getID() const { return maID; }
+
+ // needed UNO API converters; both rely on the correct absolute scale given since the UNO API
+ // definition partially uses the sizes of the object the GluePoint belongs to. The converter to
+ // sdr::glue::GluePoint is implemented as constructor
+ com::sun::star::drawing::GluePoint2 convertToGluePoint2(
+ const basegfx::B2DVector& rAbsoluteScale) const;
+ GluePoint(
+ const com::sun::star::drawing::GluePoint2& rGluePoint2,
+ const basegfx::B2DVector& rAbsoluteScale);
};
+ } // end of namespace glue
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace glue
+ {
+ // typedef for GluePointVector
+ typedef ::std::vector< GluePoint* > GluePointVector;
- class GluePoint
+ // This is the basic GluePoint providing interface; an instance of this class is
+ // provided by objects supporting GluePoints (e.g. SdrObjects, using
+ // GetGluePointProvider()).
+ // There are two basic kinds of GluePoints: AutoGluePoints and UserGluePoints.
+ //
+ // AutoGluePoints are constant GluePoints offered by the object, e.g. the standard
+ // left/right/top/back.
+ //
+ // UserGluePoints may be freely added/edited by the user, but there may also be
+ // implementations which do not support UserGluePoints at all (SdrEdgeObj). There may
+ // also be implementations which add 'fixed' UserGluePoints for which delete/edit
+ // will be ignored, e.g. standard GluePoints added from a CustomShape, but not the
+ // user. These will return false on getUserDefined().
+ //
+ // This basic implementation implements:
+ // - standard AutoGluePoints (left/right/top/back)
+ // - no UserGluePoints
+
+ class SVX_DLLPUBLIC GluePointProvider
{
private:
- basegfx::B2DPoint maPosition;
- sal_uInt32 mnIdentifier;
- GluePointType meType;
- com::sun::star::drawing::Alignment meAlignment;
- com::sun::star::drawing::EscapeDirection meEscapeDirection;
+ protected:
+ // copy constructor and assignment are protected, use Clone() to create copies
+ // with content
+ GluePointProvider(const GluePointProvider& rCandidate);
+ virtual GluePointProvider& operator=(const GluePointProvider& rCandidate);
- public:
- GluePoint()
- : maPosition(0.0, 0.0),
- mnIdentifier(0),
- meType(GLUEPOINTTYPE_AUTO),
- meAlignment(com::sun::star::drawing::Alignment_TOP_LEFT),
- meEscapeDirection(com::sun::star::drawing::EscapeDirection_SMART)
+ // internal access to GluePoint::setID; this is internal functionality and
+ // only the basic implementations of GluePointProvider::addUserGluePoint should use it
+ void setIdAtGluePoint(GluePoint& rGluePoint, sal_uInt32 nNew)
{
+ rGluePoint.setID(nNew);
}
- GluePoint(
- const basegfx::B2DPoint& rPosition,
- sal_uInt32 nIdentifier,
- GluePointType eType,
- com::sun::star::drawing::Alignment eAlignment = com::sun::star::drawing::Alignment_CENTER,
- com::sun::star::drawing::EscapeDirection eEscapeDirection = com::sun::star::drawing::EscapeDirection_SMART)
- : maPosition(rPosition),
- mnIdentifier(nIdentifier),
- meType(eType),
- meAlignment(eAlignment),
- meEscapeDirection(eEscapeDirection)
+ // internal access to GluePoint::adaptToChangedScale; this is internal functionality and
+ // only the basic implementations of GluePointProvider::adaptUserGluePointsToChangedScale
+ // should use it
+ void adaptGluePointToChangedScale(GluePoint& rGluePoint, const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale)
{
+ rGluePoint.adaptToChangedScale(rOldScale, rNewScale);
}
- const basegfx::B2DPoint& getPosition() const { return maPosition; }
- sal_uInt32 getIdentifier() const { return mnIdentifier; }
- GluePointType getType() const { return meType; }
- com::sun::star::drawing::Alignment getAlignment() const { return meAlignment; }
- com::sun::star::drawing::EscapeDirection getEscapeDirection() const { return meEscapeDirection; }
+ public:
+ // construction, destruction
+ GluePointProvider();
+ virtual ~GluePointProvider();
+
+ // copying
+ virtual GluePointProvider* Clone() const;
+
+ // AutoGluePoint read access (read only, the GluePoints returned are
+ // usually created on the fly). The count is currently fixed to 4,
+ // mainly because the UNO API implementations rely on this
+ virtual sal_uInt32 getAutoGluePointCount() const;
+ virtual GluePoint getAutoGluePointByIndex(sal_uInt32 nIndex) const;
+
+ // flag if UserGluePoints are allowed (e.g. not for SdrEdgeObj), needs
+ // to be checked before calling addUserGluePoint
+ virtual bool allowsUserGluePoints() const;
+
+ // add new GluePoint, it gets internally a new ID assigned and a
+ // reference to the new instance (copied to list) is returned. It
+ // will assert when already added or could not be added. To check
+ // if it was added, compare the address of the return value with
+ // the address of rNew
+ virtual GluePoint& addUserGluePoint(GluePoint& rNew);
+
+ // remove GluePoint (will assert if it was not added)
+ virtual void removeUserGluePoint(const GluePoint& rNew);
+
+ // check on content
+ virtual bool hasUserGluePoints() const;
+
+ // find UserGluePoint by ID
+ virtual GluePoint* findUserGluePointByID(sal_uInt32 nID) const;
+
+ // get vector of UserGluePoints (pointers to the real points). This
+ // makes accesses easier, but should only be used as temporary data
+ virtual const GluePointVector getUserGluePointVector() const;
+
+ // adapt UserGluePoints to changed absolute scale, e.g. when not relative and alignments have to be addressed
+ virtual void adaptUserGluePointsToChangedScale(const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale);
};
- } // end of namespace gluepoint
+ } // end of namespace glue
} // end of namespace sdr
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace sdr
{
- namespace gluepoint
+ namespace glue
{
- class GluePointProvider
+ // operator for ::std::set to sort GluePoints by ID
+ struct GluePointComparator
{
+ bool operator()(const GluePoint& rA, const GluePoint& rB) const;
+ };
+
+ // typedef for GluePoint set
+ typedef ::std::set< GluePoint, GluePointComparator > GluePointSet;
+
+ // This derivation of GluePointProvider extends the standard one to
+ // support basic UserGluePoints in all aspects (new/edit/delete)
+
+ class SVX_DLLPUBLIC StandardGluePointProvider : public GluePointProvider
+ {
+ private:
+ // the GluePoint set for UserGluePoints. Use a set sorted by ID
+ // to be able to implement findUserGluePointByID effectively
+ GluePointSet maGluePointSet;
+
+ protected:
+ StandardGluePointProvider(const StandardGluePointProvider& rCandidate);
+ virtual GluePointProvider& operator=(const GluePointProvider& rCandidate);
+
public:
// construction, destruction, copying
- GluePointProvider();
- virtual ~GluePointProvider();
- GluePointProvider(const GluePointProvider& rCandidate);
- virtual GluePointProvider& operator=(const GluePointProvider& rCandidate);
+ StandardGluePointProvider();
+ virtual ~StandardGluePointProvider();
- // Clone() operator calls the local copy constructor
- virtual GluePointProvider& Clone() const;
+ // copying
+ virtual GluePointProvider* Clone() const;
- // AutoGluePoint access
- virtual sal_uInt32 getAutoGluePointCount() const;
- virtual GluePoint getAutoGluePointByIndex(sal_uInt32 nIndex) const;
+ // flag if UserGluePoints are allowed (e.g. not for SdrEdgeObj)
+ virtual bool allowsUserGluePoints() const;
+
+ // add new GluePoint, it gets a new ID assigned and a reference to the
+ // new instance (copied to list) is returned. It will assert when
+ // already added
+ virtual GluePoint& addUserGluePoint(GluePoint& rNew);
+
+ // remove GluePoint (will assert if it was not added)
+ virtual void removeUserGluePoint(const GluePoint& rNew);
+
+ // check on content
+ virtual bool hasUserGluePoints() const;
+
+ // find UserGluePoint by ID
+ virtual GluePoint* findUserGluePointByID(sal_uInt32 nID) const;
+
+ // get vector of UserGluePoints (pointers to the real points)
+ virtual const GluePointVector getUserGluePointVector() const;
- // EdgeGluePoint access
- virtual sal_uInt32 getEdgeGluePointCount() const;
- virtual GluePoint getEdgeGluePointByIndex(sal_uInt32 nIndex) const;
-
- // UserGluePoint access
- virtual sal_uInt32 getUserGluePointCount() const;
- virtual GluePoint getUserGluePointByIndex(sal_uInt32 nIndex) const;
-
- // bundled GluePoint access
- sal_uInt32 getGluePointCount() const;
- GluePoint getGluePointByIndex(sal_uInt32 nIndex) const;
-
- // UserGluePoint manipulation
- virtual bool areUserGluePointsAllowed() const;
- virtual GluePoint addUserGluePoint(
- const basegfx::B2DPoint& rPosition,
- GluePointType eType,
- com::sun::star::drawing::Alignment eAlignment,
- com::sun::star::drawing::EscapeDirection eEscapeDirection);
- virtual void removeUserGluePoint(const GluePoint& rCandidate);
- virtual bool existsUserGluePoint(const GluePoint& rCandidate) const;
+ // adapt UserGluePoints to changed absolute scale, e.g. when not relative and alignments have to be addressed
+ virtual void adaptUserGluePointsToChangedScale(const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale);
};
- } // end of namespace gluepoint
+ } // end of namespace glue
} // end of namespace sdr
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/svx/inc/svx/svdglev.hxx b/svx/inc/svx/svdglev.hxx
index 81ed0a84b235..2379a40d7681 100644
--- a/svx/inc/svx/svdglev.hxx
+++ b/svx/inc/svx/svdglev.hxx
@@ -28,7 +28,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
// predefines
-class sdr::glue::Point;
+class sdr::glue::GluePoint;
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -37,8 +37,7 @@ class SVX_DLLPUBLIC SdrGlueEditView: public SdrPolyEditView
private:
// Markierte Klebepunkte kopieren und anstelle der alten markieren
void ImpCopyMarkedGluePoints();
- typedef void (*PGlueDoFunc)(sdr::glue::Point&, const SdrObject* pObj, const void*, const void*, const void*, const void*, const void*);
- // TTTT:GLUE typedef void (*PGlueTrFunc)(basegfx::B2DPoint&, const void*, const void*, const void*, const void*, const void*);
+ typedef void (*PGlueDoFunc)(sdr::glue::GluePoint&, const SdrObject* pObj, const void*, const void*, const void*, const void*, const void*);
void ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, const void* p1 = 0, const void* p2 = 0, const void* p3 = 0, const void* p4 = 0, const void* p5 = 0);
void ImpTransformMarkedGluePoints(const basegfx::B2DHomMatrix& rTransform);
@@ -73,8 +72,8 @@ public:
// SDRVERTALIGN_TOP
// SDRVERTALIGN_BOTTOM
// SDRVERTALIGN_DONTCARE (nur bei Get())
- sdr::glue::Point::Alignment GetMarkedGluePointsAlign(bool bVert) const;
- void SetMarkedGluePointsAlign(bool bVert, sdr::glue::Point::Alignment nAlign);
+ sdr::glue::GluePoint::Alignment GetMarkedGluePointsAlign(bool bVert) const;
+ void SetMarkedGluePointsAlign(bool bVert, sdr::glue::GluePoint::Alignment nAlign);
bool IsSetMarkedGluePointsAlignPossible() const { return !IsReadOnly() && areGluesSelected(); }
// Alle merkierten Klebepunkte entfernen
@@ -82,11 +81,6 @@ public:
// central GluePoint transformator
void TransformMarkedGluePoints(const basegfx::B2DHomMatrix& rTransformation, const SdrRepeatFunc aRepFunc, bool bCopy = false);
-
- // TTTT:GLUE
- //void MoveMarkedGluePoints(const basegfx::B2DVector& rDelta, bool bCopy = false);
- //void ResizeMarkedGluePoints(const basegfx::B2DPoint& rRef, const basegfx::B2DVector& rScale, bool bCopy = false);
- //void RotateMarkedGluePoints(const basegfx::B2DPoint& rRef, double fAngle, bool bCopy = false);
};
#endif //_SVDGLEV_HXX
diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx
index 47f8e0e11a13..8029fa539f9d 100644
--- a/svx/inc/svx/svdoashp.hxx
+++ b/svx/inc/svx/svdoashp.hxx
@@ -90,11 +90,11 @@ private:
// double fObjectRotation;
protected:
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+ virtual sdr::glue::GluePointProvider* CreateObjectSpecificGluePointProvider();
public:
- virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
-
// to allow sdr::properties::CustomShapeProperties access
friend class sdr::properties::CustomShapeProperties;
@@ -112,9 +112,6 @@ public:
// #i37011# centralize throw-away of render geometry
void InvalidateRenderGeometry();
- // TTTT:GLUE #i38892#
- // void ImpCheckCustomGluePointsAreAdded();
-
// returns the new text range that corresponds to the current logic range. The return value can be empty if nothing changed.
basegfx::B2DRange ImpCalculateTextFrame();
@@ -216,9 +213,6 @@ public:
virtual void SaveGeoData(SdrObjGeoData &rGeo) const;
virtual void RestGeoData(const SdrObjGeoData &rGeo);
- virtual sdr::glue::List* GetGluePointList(bool bForce) const;
- // TTTT:GLUE virtual sdr::glue::List* ForceGluePointList();
-
virtual void AddToHdlList(SdrHdlList& rHdlList) const;
// #i33136#
diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx
index a2f2c7cbf1e1..94877b8256c6 100644
--- a/svx/inc/svx/svdobj.hxx
+++ b/svx/inc/svx/svdobj.hxx
@@ -32,7 +32,6 @@
#include <vcl/timer.hxx>
#include <svx/svdsob.hxx>
#include <svx/svdtypes.hxx>
-#include <svx/sdrglue.hxx>
#include <svx/xdash.hxx>
#include <svx/xpoly.hxx>
#include <svx/xenum.hxx>
@@ -45,6 +44,7 @@
#include <svx/svdpool.hxx>
#include <boost/utility.hpp>
#include <svl/poolitem.hxx>
+#include <svx/gluepoint.hxx>
//////////////////////////////////////////////////////////////////////////////
// predefines
@@ -210,16 +210,16 @@ public:
class SVX_DLLPUBLIC SdrObjGeoData
{
public:
- basegfx::B2DHomMatrix maSdrObjectTransformation;
- basegfx::B2DPoint maObjectAnchor;
- sdr::glue::List* mpGPL;
- SdrLayerID mnLayerID;
+ basegfx::B2DHomMatrix maSdrObjectTransformation;
+ basegfx::B2DPoint maObjectAnchor;
+ sdr::glue::GluePointProvider* mpGluePointProvider;
+ SdrLayerID mnLayerID;
/// bitfield
- bool mbMoveProtect : 1;
- bool mbSizeProtect : 1;
- bool mbNoPrint : 1;
- bool mbVisible : 1;
+ bool mbMoveProtect : 1;
+ bool mbSizeProtect : 1;
+ bool mbNoPrint : 1;
+ bool mbVisible : 1;
public:
SdrObjGeoData();
@@ -232,7 +232,6 @@ class SdrObjPlusData
{
public:
SdrObjUserDataList* mpUserDataList; // applikationsspeziefische Daten
- sdr::glue::List* mpGluePoints; // Klebepunkte zum Ankleben von Objektverbindern
// object name, title and description
String maObjName;
@@ -352,11 +351,11 @@ private:
// on-demand members
sdr::properties::BaseProperties* mpProperties;
sdr::contact::ViewContact* mpViewContact;
- sdr::gluepoint::GluePointProvider* mpGluePointProvider;
+ sdr::glue::GluePointProvider* mpGluePointProvider;
virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
- virtual sdr::gluepoint::GluePointProvider* CreateObjectSpecificGluePointProvider();
+ virtual sdr::glue::GluePointProvider* CreateObjectSpecificGluePointProvider();
/** only for internal use! */
SvxShape* getSvxShape() const;
@@ -480,7 +479,7 @@ public:
// acces to on-demand members
virtual sdr::properties::BaseProperties& GetProperties() const;
sdr::contact::ViewContact& GetViewContact() const;
- sdr::gluepoint::GluePointProvider& GetGluePointProvider() const;
+ sdr::glue::GluePointProvider& GetGluePointProvider() const;
// DrawContact support: Methods for handling Object changes
void ActionChanged() const;
@@ -703,34 +702,6 @@ public:
virtual XubString GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const;
bool IsMacroHit(const SdrObjMacroHitRec& rRec) const { return CheckMacroHit(rRec)!=NULL; }
- // Konnektoren. (siehe auch Dokumentation in SvdoEdge.HXX, SdrEdgeObj
- // sowie SvdGlue.HXX und SvdGlEV.HXX)
- // Es gibt Knoten und Kanten. Eine Kante kann theoretisch auch Knoten
- // sein, das ist jedoch in dieser Version noch nicht implementiert.
- // Ein Knoten hat eine Anzahl von Klebepunkten, wo Kanten angeklebt
- // werden koennen.
- // Eine Kante kann
- // - ohne Verbindungen sein
- // - an einem Ende auf der Wiese stehen und am anderen Ende an
- // genau einem Knoten gebunden sein
- // - an beiden Enden mit jeweils genau einem Knoten verbunden sein.
- // Die Kante ist Listener bei seinen bis zu 2 Knoten.
- // Wird der Knoten verschoben oder Resized, folgen alle angebundenen
- // Kanten. Ebenso bei SetGluePoint()... am Knoten.
- // Beim Verschieben/Resizen der Kante wird dagegen die Verbindung
- // geloesst.
-
- // Automatische Klebepunkte:
- // je 4 Scheitelpunkt- und Eckpositionen muss ein Knotenobjekt liefern
- // i.d.R. 0=oben, 1=rechts, 2=unten, 3=links
- virtual sdr::glue::Point GetVertexGluePoint(sal_uInt32 nNum) const;
-
- // Liste aller Klebepunkte. Kann NULL sein.
- virtual sdr::glue::List* GetGluePointList(bool bForce) const;
-
- // Nach veraendern der GluePointList muss man am Obj SendRepaintBroadcast rufen!
- // TTTT:GLUE virtual sdr::glue::List* ForceGluePointList();
-
/** sets the writing mode of the object's context
Objects which itself do not support different writing modes will ignore this call.
diff --git a/svx/inc/svx/svdoedge.hxx b/svx/inc/svx/svdoedge.hxx
index 49ab65144b50..cb48152544e3 100644
--- a/svx/inc/svx/svdoedge.hxx
+++ b/svx/inc/svx/svdoedge.hxx
@@ -25,7 +25,6 @@
#define _SVDOEDGE_HXX
#include <svx/svdotext.hxx>
-#include <svx/sdrglue.hxx>
#include <svx/svxdllapi.h>
#include <basegfx/polygon/b2dpolygon.hxx>
@@ -49,7 +48,6 @@ private:
friend class SdrCreateView;
protected:
- // TTTT:GLUE basegfx::B2DPoint maObjOfs; // Wird beim Draggen eines Knotens gesetzt
SdrObject* mpConnectedSdrObject; // Referenziertes Objekt
sal_uInt16 mnConnectorId; // Konnektornummer
@@ -63,7 +61,7 @@ public:
SdrObjConnection() { ResetVars(); }
void ResetVars();
- bool TakeGluePoint(sdr::glue::Point& rGP/* TTTT:GLUE, bool bSetAbsolutePos*/) const;
+ bool TakeGluePoint(sdr::glue::GluePoint& rGP) const;
inline void SetBestConnection( bool rB ) { mbBestConnection = rB; };
inline void SetBestVertex( bool rB ) { mbBestVertex = rB; };
@@ -152,8 +150,9 @@ private:
friend class ImpEdgeHdl;
protected:
- virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+ virtual sdr::glue::GluePointProvider* CreateObjectSpecificGluePointProvider();
SdrObjConnection maCon1; // Verbindungszustand des Linienanfangs
SdrObjConnection maCon2; // Verbindungszustand des Linienendes
@@ -212,9 +211,6 @@ public:
SdrObjConnection& GetConnection(bool bTail1) { return *(bTail1 ? &maCon1 : &maCon2); }
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
virtual sal_uInt16 GetObjIdentifier() const;
- virtual sdr::glue::Point GetVertexGluePoint(sal_uInt32 nNum) const;
- virtual sdr::glue::List* GetGluePointList(bool bForce) const;
- // TTTT:GLUE virtual sdr::glue::List* ForceGluePointList();
// bTail1=true: Linienanfang, sonst LinienEnde
// pObj=NULL: Disconnect
diff --git a/svx/inc/svx/svdview.hxx b/svx/inc/svx/svdview.hxx
index a5eeeda41e58..3171967e94a1 100644
--- a/svx/inc/svx/svdview.hxx
+++ b/svx/inc/svx/svdview.hxx
@@ -284,7 +284,6 @@ public:
virtual void onAccessibilityOptionsChanged();
- // TTTT:HANDLE
void MoveHandleByVector(const SdrHdl& rHdl, const basegfx::B2DVector& rDistance, Window* pMakeVisibleWindow, SdrDragMethod* pOwnDragMethod);
};
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index af10385de419..c5dcf45c4a68 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2304,9 +2304,9 @@ void EnhancedCustomShape2d::ApplyGluePoints(SdrObject* pTarget)
if(nCount)
{
- sdr::glue::List* pList = pTarget->GetGluePointList(true);
+ sdr::glue::GluePointProvider& rProvider = pTarget->GetGluePointProvider();
- if(pList)
+ if(rProvider.allowsUserGluePoints())
{
// positions from GetPoint(seqGluePoints) are relative to absolute object size
const basegfx::B2DVector aObjectScale(
@@ -2318,36 +2318,21 @@ void EnhancedCustomShape2d::ApplyGluePoints(SdrObject* pTarget)
for(sal_uInt32 a(0); a < nCount; a++)
{
const basegfx::B2DPoint aPosition(GetPoint(seqGluePoints[a], sal_True, sal_True));
- const sdr::glue::Point aNew(
+
+ // caution: These custom-defined GluePoints are *not* UserDefined, set to false
+ sdr::glue::GluePoint aNew(
aPosition * aScaleToUnit,
- sdr::glue::Point::ESCAPE_DIRECTION_SMART,
- sdr::glue::Point::Alignment_Minimum,
- sdr::glue::Point::Alignment_Minimum);
+ sdr::glue::GluePoint::ESCAPE_DIRECTION_SMART,
+ sdr::glue::GluePoint::Alignment_Minimum,
+ sdr::glue::GluePoint::Alignment_Minimum,
+ true, // Relative
+ false); // UserDefined
- pList->add(aNew);
+ rProvider.addUserGluePoint(aNew);
}
}
}
}
-
- // TTTT:GLUE
- //if ( pObj && seqGluePoints.getLength() )
- //{
- // sal_uInt32 i, nCount = seqGluePoints.getLength();
- // for ( i = 0; i < nCount; i++ )
- // {
- // sdr::glue::Point aGluePoint;
- //
- // aGluePoint.SetPos( GetPoint( seqGluePoints[ i ], sal_True, sal_True ) );
- // aGluePoint.SetPercent( sal_False );
- //
- // aGluePoint.SetAlign( SDRVERTALIGN_TOP | SDRHORZALIGN_LEFT );
- // aGluePoint.setEscapeDirections( sdr::glue::Point::ESCAPE_DIRECTION_SMART );
- // sdr::glue::List* pList = pObj->GetGluePointList(true);
- // if( pList )
- // /* sal_uInt16 nId = */ pList->Insert( aGluePoint );
- // }
- //}
}
SdrObject* EnhancedCustomShape2d::CreateLineGeometry()
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
index d94d77c07dd9..a532d0ba5a4b 100644
--- a/svx/source/dialog/graphctl.cxx
+++ b/svx/source/dialog/graphctl.cxx
@@ -602,39 +602,6 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
{
// move handle with index nHandleIndex
pView->MoveHandleByVector(*pHdl, aMove, 0, 0);
-
- // TTTT:HANDLE
- //if(pHdl && !aMove.equalZero())
- //{
- // // now move the Handle
- // const basegfx::B2DPoint aStartPoint(pHdl->getPosition());
- // const basegfx::B2DPoint aEndPoint(aStartPoint + aMove);
- // const SdrDragStat& rDragStat = pView->GetDragStat();
- //
- // // start dragging
- // pView->BegDragObj(aStartPoint, pHdl, 0.0);
- //
- // if(pView->IsDragObj())
- // {
- // const bool bWasNoSnap(rDragStat.IsNoSnap());
- // const bool bWasSnapEnabled(pView->IsSnapEnabled());
- //
- // // switch snapping off
- // if(!bWasNoSnap)
- // ((SdrDragStat&)rDragStat).SetNoSnap(true);
- // if(bWasSnapEnabled)
- // pView->SetSnapEnabled(false);
- //
- // pView->MovAction(aEndPoint);
- // pView->EndDragObj();
- //
- // // restore snap
- // if(!bWasNoSnap)
- // ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
- // if(bWasSnapEnabled)
- // pView->SetSnapEnabled(bWasSnapEnabled);
- // }
- //}
}
bProc = true;
diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
index 03751e16adf4..bb55dd2fbbc5 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
@@ -154,23 +154,22 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrObj::createGluePointPrimitive2DSequence() const
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
- const sdr::glue::List* pGluePointList = GetSdrObject().GetGluePointList(false);
+ const sdr::glue::GluePointProvider& rProvider = GetSdrObject().GetGluePointProvider();
- if(pGluePointList)
+ if(rProvider.hasUserGluePoints())
{
- const sdr::glue::PointVector aGluePoints(pGluePointList->getVector());
+ const sdr::glue::GluePointVector aGluePoints(rProvider.getUserGluePointVector());
const sal_uInt32 nCount(aGluePoints.size());
if(nCount)
{
- // TTTT:GLUE
// prepare primitives; positions are in unit coordinates
const basegfx::B2DHomMatrix& rTransformation = GetSdrObject().getSdrObjectTransformation();
std::vector< basegfx::B2DPoint > aPointVector;
for(sal_uInt32 a(0); a < nCount; a++)
{
- const sdr::glue::Point* pCandidate = aGluePoints[a];
+ const sdr::glue::GluePoint* pCandidate = aGluePoints[a];
if(pCandidate)
{
@@ -178,7 +177,7 @@ namespace sdr
}
else
{
- OSL_ENSURE(false, "sdr::glue::PointVector with empty entries (!)");
+ OSL_ENSURE(false, "sdr::glue::GluePointVector with empty entries (!)");
}
}
diff --git a/svx/source/svdraw/gluepoint.cxx b/svx/source/svdraw/gluepoint.cxx
index 60bd01d9171f..c69613eb1aef 100644
--- a/svx/source/svdraw/gluepoint.cxx
+++ b/svx/source/svdraw/gluepoint.cxx
@@ -21,13 +21,447 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
+
#include <svx/gluepoint.hxx>
+#include <basegfx/range/b2drange.hxx>
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace sdr
{
- namespace gluepoint
+ namespace glue
+ {
+ GluePoint::GluePoint(
+ const basegfx::B2DPoint& rUnitPosition,
+ sal_uInt16 eEscapeDirections,
+ Alignment eHorizontalAlignment,
+ Alignment eVerticalAlignment,
+ bool bRelative,
+ bool bUserDefined)
+ : maUnitPosition(basegfx::B2DRange::getUnitB2DRange().clamp(rUnitPosition)),
+ meEscapeDirections(eEscapeDirections),
+ meHorizontalAlignment(eHorizontalAlignment),
+ meVerticalAlignment(eVerticalAlignment),
+ maID(0),
+ mbRelative(bRelative),
+ mbUserDefined(bUserDefined)
+ {
+ }
+
+ basegfx::B2DPoint GluePoint::getUnitPosition() const
+ {
+ return basegfx::B2DRange::getUnitB2DRange().clamp(maUnitPosition);
+ }
+
+ void GluePoint::setUnitPosition(const basegfx::B2DPoint& rNew)
+ {
+ const basegfx::B2DPoint aClampedNew(basegfx::B2DRange::getUnitB2DRange().clamp(rNew));
+
+ if(aClampedNew != maUnitPosition)
+ {
+ maUnitPosition = aClampedNew;
+ }
+ }
+
+ void GluePoint::setRelative(bool bNew)
+ {
+ if(mbRelative != bNew)
+ {
+ mbRelative = bNew;
+
+ if(mbRelative)
+ {
+ // truncate UnitPosition when switching off; the non-relative mode allows
+ // values outside the UnitRange to represent positions moving outside the
+ // range
+ maUnitPosition = basegfx::B2DRange::getUnitB2DRange().clamp(maUnitPosition);
+ }
+ }
+ }
+
+ void GluePoint::adaptToChangedScale(const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale)
+ {
+ if(!getRelative())
+ {
+ const bool bChangeX(!basegfx::fTools::equal(rOldScale.getX(), rNewScale.getX()));
+ const bool bChangeY(!basegfx::fTools::equal(rOldScale.getY(), rNewScale.getY()));
+
+ if(bChangeX || bChangeY)
+ {
+ // do not use getUnitPosition() here, we do not want to clamp the value
+ basegfx::B2DPoint aChangedPos(maUnitPosition);
+
+ if(bChangeX)
+ {
+ // avoid using values below 1.0 when working with relative scales; thus even the
+ // values outside the unit range will be preserved
+ const double fCorrectedOldX(std::max(1.0, rOldScale.getX()));
+ const double fCorrectedNewX(std::max(1.0, rNewScale.getX()));
+
+ switch(getHorizontalAlignment())
+ {
+ case GluePoint::Alignment_Minimum:
+ {
+ // anchored left
+ aChangedPos.setX((aChangedPos.getX() * fCorrectedOldX) / fCorrectedNewX);
+ break;
+ }
+ case GluePoint::Alignment_Center:
+ {
+ aChangedPos.setX(((0.5 * fCorrectedNewX) + (fCorrectedOldX * (aChangedPos.getX() - 0.5))) / fCorrectedNewX);
+ break;
+ }
+ default: // case GluePoint::Alignment_Maximum:
+ {
+ aChangedPos.setX((fCorrectedNewX - (fCorrectedOldX * (1.0 - aChangedPos.getX()))) / fCorrectedNewX);
+ break;
+ }
+ }
+ }
+
+ if(bChangeY)
+ {
+ // avoid using values below 1.0 when working with relative scales; thus even the
+ // values outside the unit range will be preserved
+ const double fCorrectedOldY(std::max(1.0, rOldScale.getY()));
+ const double fCorrectedNewY(std::max(1.0, rNewScale.getY()));
+
+ switch(getVerticalAlignment())
+ {
+ case GluePoint::Alignment_Minimum:
+ {
+ // anchored left
+ aChangedPos.setY((aChangedPos.getY() * fCorrectedOldY) / fCorrectedNewY);
+ break;
+ }
+ case GluePoint::Alignment_Center:
+ {
+ aChangedPos.setY(((0.5 * fCorrectedNewY) + (fCorrectedOldY * (aChangedPos.getY() - 0.5))) / fCorrectedNewY);
+ break;
+ }
+ default: // case GluePoint::Alignment_Maximum:
+ {
+ aChangedPos.setY((fCorrectedNewY - (fCorrectedOldY * (1.0 - aChangedPos.getY()))) / fCorrectedNewY);
+ break;
+ }
+ }
+ }
+
+ if(!aChangedPos.equal(maUnitPosition))
+ {
+ // do not use setUnitPosition() here, we do not want to clamp the value
+ maUnitPosition = aChangedPos;
+ }
+ }
+ }
+ }
+
+ com::sun::star::drawing::GluePoint2 GluePoint::convertToGluePoint2(const basegfx::B2DVector& rAbsoluteScale) const
+ {
+ com::sun::star::drawing::GluePoint2 aRetval;
+
+ // copy UserDefined
+ aRetval.IsUserDefined = getUserDefined();
+
+ // copy relative
+ aRetval.IsRelative = getRelative();
+
+ // copy position; get maUnitPosition directly, we do not want to crop here
+ double fX(maUnitPosition.getX());
+ double fY(maUnitPosition.getY());
+
+ switch(getHorizontalAlignment())
+ {
+ case Alignment_Minimum: break;
+ case Alignment_Center: fX = fX - 0.5; break;
+ case Alignment_Maximum: fX = fX - 1.0; break;
+ }
+
+ switch(getVerticalAlignment())
+ {
+ case Alignment_Minimum: break;
+ case Alignment_Center: fY = fY - 0.5; break;
+ case Alignment_Maximum: fY = fY - 1.0; break;
+ }
+
+ if(aRetval.IsRelative)
+ {
+ fX *= 10000.0;
+ fY *= 10000.0;
+ }
+ else
+ {
+ // avoid values below 1.0 to not lose relative values outside object scale
+ fX *= std::max(1.0, rAbsoluteScale.getX());
+ fY *= std::max(1.0, rAbsoluteScale.getY());
+ }
+
+ aRetval.Position.X = basegfx::fround(fX);
+ aRetval.Position.Y = basegfx::fround(fY);
+
+ // copy alignment
+ switch(getHorizontalAlignment())
+ {
+ case Alignment_Minimum:
+ switch(getVerticalAlignment())
+ {
+ case Alignment_Minimum:
+ aRetval.PositionAlignment = com::sun::star::drawing::Alignment_TOP_LEFT;
+ break;
+ case Alignment_Maximum:
+ aRetval.PositionAlignment = com::sun::star::drawing::Alignment_BOTTOM_LEFT;
+ break;
+ default:
+ case Alignment_Center:
+ aRetval.PositionAlignment = com::sun::star::drawing::Alignment_LEFT;
+ break;
+ }
+ break;
+ case Alignment_Maximum:
+ switch(getVerticalAlignment())
+ {
+ case Alignment_Minimum:
+ aRetval.PositionAlignment = com::sun::star::drawing::Alignment_TOP_RIGHT;
+ break;
+ case Alignment_Maximum:
+ aRetval.PositionAlignment = com::sun::star::drawing::Alignment_BOTTOM_RIGHT;
+ break;
+ default:
+ case Alignment_Center:
+ aRetval.PositionAlignment = com::sun::star::drawing::Alignment_RIGHT;
+ break;
+ }
+ break;
+ default:
+ case Alignment_Center:
+ switch(getVerticalAlignment())
+ {
+ case Alignment_Minimum:
+ aRetval.PositionAlignment = com::sun::star::drawing::Alignment_TOP;
+ break;
+ case Alignment_Maximum:
+ aRetval.PositionAlignment = com::sun::star::drawing::Alignment_BOTTOM;
+ break;
+ default:
+ case Alignment_Center:
+ aRetval.PositionAlignment = com::sun::star::drawing::Alignment_CENTER;
+ break;
+ }
+ break;
+ }
+
+ // copy escape directions
+ switch( getEscapeDirections() )
+ {
+ case ESCAPE_DIRECTION_LEFT:
+ aRetval.Escape = com::sun::star::drawing::EscapeDirection_LEFT;
+ break;
+ case ESCAPE_DIRECTION_RIGHT:
+ aRetval.Escape = com::sun::star::drawing::EscapeDirection_RIGHT;
+ break;
+ case ESCAPE_DIRECTION_TOP:
+ aRetval.Escape = com::sun::star::drawing::EscapeDirection_UP;
+ break;
+ case ESCAPE_DIRECTION_BOTTOM:
+ aRetval.Escape = com::sun::star::drawing::EscapeDirection_DOWN;
+ break;
+ case ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_RIGHT:
+ aRetval.Escape = com::sun::star::drawing::EscapeDirection_HORIZONTAL;
+ break;
+ case ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_BOTTOM:
+ aRetval.Escape = com::sun::star::drawing::EscapeDirection_VERTICAL;
+ break;
+
+ // Unfortunately the enum EscapeDirection in the EscapeDirection.idl definition
+ // is wrong in the sense that it does not reflect the possibility to define a free
+ // combination of the directions left/right/up/down from which the router may choose
+ // the best. Below (and in the idl file) are suggestions how this could be expanded,
+ // but it would be incompatible
+ //
+ //case ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_TOP:
+ // aRetval.Escape = com::sun::star::drawing::EscapeDirection_LEFTUP;
+ // break;
+ //case ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_RIGHT:
+ // aRetval.Escape = com::sun::star::drawing::EscapeDirection_UPRIGHT;
+ // break;
+ //case ESCAPE_DIRECTION_RIGHT|ESCAPE_DIRECTION_BOTTOM:
+ // aRetval.Escape = com::sun::star::drawing::EscapeDirection_RIGHTDOWN;
+ // break;
+ //case ESCAPE_DIRECTION_BOTTOM|ESCAPE_DIRECTION_LEFT:
+ // aRetval.Escape = com::sun::star::drawing::EscapeDirection_DOWNLEFT;
+ // break;
+ //case ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_RIGHT:
+ // aRetval.Escape = com::sun::star::drawing::EscapeDirection_UPWARD;
+ // break;
+ //case ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_RIGHT|ESCAPE_DIRECTION_DOWN:
+ // aRetval.Escape = com::sun::star::drawing::EscapeDirection_RIGHTWARD;
+ // break;
+ //case ESCAPE_DIRECTION_RIGHT|ESCAPE_DIRECTION_DOWN|ESCAPE_DIRECTION_LEFT:
+ // aRetval.Escape = com::sun::star::drawing::EscapeDirection_DOWNWARD;
+ // break;
+ //case ESCAPE_DIRECTION_DOWN|ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_UP:
+ // aRetval.Escape = com::sun::star::drawing::EscapeDirection_LEFTWARD;
+ // break;
+ default:
+ case ESCAPE_DIRECTION_SMART:
+ aRetval.Escape = com::sun::star::drawing::EscapeDirection_SMART;
+ break;
+ }
+
+ return aRetval;
+ }
+
+ GluePoint::GluePoint(
+ const com::sun::star::drawing::GluePoint2& rGluePoint2,
+ const basegfx::B2DVector& rAbsoluteScale)
+ : maUnitPosition(0.5, 0.5),
+ meEscapeDirections(ESCAPE_DIRECTION_SMART),
+ meHorizontalAlignment(Alignment_Center),
+ meVerticalAlignment(Alignment_Center),
+ maID(0),
+ mbRelative(rGluePoint2.IsRelative), // copy relative
+ mbUserDefined(rGluePoint2.IsUserDefined) // copy UserDefined
+ {
+ // copy alignment
+ switch( rGluePoint2.PositionAlignment )
+ {
+ case com::sun::star::drawing::Alignment_TOP_LEFT:
+ meHorizontalAlignment = Alignment_Minimum;
+ meVerticalAlignment = Alignment_Minimum;
+ break;
+ case com::sun::star::drawing::Alignment_TOP:
+ meHorizontalAlignment = Alignment_Center;
+ meVerticalAlignment = Alignment_Minimum;
+ break;
+ case com::sun::star::drawing::Alignment_TOP_RIGHT:
+ meHorizontalAlignment = Alignment_Maximum;
+ meVerticalAlignment = Alignment_Minimum;
+ break;
+ case com::sun::star::drawing::Alignment_RIGHT:
+ meHorizontalAlignment = Alignment_Maximum;
+ meVerticalAlignment = Alignment_Center;
+ break;
+ case com::sun::star::drawing::Alignment_BOTTOM_LEFT:
+ meHorizontalAlignment = Alignment_Minimum;
+ meVerticalAlignment = Alignment_Maximum;
+ break;
+ case com::sun::star::drawing::Alignment_BOTTOM:
+ meHorizontalAlignment = Alignment_Center;
+ meVerticalAlignment = Alignment_Maximum;
+ break;
+ case com::sun::star::drawing::Alignment_BOTTOM_RIGHT:
+ meHorizontalAlignment = Alignment_Maximum;
+ meVerticalAlignment = Alignment_Maximum;
+ break;
+ case com::sun::star::drawing::Alignment_LEFT:
+ meHorizontalAlignment = Alignment_Minimum;
+ meVerticalAlignment = Alignment_Center;
+ break;
+ default:
+ case com::sun::star::drawing::Alignment_CENTER:
+ meHorizontalAlignment = Alignment_Center;
+ meVerticalAlignment = Alignment_Center;
+ break;
+ }
+
+ // copy position (after alignment is computed)
+ double fX(rGluePoint2.Position.X);
+ double fY(rGluePoint2.Position.Y);
+
+ if(mbRelative)
+ {
+ fX /= 10000.0;
+ fY /= 10000.0;
+ }
+ else
+ {
+ // avoid values below 1.0 to not lose relative values outside object scale
+ fX /= std::max(1.0, rAbsoluteScale.getX());
+ fY /= std::max(1.0, rAbsoluteScale.getY());
+ }
+
+ switch(meHorizontalAlignment)
+ {
+ case Alignment_Minimum: break;
+ case Alignment_Center: fX = fX + 0.5; break;
+ case Alignment_Maximum: fX = fX + 1.0; break;
+ }
+
+ switch(meVerticalAlignment)
+ {
+ case Alignment_Minimum: break;
+ case Alignment_Center: fY = fY + 0.5; break;
+ case Alignment_Maximum: fY = fY + 1.0; break;
+ }
+
+ maUnitPosition = basegfx::B2DPoint(fX, fY);
+
+ // copy escape directions
+ switch( rGluePoint2.Escape )
+ {
+ case com::sun::star::drawing::EscapeDirection_LEFT:
+ meEscapeDirections = ESCAPE_DIRECTION_LEFT;
+ break;
+ case com::sun::star::drawing::EscapeDirection_RIGHT:
+ meEscapeDirections = ESCAPE_DIRECTION_RIGHT;
+ break;
+ case com::sun::star::drawing::EscapeDirection_UP:
+ meEscapeDirections = ESCAPE_DIRECTION_TOP;
+ break;
+ case com::sun::star::drawing::EscapeDirection_DOWN:
+ meEscapeDirections = ESCAPE_DIRECTION_BOTTOM;
+ break;
+ case com::sun::star::drawing::EscapeDirection_HORIZONTAL:
+ meEscapeDirections = ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_RIGHT;
+ break;
+ case com::sun::star::drawing::EscapeDirection_VERTICAL:
+ meEscapeDirections = ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_BOTTOM;
+ break;
+
+ // Unfortunately the enum EscapeDirection in the EscapeDirection.idl definition
+ // is wrong in the sense that it does not reflect the possibility to define a free
+ // combination of the directions left/right/up/down from which the router may choose
+ // the best. Below (and in the idl file) are suggestions how this could be expanded,
+ // but it would be incompatible
+ //
+ //case com::sun::star::drawing::EscapeDirection_LEFTUP:
+ // meEscapeDirections = ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_TOP;
+ // break;
+ //case com::sun::star::drawing::EscapeDirection_UPRIGHT:
+ // meEscapeDirections = ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_RIGHT;
+ // break;
+ //case com::sun::star::drawing::EscapeDirection_RIGHTDOWN:
+ // meEscapeDirections = ESCAPE_DIRECTION_RIGHT|ESCAPE_DIRECTION_BOTTOM;
+ // break;
+ //case com::sun::star::drawing::EscapeDirection_DOWNLEFT:
+ // meEscapeDirections = ESCAPE_DIRECTION_BOTTOM|ESCAPE_DIRECTION_LEFT;
+ // break;
+ //case com::sun::star::drawing::EscapeDirection_UPWARD:
+ // meEscapeDirections = ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_RIGHT;
+ // break;
+ //case com::sun::star::drawing::EscapeDirection_RIGHTWARD:
+ // meEscapeDirections = ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_RIGHT|ESCAPE_DIRECTION_BOTTOM;
+ // break;
+ //case com::sun::star::drawing::EscapeDirection_DOWNWARD:
+ // meEscapeDirections = ESCAPE_DIRECTION_RIGHT|ESCAPE_DIRECTION_BOTTOM|ESCAPE_DIRECTION_LEFT;
+ // break;
+ //case com::sun::star::drawing::EscapeDirection_LEFTWARD:
+ // meEscapeDirections = ESCAPE_DIRECTION_BOTTOM|ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_TOP;
+ // break;
+ case com::sun::star::drawing::EscapeDirection_SMART:
+ default:
+ meEscapeDirections = ESCAPE_DIRECTION_SMART;
+ break;
+ }
+ }
+ } // end of namespace glue
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace glue
{
GluePointProvider::GluePointProvider()
{
@@ -46,9 +480,9 @@ namespace sdr
return *this;
}
- GluePointProvider& GluePointProvider::Clone() const
+ GluePointProvider* GluePointProvider::Clone() const
{
- return *(new GluePointProvider(*this));
+ return new GluePointProvider(*this);
}
sal_uInt32 GluePointProvider::getAutoGluePointCount() const
@@ -58,117 +492,232 @@ namespace sdr
GluePoint GluePointProvider::getAutoGluePointByIndex(sal_uInt32 nIndex) const
{
+ // no error with indices, just repeatedly return last GluePoint as fallback
+ basegfx::B2DPoint aGluePosition(0.5, 0.5);
+
switch(nIndex)
{
- case 0:
+ case 0: // TopCenter
{
- return GluePoint(
- basegfx::B2DPoint(0.5, 0.0),
- nIndex,
- GLUEPOINTTYPE_AUTO);
+ aGluePosition.setY(0.0);
+ break;
}
- case 1:
+ case 1: // RightCenter
{
- return GluePoint(
- basegfx::B2DPoint(1.0, 0.5),
- nIndex,
- GLUEPOINTTYPE_AUTO);
+ aGluePosition.setX(1.0);
+ break;
}
- case 2:
+ case 2: // BottomCenter
{
- return GluePoint(
- basegfx::B2DPoint(0.5, 1.0),
- nIndex,
- GLUEPOINTTYPE_AUTO);
+ aGluePosition.setY(1.0);
+ break;
}
- default:
+ default: // case 3: // LeftCenter
{
- return GluePoint(
- basegfx::B2DPoint(0.0, 0.5),
- nIndex,
- GLUEPOINTTYPE_AUTO);
+ aGluePosition.setX(0.0);
+ break;
}
}
+
+ // create GluePoint, need to set UserDefined to false for these default GluePoints
+ return GluePoint(
+ aGluePosition,
+ GluePoint::ESCAPE_DIRECTION_SMART,
+ GluePoint::Alignment_Center,
+ GluePoint::Alignment_Center,
+ true, // mbRelative
+ false); // mbUserDefined
}
- sal_uInt32 GluePointProvider::getEdgeGluePointCount() const
+ bool GluePointProvider::allowsUserGluePoints() const
{
- return 0;
+ return false;
}
- GluePoint GluePointProvider::getEdgeGluePointByIndex(sal_uInt32 /*nIndex*/) const
+ GluePoint& GluePointProvider::addUserGluePoint(GluePoint& rNew)
{
- OSL_ENSURE(false, "access out of range (!)");
- return GluePoint();
+ OSL_ENSURE(false, "Default GluePointProvider does not support UserGluePoints (!)");
+ return rNew;
}
- sal_uInt32 GluePointProvider::getUserGluePointCount() const
+ void GluePointProvider::removeUserGluePoint(const GluePoint& /*rNew*/)
{
+ OSL_ENSURE(false, "Default GluePointProvider does not support UserGluePoints (!)");
+ }
+
+ bool GluePointProvider::hasUserGluePoints() const
+ {
+ return false;
+ }
+
+ GluePoint* GluePointProvider::findUserGluePointByID(sal_uInt32 /*nID*/) const
+ {
+ OSL_ENSURE(false, "Default GluePointProvider does not support UserGluePoints (!)");
return 0;
}
- GluePoint GluePointProvider::getUserGluePointByIndex(sal_uInt32 /*nIndex*/) const
+ const GluePointVector GluePointProvider::getUserGluePointVector() const
+ {
+ // return empty vector; no need to assert, this may by default be used to check
+ // sizes; it is better to use hasUserGluePoints first, but not required
+ return GluePointVector();
+ }
+
+ void GluePointProvider::adaptUserGluePointsToChangedScale(const basegfx::B2DVector& /*rOldScale*/, const basegfx::B2DVector& /*rNewScale*/)
+ {
+ OSL_ENSURE(false, "Default GluePointProvider does not support UserGluePoints (!)");
+ }
+
+ } // end of namespace glue
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace glue
+ {
+ bool GluePointComparator::operator()(const GluePoint& rA, const GluePoint& rB) const
+ {
+ // sort by ID
+ return rA.getID() < rB.getID();
+ }
+
+ StandardGluePointProvider::StandardGluePointProvider()
+ : GluePointProvider(),
+ maGluePointSet()
+ {
+ }
+
+ StandardGluePointProvider::~StandardGluePointProvider()
{
- OSL_ENSURE(false, "access out of range (!)");
- return GluePoint();
}
- sal_uInt32 GluePointProvider::getGluePointCount() const
+ StandardGluePointProvider::StandardGluePointProvider(const StandardGluePointProvider& rCandidate)
+ : GluePointProvider(),
+ maGluePointSet(rCandidate.maGluePointSet)
{
- return getAutoGluePointCount() + getEdgeGluePointCount() + getUserGluePointCount();
}
- GluePoint GluePointProvider::getGluePointByIndex(sal_uInt32 nIndex) const
+ GluePointProvider& StandardGluePointProvider::operator=(const GluePointProvider& rCandidate)
{
- if(nIndex < getAutoGluePointCount())
+ // call parent to copy UserGluePoints
+ GluePointProvider::operator=(rCandidate);
+
+ const StandardGluePointProvider* pSource = dynamic_cast< const StandardGluePointProvider* >(&rCandidate);
+
+ if(pSource)
{
- return getAutoGluePointByIndex(nIndex);
+ maGluePointSet = pSource->maGluePointSet;
}
- nIndex -= getAutoGluePointCount();
+ return *this;
+ }
+
+ GluePointProvider* StandardGluePointProvider::Clone() const
+ {
+ return new StandardGluePointProvider(*this);
+ }
+
+ bool StandardGluePointProvider::allowsUserGluePoints() const
+ {
+ return true;
+ }
- if(nIndex < getEdgeGluePointCount())
+ GluePoint& StandardGluePointProvider::addUserGluePoint(GluePoint& rNew)
+ {
+ OSL_ENSURE(0 == rNew.getID(), "Someone is adding a new GluePoint which already has an ID");
+
+ if(!maGluePointSet.size())
{
- return getEdgeGluePointByIndex(nIndex);
+ // first GluePoint ever, add at start position with ID null
+ setIdAtGluePoint(rNew, 0);
+ maGluePointSet.insert(rNew);
+ return *maGluePointSet.begin();
}
- nIndex -= getEdgeGluePointCount();
+ // get last GluePoint; take it's ID as current maximum ID (since it's a
+ // set sorted by ID) as base for the new ID
+ GluePointSet::iterator aFound(maGluePointSet.end());
+ aFound--;
+
+ // set ID and insert
+ setIdAtGluePoint(rNew, aFound->getID() + 1);
+ maGluePointSet.insert(rNew);
- if(nIndex < getUserGluePointCount())
+ // get from end (no find needed, we know we just added it with lastID + 1)
+ aFound = maGluePointSet.end();
+ aFound--;
+
+ return *aFound;
+ }
+
+ void StandardGluePointProvider::removeUserGluePoint(const GluePoint& rNew)
+ {
+ const GluePointSet::const_iterator aFound(maGluePointSet.find(rNew));
+
+ if(aFound == maGluePointSet.end())
{
- return getUserGluePointByIndex(nIndex);
+ // not a member
+ OSL_ENSURE(false, "GluePoint for removal not found (!)");
+ return;
}
- OSL_ENSURE(false, "access out of range (!)");
- return GluePoint();
+ maGluePointSet.erase(aFound);
}
- bool GluePointProvider::areUserGluePointsAllowed() const
+ bool StandardGluePointProvider::hasUserGluePoints() const
{
- return false;
+ return !maGluePointSet.empty();
}
- GluePoint GluePointProvider::addUserGluePoint(
- const basegfx::B2DPoint& /*rPosition*/,
- GluePointType /*eType*/,
- com::sun::star::drawing::Alignment /*eAlignment*/,
- com::sun::star::drawing::EscapeDirection /*eEscapeDirection*/)
+ GluePoint* StandardGluePointProvider::findUserGluePointByID(sal_uInt32 nID) const
{
- OSL_ENSURE(false, "No UserGluePoints allowed at this object (!)");
- return GluePoint();
+ // prepare GluePoint to search for
+ GluePoint aGluePoint;
+ const_cast< StandardGluePointProvider* >(this)->setIdAtGluePoint(aGluePoint, nID);
+
+ const GluePointSet::const_iterator aFound(maGluePointSet.find(aGluePoint));
+
+ if(aFound == maGluePointSet.end())
+ {
+ return 0;
+ }
+
+ const GluePoint& rResult = *aFound;
+
+ return &const_cast< GluePoint& >(rResult);
}
- void GluePointProvider::removeUserGluePoint(const GluePoint& /*rCandidate*/)
+ const GluePointVector StandardGluePointProvider::getUserGluePointVector() const
{
- OSL_ENSURE(false, "No UserGluePoints allowed at this object (!)");
+ // prepare retval; we know the number of entries
+ GluePointVector aRetval;
+ aRetval.reserve(maGluePointSet.size());
+
+ // need to loop here; the vector contains pointers to real instances, not the
+ // instances themselves
+ for(GluePointSet::const_iterator aFound(maGluePointSet.begin()); aFound != maGluePointSet.end(); aFound++)
+ {
+ aRetval.push_back(&const_cast< GluePoint& >(*aFound));
+ }
+
+ return aRetval;
}
- bool GluePointProvider::existsUserGluePoint(const GluePoint& /*rCandidate*/) const
+ void StandardGluePointProvider::adaptUserGluePointsToChangedScale(const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale)
{
- return false;
+ // if scale changed, adapt all registered GluePoints
+ if(!rOldScale.equal(rNewScale))
+ {
+ for(GluePointSet::iterator aFound(maGluePointSet.begin()); aFound != maGluePointSet.end(); aFound++)
+ {
+ adaptGluePointToChangedScale(*aFound, rOldScale, rNewScale);
+ }
+ }
}
- } // end of namespace gluepoint
+ } // end of namespace glue
} // end of namespace sdr
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/svx/source/svdraw/sdrselection.cxx b/svx/source/svdraw/sdrselection.cxx
index 380e92310072..816195e5af60 100644
--- a/svx/source/svdraw/sdrselection.cxx
+++ b/svx/source/svdraw/sdrselection.cxx
@@ -110,12 +110,12 @@ namespace sdr
OSL_ENSURE(pCandidate, "Missing SdrObject pointer in glue selection(!)");
bool bErase(false);
IndicesMap::iterator aNext(aIndices);
- const sdr::glue::List* pGPL = pCandidate->GetGluePointList(false);
+ const sdr::glue::GluePointProvider& rProvider = pCandidate->GetGluePointProvider();
aNext++;
// for each SdrObject check if it has GluePoints at all
- if(pGPL)
+ if(rProvider.hasUserGluePoints())
{
Indices aCurrent = aIndices->second;
Indices aNewList;
@@ -124,7 +124,7 @@ namespace sdr
// it over to a new list. Thus, all no longer existing GluePoints will be erased
for(Indices::const_iterator aIter(aCurrent.begin()); aIter != aCurrent.end(); aIter++)
{
- if(pGPL->findByID(*aIter))
+ if(rProvider.findUserGluePointByID(*aIter))
{
aNewList.insert(aNewList.end(), *aIter);
}
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
index 27400e1373d7..e5cf5e3b8552 100644
--- a/svx/source/svdraw/svdcrtv.cxx
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -88,11 +88,12 @@ ImplConnectMarkerOverlay::ImplConnectMarkerOverlay(const SdrCreateView& rView, S
pTargetOverlay->add(*pNew);
maObjects.append(*pNew);
- // TTTT:GLUE
// gluepoints
- for(sal_uInt32 i(0); i < 4; i++)
+ const sdr::glue::GluePointProvider& rProvider = rObject.GetGluePointProvider();
+
+ for(sal_uInt32 i(0); i < rProvider.getAutoGluePointCount(); i++)
{
- const sdr::glue::Point aGluePoint(rObject.GetVertexGluePoint(i));
+ const sdr::glue::GluePoint aGluePoint(rProvider.getAutoGluePointByIndex(i));
const basegfx::B2DPoint aPosition(rObject.getSdrObjectTransformation() * aGluePoint.getUnitPosition());
const basegfx::B2DRange aBigRange(aPosition - aHalfLogicSize, aPosition + aHalfLogicSize);
const basegfx::B2DPolygon aTempPoly(basegfx::tools::createPolygonFromRect(aBigRange));
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 05d50e341971..09f8062789fc 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -539,16 +539,15 @@ void SdrDragMethod::createSdrDragEntries_GlueDrag()
if(aMarkedGluePoints.size())
{
- // TTTT:GLUE
- const sdr::glue::List* pGPL = pSdrObjCandidate->GetGluePointList(false);
+ const sdr::glue::GluePointProvider& rProvider = pSdrObjCandidate->GetGluePointProvider();
- if(pGPL)
+ if(rProvider.hasUserGluePoints())
{
for(sdr::selection::Indices::const_iterator aCurrent(aMarkedGluePoints.begin());
aCurrent != aMarkedGluePoints.end(); aCurrent++)
{
const sal_uInt32 nObjPt(*aCurrent);
- const sdr::glue::Point* pCandidate = pGPL->findByID(nObjPt);
+ const sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nObjPt);
if(pCandidate)
{
@@ -1700,9 +1699,9 @@ void SdrDragMove::MoveSdrDrag(const basegfx::B2DPoint& rPoint)
if(rMarkedGluePoints.size())
{
- const sdr::glue::List* pGPL = pObj->GetGluePointList(false);
+ const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
- if(pGPL)
+ if(rProvider.hasUserGluePoints())
{
// the SdrObject candidate with potentially moved GluePoints is identified. GetObjectMatrix,
// but take care for objects with zero width/height. Also prepare inverse transformation
@@ -1714,7 +1713,7 @@ void SdrDragMove::MoveSdrDrag(const basegfx::B2DPoint& rPoint)
for(sdr::selection::Indices::const_iterator aCurrent(rMarkedGluePoints.begin()); aCurrent != rMarkedGluePoints.end(); aCurrent++)
{
const sal_uInt32 nId(*aCurrent);
- const sdr::glue::Point* pGlueCandidate = pGPL->findByID(nId);
+ const sdr::glue::GluePoint* pGlueCandidate = rProvider.findUserGluePointByID(nId);
if(pGlueCandidate)
{
@@ -1793,7 +1792,6 @@ bool SdrDragMove::EndSdrDrag(bool bCopy)
basegfx::tools::createTranslateB2DHomMatrix(DragStat().GetNow() - DragStat().GetPrev()),
SDRREPFUNC_OBJ_MOVE,
bCopy);
- // TTTT:GLUE getSdrView().MoveMarkedGluePoints(DragStat().GetNow() - DragStat().GetPrev(), bCopy);
}
else
{
@@ -2098,7 +2096,6 @@ bool SdrDragResize::EndSdrDrag(bool bCopy)
aTransform,
SDRREPFUNC_OBJ_MOVE,
bCopy);
- // TTTT:GLUE getSdrView().ResizeMarkedGluePoints(DragStat().GetRef1(), maScale, bCopy);
}
else
{
@@ -2228,7 +2225,6 @@ bool SdrDragRotate::EndSdrDrag(bool bCopy)
basegfx::tools::createRotateAroundPoint(DragStat().GetRef1(), mfDeltaRotation),
SDRREPFUNC_OBJ_ROTATE,
bCopy);
- // TTTT:GLUE getSdrView().RotateMarkedGluePoints(DragStat().GetRef1(), mfDeltaRotation, bCopy);
}
else
{
diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx
index 0d557a9755dd..6d4114c93df0 100644
--- a/svx/source/svdraw/svddrgv.cxx
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -852,26 +852,20 @@ bool SdrDragView::BegInsGluePoint(const basegfx::B2DPoint& rPnt)
pObj->TakeObjNameSingul(aName);
aStr.SearchAndReplaceAscii("%1", aName);
maInsPointUndoStr = aStr;
- sdr::glue::List* pGPL=pObj->GetGluePointList(true);
+ sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
- if(pGPL)
+ if(rProvider.allowsUserGluePoints())
{
- sdr::glue::Point& rNew = pGPL->add(sdr::glue::Point());
+ sdr::glue::GluePoint& rNew = rProvider.addUserGluePoint(sdr::glue::GluePoint());
const sal_uInt32 nGlueId(rNew.getID());
SdrHdl* pHdl = 0;
- // TTTT:GLUE
- //const sal_uInt32 nGlueIdx(pGPL->Insert(sdr::glue::Point()));
- //sdr::glue::Point& rGP=(*pGPL)[nGlueIdx];
- //const sal_uInt32 nGlueId(rGP.GetId());
-
// the moved candidate is identified. GetObjectMatrix, but take care for objects
// with zero width/height
basegfx::B2DHomMatrix aCorrectedObjectTransformation(basegfx::tools::guaranteeMinimalScaling(pObj->getSdrObjectTransformation()));
aCorrectedObjectTransformation.invert();
rNew.setUnitPosition(aCorrectedObjectTransformation * rPnt);
- // rGP.SetAbsolutePos(rPnt, sdr::legacy::GetSnapRange(*pObj));
if(MarkGluePoint(pObj, nGlueId))
{
diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx
index 3da7f330f7fc..a4a198c0aafd 100644
--- a/svx/source/svdraw/svdglev.cxx
+++ b/svx/source/svdraw/svdglev.cxx
@@ -30,7 +30,6 @@
#include "svx/svdstr.hrc" // Namen aus der Resource
#include "svx/svdglob.hxx" // StringCache
#include <svx/svdpagv.hxx>
-#include <svx/sdrglue.hxx>
#include <svx/svdtrans.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdlegacy.hxx>
@@ -61,18 +60,9 @@ void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, co
if(aMarkedGluePoints.size())
{
- sdr::glue::List* pGPL = pObj->GetGluePointList(!bConst); // 0;
-
- //if(bConst)
- //{
- // pGPL = const_cast< sdr::glue::List* >(pObj->GetGluePointList());
- //}
- //else
- //{
- // pGPL = pObj->GetGluePointList(true);
- //}
-
- if(pGPL)
+ sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
+
+ if(rProvider.hasUserGluePoints())
{
const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*pObj);
@@ -85,15 +75,10 @@ void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, co
aCurrent != aMarkedGluePoints.end(); aCurrent++)
{
const sal_uInt32 nPtId(*aCurrent);
- sdr::glue::Point* pCandidate = pGPL->findByID(nPtId);
- // TTTT:GLUE
- //const sal_uInt32 nGlueIdx(pGPL->FindGluePoint(nPtId));
+ sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nPtId);
if(pCandidate)
- //if(SDRGLUEPOINT_NOTFOUND != nGlueIdx)
{
- //sdr::glue::Point& rGP=(*pGPL)[nGlueIdx];
-
(*pDoFunc)(*pCandidate, pObj, p1, p2, p3, p4, p5);
}
}
@@ -115,7 +100,7 @@ void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, co
////////////////////////////////////////////////////////////////////////////////////////////////////
-static void ImpGetEscDir(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnThisEsc, const void* pnRet, const void*, const void*)
+static void ImpGetEscDir(sdr::glue::GluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnThisEsc, const void* pnRet, const void*, const void*)
{
sal_uInt16& nRet=*(sal_uInt16*)pnRet;
bool& bFirst = *(bool*)pbFirst;
@@ -145,7 +130,7 @@ TRISTATE SdrGlueEditView::IsMarkedGluePointsEscDir(sal_uInt16 nThisEsc) const
return (TRISTATE)nRet;
}
-static void ImpSetEscDir(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const void* pnThisEsc, const void* pbOn, const void*, const void*, const void*)
+static void ImpSetEscDir(sdr::glue::GluePoint& rGP, const SdrObject* /*pObj*/, const void* pnThisEsc, const void* pbOn, const void*, const void*, const void*)
{
sal_uInt16 nEsc=rGP.getEscapeDirections();
@@ -170,7 +155,7 @@ void SdrGlueEditView::SetMarkedGluePointsEscDir(sal_uInt16 nThisEsc, bool bOn)
////////////////////////////////////////////////////////////////////////////////////////////////////
-static void ImpGetPercent(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnRet, const void*, const void*, const void*)
+static void ImpGetPercent(sdr::glue::GluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnRet, const void*, const void*, const void*)
{
sal_uInt16& nRet=*(sal_uInt16*)pnRet;
bool& bFirst = *(bool*)pbFirst;
@@ -199,15 +184,9 @@ TRISTATE SdrGlueEditView::IsMarkedGluePointsPercent() const
return (TRISTATE)nRet;
}
-static void ImpSetPercent(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const void* pbOn, const void*, const void*, const void*, const void*)
+static void ImpSetPercent(sdr::glue::GluePoint& rGP, const SdrObject* /*pObj*/, const void* pbOn, const void*, const void*, const void*, const void*)
{
- //const basegfx::B2DRange aObjectRange(sdr::legacy::GetSnapRange(*pObj));
- //const basegfx::B2DPoint aPos(rGP.GetAbsolutePos(aObjectRange));
-
- // TTTT:GLUE
rGP.setRelative(*(bool*)pbOn);
- //rGP.SetPercent(*(bool*)pbOn);
- //rGP.SetAbsolutePos(aPos, aObjectRange);
}
void SdrGlueEditView::SetMarkedGluePointsPercent(bool bOn)
@@ -219,16 +198,16 @@ void SdrGlueEditView::SetMarkedGluePointsPercent(bool bOn)
////////////////////////////////////////////////////////////////////////////////////////////////////
-static void ImpGetAlign(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pbDontCare, const void* pbVert, const void* pnRet, const void*)
+static void ImpGetAlign(sdr::glue::GluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pbDontCare, const void* pbVert, const void* pnRet, const void*)
{
- sdr::glue::Point::Alignment& nRet=*(sdr::glue::Point::Alignment*)pnRet;
+ sdr::glue::GluePoint::Alignment& nRet=*(sdr::glue::GluePoint::Alignment*)pnRet;
bool& bFirst = *(bool*)pbFirst;
bool& bDontCare = *(bool*)pbDontCare;
bool bVert = *(bool*)pbVert;
if(!bDontCare)
{
- sdr::glue::Point::Alignment nAlg(sdr::glue::Point::Alignment_Center);
+ sdr::glue::GluePoint::Alignment nAlg(sdr::glue::GluePoint::Alignment_Center);
if(bVert)
{
@@ -251,33 +230,33 @@ static void ImpGetAlign(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const
}
}
-sdr::glue::Point::Alignment SdrGlueEditView::GetMarkedGluePointsAlign(bool bVert) const
+sdr::glue::GluePoint::Alignment SdrGlueEditView::GetMarkedGluePointsAlign(bool bVert) const
{
bool bFirst(true);
bool bDontCare(false);
- sdr::glue::Point::Alignment nRet(sdr::glue::Point::Alignment_Center);
+ sdr::glue::GluePoint::Alignment nRet(sdr::glue::GluePoint::Alignment_Center);
const_cast< SdrGlueEditView* >(this)->ImpDoMarkedGluePoints(ImpGetAlign, true, &bFirst, &bDontCare, &bVert, &nRet);
return nRet;
}
-static void ImpSetAlign(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const void* pbVert, const void* pnAlign, const void*, const void*, const void*)
+static void ImpSetAlign(sdr::glue::GluePoint& rGP, const SdrObject* /*pObj*/, const void* pbVert, const void* pnAlign, const void*, const void*, const void*)
{
//const basegfx::B2DRange aObjectRange(sdr::legacy::GetSnapRange(*pObj));
//const basegfx::B2DPoint aPos(rGP.GetAbsolutePos(aObjectRange));
if(*(bool*)pbVert)
{
- rGP.setVerticalAlignment(*(sdr::glue::Point::Alignment *)pnAlign);
+ rGP.setVerticalAlignment(*(sdr::glue::GluePoint::Alignment *)pnAlign);
}
else
{
- rGP.setHorizontalAlignment(*(sdr::glue::Point::Alignment *)pnAlign);
+ rGP.setHorizontalAlignment(*(sdr::glue::GluePoint::Alignment *)pnAlign);
}
//rGP.SetAbsolutePos(aPos, aObjectRange);
}
-void SdrGlueEditView::SetMarkedGluePointsAlign(bool bVert, sdr::glue::Point::Alignment nAlign)
+void SdrGlueEditView::SetMarkedGluePointsAlign(bool bVert, sdr::glue::GluePoint::Alignment nAlign)
{
BegUndo(ImpGetResStr(STR_EditSetGlueAlign), getSelectedGluesDescription());
ImpDoMarkedGluePoints(ImpSetAlign, false, &bVert, &nAlign);
@@ -307,9 +286,9 @@ void SdrGlueEditView::DeleteMarkedGluePoints()
if(!aMarkedGluePoints.empty())
{
- sdr::glue::List* pGPL = pObj->GetGluePointList(false);
+ sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
- if(pGPL)
+ if(rProvider.hasUserGluePoints())
{
const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*pObj);
@@ -322,20 +301,12 @@ void SdrGlueEditView::DeleteMarkedGluePoints()
aCurrent != aMarkedGluePoints.end(); aCurrent++)
{
const sal_uInt32 nPtId(*aCurrent);
- sdr::glue::Point* pCandidate = pGPL->findByID(nPtId);
+ sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nPtId);
if(pCandidate)
{
- pGPL->remove(*pCandidate);
+ rProvider.removeUserGluePoint(*pCandidate);
}
-
- // TTTT:GLUE
- //const sal_uInt32 nGlueIdx(pGPL->FindGluePoint(nPtId));
- //
- //if(SDRGLUEPOINT_NOTFOUND != nGlueIdx)
- //{
- // pGPL->Delete(nGlueIdx);
- //}
}
pObj->SetChanged();
@@ -376,9 +347,9 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints()
SdrObject* pObj = aSelection[nm];
sdr::selection::Indices aMarkedGluePoints(getSelectedGluesForSelectedSdrObject(*pObj));
bool bMarkedGluePointsChanged(false);
- sdr::glue::List* pGPL = pObj->GetGluePointList(false);
+ sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
- if(!aMarkedGluePoints.empty() && pGPL)
+ if(!aMarkedGluePoints.empty() && rProvider.hasUserGluePoints())
{
if( bUndo )
{
@@ -389,11 +360,11 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints()
aCurrent != aMarkedGluePoints.end(); aCurrent++)
{
const sal_uInt32 nPtId(*aCurrent);
- sdr::glue::Point* pCandidate = pGPL->findByID(nPtId);
+ sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nPtId);
if(pCandidate)
{
- const sdr::glue::Point& rNew = pGPL->add(*pCandidate);
+ const sdr::glue::GluePoint& rNew = rProvider.addUserGluePoint(*pCandidate);
sdr::selection::Indices::iterator aNext(aCurrent);
aNext++;
@@ -402,23 +373,6 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints()
bMarkedGluePointsChanged = true;
aCurrent = aNext;
}
-
- // TTTT:GLUE
- //const sal_uInt32 nGlueIdx(pGPL->FindGluePoint(nPtId));
- //
- //if(SDRGLUEPOINT_NOTFOUND != nGlueIdx)
- //{
- // sdr::glue::Point aNewGP((*pGPL)[nGlueIdx]);
- // const sal_uInt32 nNewIdx(pGPL->Insert(aNewGP));
- // const sal_uInt32 nNewId((*pGPL)[nNewIdx].GetId());
- //
- // sdr::selection::Indices::iterator aNext(aCurrent);
- // aNext++;
- // aMarkedGluePoints.erase(aCurrent);
- // aMarkedGluePoints.insert(nNewId);
- // bMarkedGluePointsChanged = true;
- // aCurrent = aNext;
- //}
}
}
@@ -455,9 +409,9 @@ void SdrGlueEditView::ImpTransformMarkedGluePoints(const basegfx::B2DHomMatrix&
if(!aMarkedGluePoints.empty())
{
- sdr::glue::List* pGPL = pObj->GetGluePointList(false);
+ sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
- if(pGPL)
+ if(rProvider.hasUserGluePoints())
{
const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*pObj);
@@ -478,7 +432,7 @@ void SdrGlueEditView::ImpTransformMarkedGluePoints(const basegfx::B2DHomMatrix&
aCurrent != aMarkedGluePoints.end(); aCurrent++)
{
const sal_uInt32 nPtId(*aCurrent);
- sdr::glue::Point* pCandidate = pGPL->findByID(nPtId);
+ sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nPtId);
if(pCandidate)
{
@@ -487,18 +441,6 @@ void SdrGlueEditView::ImpTransformMarkedGluePoints(const basegfx::B2DHomMatrix&
pCandidate->setUnitPosition(aInverseCorrectedObjectTransformation * aTransformedPos);
}
-
- // TTTT:GLUE
- //const sal_uInt32 nGlueIdx(pGPL->FindGluePoint(nPtId));
- //
- //if(sdr::glue::Pointz_NOTFOUND != nGlueIdx)
- //{
- // sdr::glue::Point& rGP=(*pGPL)[nGlueIdx];
- // const basegfx::B2DRange aObjectRange(sdr::legacy::GetSnapRange(*pObj));
- // basegfx::B2DPoint aPos(rGP.GetAbsolutePos(aObjectRange));
- // (*pTrFunc)(aPos,p1,p2,p3,p4,p5);
- // rGP.SetAbsolutePos(aPos, aObjectRange);
- //}
}
pObj->SetChanged();
@@ -552,102 +494,4 @@ void SdrGlueEditView::TransformMarkedGluePoints(const basegfx::B2DHomMatrix& rTr
}
////////////////////////////////////////////////////////////////////////////////////////////////////
-// TTTT:GLUE
-
-//static void ImpMove(basegfx::B2DPoint& rPt, const void* p1, const void* /*p2*/, const void* /*p3*/, const void* /*p4*/, const void* /*p5*/)
-//{
-// rPt += *(static_cast< const basegfx::B2DVector* >(p1));
-//}
-
-//void SdrGlueEditView::MoveMarkedGluePoints(const basegfx::B2DVector& rDelta, bool bCopy)
-//{
-// XubString aStr(ImpGetResStr(STR_EditMove));
-//
-// if(bCopy)
-// {
-// aStr += ImpGetResStr(STR_EditWithCopy);
-// }
-//
-// BegUndo(aStr, getSelectedGluesDescription(), SDRREPFUNC_OBJ_MOVE);
-//
-// if(bCopy)
-// {
-// ImpCopyMarkedGluePoints();
-// }
-//
-// ImpTransformMarkedGluePoints(ImpMove, &rDelta);
-// EndUndo();
-// RecreateAllMarkHandles();
-//}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-//static void ImpResize(basegfx::B2DPoint& rPt, const void* p1, const void* p2, const void* /*p3*/, const void* /*p4*/, const void* /*p5*/)
-//{
-// const basegfx::B2DPoint* pRef = static_cast< const basegfx::B2DPoint* >(p1);
-// const basegfx::B2DVector* pScale = static_cast< const basegfx::B2DVector* >(p2);
-//
-// rPt = ((rPt - (*pRef)) * (*pScale)) + (*pRef);
-//}
-
-//void SdrGlueEditView::ResizeMarkedGluePoints(const basegfx::B2DPoint& rRef, const basegfx::B2DVector& rScale, bool bCopy)
-//{
-// XubString aStr(ImpGetResStr(STR_EditResize));
-//
-// if(bCopy)
-// {
-// aStr += ImpGetResStr(STR_EditWithCopy);
-// }
-//
-// BegUndo(aStr, getSelectedGluesDescription(), SDRREPFUNC_OBJ_RESIZE);
-//
-// if(bCopy)
-// {
-// ImpCopyMarkedGluePoints();
-// }
-//
-// ImpTransformMarkedGluePoints(ImpResize, &rRef, &rScale);
-// EndUndo();
-// RecreateAllMarkHandles();
-//}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-//static void ImpRotate(basegfx::B2DPoint& rPt, const void* p1, const void* /*p2*/, const void* p3, const void* p4, const void* /*p5*/)
-//{
-// const basegfx::B2DPoint* pRef = static_cast< const basegfx::B2DPoint* >(p1);
-// const double* pSin = static_cast< const double* >(p3);
-// const double* pCos = static_cast< const double* >(p4);
-// const double fDx(rPt.getX() - pRef->getX());
-// const double fDy(rPt.getX() - pRef->getX());
-//
-// rPt.setX(pRef->getX() + fDx * (*pCos) + fDy * (*pSin));
-// rPt.setY(pRef->getY() + fDy * (*pCos) - fDx * (*pSin));
-//}
-
-//void SdrGlueEditView::RotateMarkedGluePoints(const basegfx::B2DPoint& rRef, double fAngle, bool bCopy)
-//{
-// XubString aStr(ImpGetResStr(STR_EditRotate));
-//
-// if(bCopy)
-// {
-// aStr += ImpGetResStr(STR_EditWithCopy);
-// }
-//
-// BegUndo(aStr, getSelectedGluesDescription(), SDRREPFUNC_OBJ_ROTATE);
-//
-// if(bCopy)
-// {
-// ImpCopyMarkedGluePoints();
-// }
-//
-// const double fSin(sin(fAngle));
-// const double fCos(cos(fAngle));
-//
-// ImpTransformMarkedGluePoints(ImpRotate, &rRef, &fAngle, &fSin, &fCos);
-// EndUndo();
-// RecreateAllMarkHandles();
-//}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
// eof
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 9ef54f777e02..eb3e5c7b87bb 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -1069,17 +1069,15 @@ void SdrMarkView::CreateMarkHandles(SdrHdlList& rTarget)
if(!aMarkedGluePoints.empty())
{
- const sdr::glue::List* pGPL=pObj->GetGluePointList(false);
+ const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
- if(pGPL)
+ if(rProvider.hasUserGluePoints())
{
- // TTTT:GLUE const basegfx::B2DRange aObjSnapRange(sdr::legacy::GetSnapRange(*pObj));
-
for(sdr::selection::Indices::const_iterator aCurrent(aMarkedGluePoints.begin());
aCurrent != aMarkedGluePoints.end(); aCurrent++)
{
const sal_uInt32 nId(*aCurrent);
- const sdr::glue::Point* pCandidate = pGPL->findByID(nId);
+ const sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nId);
if(pCandidate)
{
@@ -1088,17 +1086,6 @@ void SdrMarkView::CreateMarkHandles(SdrHdlList& rTarget)
pGlueHdl->SetObjHdlNum(nId);
}
-
- // TTTT:GLUE
- //const sal_uInt32 nNumGP(pGPL->FindGluePoint(nId));
- //
- //if(SDRGLUEPOINT_NOTFOUND != nNumGP)
- //{
- // const sdr::glue::Point& rGP=(*pGPL)[nNumGP];
- // basegfx::B2DPoint aPos(rGP.GetAbsolutePos(aObjSnapRange));
- // SdrHdl* pGlueHdl = new SdrHdl(rTarget, pObj, HDL_GLUE, aPos);
- // pGlueHdl->SetObjHdlNum(nId);
- //}
}
}
}
diff --git a/svx/source/svdraw/svdmrkv1.cxx b/svx/source/svdraw/svdmrkv1.cxx
index 24d962c85515..d9966fc2474c 100644
--- a/svx/source/svdraw/svdmrkv1.cxx
+++ b/svx/source/svdraw/svdmrkv1.cxx
@@ -319,29 +319,37 @@ bool SdrMarkView::HasMarkableGluePoints() const
for(sal_uInt32 nMarkNum(0); nMarkNum < aSelection.size(); nMarkNum++)
{
const SdrObject* pObj = aSelection[nMarkNum];
- const sdr::glue::List* pGPL = pObj ? pObj->GetGluePointList(false) : 0;
- if(pGPL)
+ if(pObj)
{
- const sdr::glue::PointVector aCandidates(pGPL->getVector());
+ const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
- for(sal_uInt32 a(0); a < aCandidates.size(); a++)
+ if(rProvider.hasUserGluePoints())
{
- const sdr::glue::Point* pCandidate = aCandidates[a];
+ const sdr::glue::GluePointVector aCandidates(rProvider.getUserGluePointVector());
- if(pCandidate)
+ for(sal_uInt32 a(0); a < aCandidates.size(); a++)
{
- if(aCandidates[a]->getUserDefined())
+ const sdr::glue::GluePoint* pCandidate = aCandidates[a];
+
+ if(pCandidate)
{
- return true;
+ if(aCandidates[a]->getUserDefined())
+ {
+ return true;
+ }
+ }
+ else
+ {
+ OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
}
- }
- else
- {
- OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
}
}
}
+ else
+ {
+ OSL_ENSURE(false, "Got empty entry in selection list (!)");
+ }
}
}
@@ -359,37 +367,36 @@ sal_uInt32 SdrMarkView::GetMarkableGluePointCount() const
for(sal_uInt32 nMarkNum(0); nMarkNum < aSelection.size(); nMarkNum++)
{
const SdrObject* pObj = aSelection[nMarkNum];
- const sdr::glue::List* pGPL = pObj ? pObj->GetGluePointList(false) : 0;
- if(pGPL)
+ if(pObj)
{
- const sdr::glue::PointVector aCandidates(pGPL->getVector());
+ const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
- for(sal_uInt32 a(0); a < aCandidates.size(); a++)
+ if(rProvider.hasUserGluePoints())
{
- const sdr::glue::Point* pCandidate = aCandidates[a];
+ const sdr::glue::GluePointVector aCandidates(rProvider.getUserGluePointVector());
- if(pCandidate)
+ for(sal_uInt32 a(0); a < aCandidates.size(); a++)
{
- if(aCandidates[a]->getUserDefined())
+ const sdr::glue::GluePoint* pCandidate = aCandidates[a];
+
+ if(pCandidate)
{
- nAnz++;
+ if(aCandidates[a]->getUserDefined())
+ {
+ nAnz++;
+ }
+ }
+ else
+ {
+ OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
}
- }
- else
- {
- OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
}
}
-
- // TTTT:GLUE
- //for(sal_uInt32 a(0); a < pGPL->GetCount(); a++)
- //{
- // if((*pGPL)[a].IsUserDefined())
- // {
- // nAnz++;
- // }
- //}
+ }
+ else
+ {
+ OSL_ENSURE(false, "Got object selection with empty slots (!)");
}
}
}
@@ -449,15 +456,15 @@ void SdrMarkView::MarkGluePoints(const basegfx::B2DRange* pRange, bool bUnmark)
}
else
{
- const sdr::glue::List* pGPL = pObj->GetGluePointList(false);
+ const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
- if(pGPL && (!aMarkedGluePoints.empty() || !bUnmark))
+ if(rProvider.hasUserGluePoints() && (!aMarkedGluePoints.empty() || !bUnmark))
{
- const sdr::glue::PointVector aCandidates(pGPL->getVector());
+ const sdr::glue::GluePointVector aCandidates(rProvider.getUserGluePointVector());
for(sal_uInt32 a(0); a < aCandidates.size(); a++)
{
- const sdr::glue::Point* pCandidate = aCandidates[a];
+ const sdr::glue::GluePoint* pCandidate = aCandidates[a];
if(pCandidate)
{
@@ -491,40 +498,6 @@ void SdrMarkView::MarkGluePoints(const basegfx::B2DRange* pRange, bool bUnmark)
OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
}
}
-
- // TTTT:GLUE
- //const sal_uInt32 nGPAnz(pGPL->GetCount());
- //const basegfx::B2DRange aObjSnapRange(nGPAnz ? sdr::legacy::GetSnapRange(*pObj) : basegfx::B2DRange());
- //
- //for(sal_uInt32 nGPNum(0); nGPNum < nGPAnz; nGPNum++)
- //{
- // const sdr::glue::Point& rGP=(*pGPL)[nGPNum];
- //
- // if(rGP.IsUserDefined())
- // {
- // if(!pRange || pRange->isInside(rGP.GetAbsolutePos(aObjSnapRange)))
- // {
- // sdr::selection::Indices::iterator aFound(aMarkedGluePoints.find(rGP.GetId()));
- //
- // if(bUnmark)
- // {
- // if(aFound != aMarkedGluePoints.end())
- // {
- // aMarkedGluePoints.erase(aFound);
- // bGluePointsChanged = true;
- // }
- // }
- // else
- // {
- // if(aFound == aMarkedGluePoints.end())
- // {
- // aMarkedGluePoints.insert(rGP.GetId());
- // bGluePointsChanged = true;
- // }
- // }
- // }
- // }
- //}
}
}
@@ -546,7 +519,6 @@ bool SdrMarkView::PickGluePoint(const basegfx::B2DPoint& rPnt, SdrObject*& rpObj
return false;
}
- // SdrObject* pObj0 = rpObj;
const SdrObjectVector aSelection(getSelectedSdrObjectVectorFromSdrMarkView());
sal_uInt32 nMarkNum(aSelection.size());
@@ -554,56 +526,46 @@ bool SdrMarkView::PickGluePoint(const basegfx::B2DPoint& rPnt, SdrObject*& rpObj
{
nMarkNum--;
SdrObject* pObj = aSelection[nMarkNum];
- const sdr::glue::List* pGPL = pObj ? pObj->GetGluePointList(false) : 0;
- if(pGPL)
+ if(pObj)
{
- const sdr::glue::PointVector aCandidates(pGPL->getVector());
+ const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
- for(sal_uInt32 a(0); a < aCandidates.size(); a++)
+ if(rProvider.hasUserGluePoints())
{
- const sdr::glue::Point* pCandidate = aCandidates[a];
+ const sdr::glue::GluePointVector aCandidates(rProvider.getUserGluePointVector());
- if(pCandidate)
+ for(sal_uInt32 a(0); a < aCandidates.size(); a++)
{
- if(pCandidate->getUserDefined())
- {
- const basegfx::B2DPoint aAbsolutePos(pObj->getSdrObjectTransformation() * pCandidate->getUnitPosition());
- const double fDist(basegfx::B2DVector(aAbsolutePos - rPnt).getLength());
+ const sdr::glue::GluePoint* pCandidate = aCandidates[a];
- if(basegfx::fTools::lessOrEqual(fDist, getHitTolLog()))
+ if(pCandidate)
+ {
+ if(pCandidate->getUserDefined())
{
- rpObj = pObj;
- rnId = pCandidate->getID();
+ const basegfx::B2DPoint aAbsolutePos(pObj->getSdrObjectTransformation() * pCandidate->getUnitPosition());
+ const double fDist(basegfx::B2DVector(aAbsolutePos - rPnt).getLength());
- return true;
+ if(basegfx::fTools::lessOrEqual(fDist, getHitTolLog()))
+ {
+ rpObj = pObj;
+ rnId = pCandidate->getID();
+
+ return true;
+ }
}
}
- }
- else
- {
- OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
+ else
+ {
+ OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
+ }
}
}
}
-
- // TTTT:GLUE
- // const sal_uInt32 nNum(pGPL->GPLHitTest(rPnt, getHitTolLog(), pObj->getSdrObjectTransformation(), false));
- //
- // if(SDRGLUEPOINT_NOTFOUND != nNum)
- // {
- // // #i38892#
- // const sdr::glue::Point& rCandidate = (*pGPL)[nNum];
- //
- // if(rCandidate.IsUserDefined())
- // {
- // rpObj=pObj;
- // rnId=(*pGPL)[nNum].GetId();
- //
- // return true;
- // }
- // }
- //}
+ else
+ {
+ OSL_ENSURE(false, "Got a selection with empty slots (!)");
+ }
}
return false;
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index b9a1f0c266b5..973951482148 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1812,148 +1812,6 @@ void SdrObjCustomShape::setSdrObjectTransformation(const basegfx::B2DHomMatrix&
////////////////////////////////////////////////////////////////////////////////////////////////////
-// TTTT:GLUE
-//void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded()
-//{
-// const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
-//
-// if(pSdrObject)
-// {
-// const sdr::glue::List* pSource = pSdrObject->GetGluePointList(false);
-//
-// if(pSource && pSource->GetCount())
-// {
-// //if(!SdrTextObj::GetGluePointList())
-// //{
-// // SdrTextObj::ForceGluePointList();
-// //}
-//
-// const sdr::glue::List* pList = SdrTextObj::GetGluePointList(true);
-//
-// if(pList)
-// {
-// sdr::glue::List aNewList;
-// sal_uInt16 a;
-//
-// // build transform matrix from helper object to local
-// basegfx::B2DHomMatrix aTransFromHelperToLocal(pSdrObject->getSdrObjectTransformation());
-// aTransFromHelperToLocal.invert();
-// aTransFromHelperToLocal = getSdrObjectTransformation() * aTransFromHelperToLocal;
-//
-// for(a = 0; a < pSource->GetCount(); a++)
-// {
-// sdr::glue::Point aCopy((*pSource)[a]);
-// aCopy.SetUserDefined(false);
-//
-// basegfx::B2DPoint aGluePos(aCopy.GetPos());
-// aGluePos *= aTransFromHelperToLocal;
-// aCopy.SetPos(aGluePos);
-//
-// aNewList.Insert(aCopy);
-// }
-//
-// for(a = 0; a < pList->GetCount(); a++)
-// {
-// const sdr::glue::Point& rCandidate = (*pList)[a];
-//
-// if(rCandidate.IsUserDefined())
-// {
-// aNewList.Insert(rCandidate);
-// }
-// }
-//
-// // copy new list to local. This is NOT very convenient behaviour, the local
-// // GluePointList should not be set, but be delivered by using GetGluePointList(),
-// // maybe on demand. Since the local object is changed here, this is assumed to
-// // be a result of GetGluePointList and thus the list is copied
-// if(mpPlusData)
-// {
-// *mpPlusData->mpGluePoints = aNewList;
-// }
-// }
-// }
-// }
-//}
-
-sdr::glue::List* SdrObjCustomShape::GetGluePointList(bool bForce) const
-{
- sdr::glue::List* pOld = GetGluePointList(false);
- sdr::glue::List* pNew = GetGluePointList(bForce);
-
- if(bForce && !pOld && pNew)
- {
- // new list was created, add GluePoints from created visualization as non-user-defined GluePoints
- const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
-
- if(pSdrObject)
- {
- const sdr::glue::List* pSource = pSdrObject->GetGluePointList(false);
-
- if(pSource)
- {
- // build transform from helper object unit coordinates to target object unit coordinates;
- // we need the inverse of the target object transform. temporarily correct zero sizes for invert
- basegfx::B2DHomMatrix aInvLocal(basegfx::tools::guaranteeMinimalScaling(getSdrObjectTransformation()));
- aInvLocal.invert();
-
- // build full transform
- basegfx::B2DHomMatrix aFullHelperUnitToTargetUnit(aInvLocal * pSdrObject->getSdrObjectTransformation());
-
- // get vector, change and copy points
- const sdr::glue::PointVector aCandidates(pSource->getVector());
-
- for(sal_uInt32 a(0); a < aCandidates.size(); a++)
- {
- const sdr::glue::Point* pCandidate(aCandidates[a]);
-
- if(pCandidate)
- {
- const basegfx::B2DPoint aNewPos(aFullHelperUnitToTargetUnit * pCandidate->getUnitPosition());
- const sdr::glue::Point aNewPoint(
- aNewPos,
- pCandidate->getEscapeDirections(),
- pCandidate->getHorizontalAlignment(),
- pCandidate->getVerticalAlignment(),
- pCandidate->getRelative(),
- false);
-
- pNew->add(aNewPoint);
- }
- else
- {
- OSL_ENSURE(false, "Got empty slot in sdr::glue::PointVector (!)");
- }
- }
- }
- }
-
- // TTTT:GLUE check here (!)
- // Add custom glues here (!)
- // ((SdrObjCustomShape*)this)->ImpCheckCustomGluePointsAreAdded();
- }
-
- return mpPlusData ? mpPlusData->mpGluePoints : 0;
-
- //((SdrObjCustomShape*)this)->ImpCheckCustomGluePointsAreAdded();
- //return SdrTextObj::GetGluePointList();
-}
-
-//// #i38892# TTTT:GLUE
-//sdr::glue::List* SdrObjCustomShape::ForceGluePointList()
-//{
-// if(SdrTextObj::ForceGluePointList())
-// {
-// ImpCheckCustomGluePointsAreAdded();
-// return SdrTextObj::ForceGluePointList();
-// }
-// else
-// {
-// return 0L;
-// }
-//}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
void SdrObjCustomShape::AddToHdlList(SdrHdlList& rHdlList) const
{
// add handles from parent object
@@ -2894,7 +2752,270 @@ sdr::contact::ViewContact* SdrObjCustomShape::CreateObjectSpecificViewContact()
return new sdr::contact::ViewContactOfSdrObjCustomShape(*this);
}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace glue
+ {
+ // SdrEdgeObj implements it's own GluePointProvider since
+ // - it supports standard AutoGluePoints -> StandardGluePointProvider
+ // - it needs to add some non-user-defined UserGluePoints -> replace
+ // UserGluePoint methods
+ //
+ // This is a little bit tricky since this implementation has to 'mix' two
+ // sources of UserGluePoints:
+ // - custom-defined ones from the CustomShape visualization geometry (these
+ // will have the UserDefined-flag on 'false', see
+ // EnhancedCustomShape2d::ApplyGluePoints)
+ // - the 'real', user-defined local ones
+ //
+ // This 'mix' still has to keep the unique ID paradigm at inserting new
+ // GluePoints. Assuming that the visualization geometry
+ // - will always create the same numer and list of GluePoints
+ // - is able to create these on demand before user-defined ones are added
+ // this mix is done on the fly in the implementatin below
+
+ class SdrObjCustomShapeGluePointProvider : public StandardGluePointProvider
+ {
+ private:
+ // access to the owner object; always valid due to the
+ // lifetime being less or the same as the owner object
+ const SdrObjCustomShape* mpSource;
+
+ protected:
+ SdrObjCustomShapeGluePointProvider(const SdrObjCustomShapeGluePointProvider& rCandidate);
+ virtual GluePointProvider& operator=(const GluePointProvider& rCandidate);
+
+ // helper: get access to the custom-defined UserGluePoints' GluePointProvider. This
+ // may/should create the CustomShape visualization geometry and the custom-defined
+ // UserGluePoints with them
+ GluePointProvider* getUserDefinedGluePointProvider() const;
+
+ public:
+ // construction, destruction, copying
+ SdrObjCustomShapeGluePointProvider(const SdrObjCustomShape& rSource);
+ virtual ~SdrObjCustomShapeGluePointProvider();
+
+ // copying
+ virtual GluePointProvider* Clone() const;
+
+ // add new GluePoint, it gets a new ID assigned and a reference to the
+ // new instance (copied to list) is returned. It will assert when
+ // already added
+ virtual GluePoint& addUserGluePoint(GluePoint& rNew);
+
+ // remove GluePoint (will assert if it was not added)
+ virtual void removeUserGluePoint(const GluePoint& rNew);
+
+ // check on content
+ virtual bool hasUserGluePoints() const;
+
+ // find UserGluePoint by ID
+ virtual GluePoint* findUserGluePointByID(sal_uInt32 nID) const;
+
+ // get vector of UserGluePoints (pointers to the real points)
+ virtual const GluePointVector getUserGluePointVector() const;
+
+ // adapt UserGluePoints to changed absolute scale, e.g. when not relative and alignments have to be addressed
+ virtual void adaptUserGluePointsToChangedScale(const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale);
+ };
+
+ SdrObjCustomShapeGluePointProvider::SdrObjCustomShapeGluePointProvider(const SdrObjCustomShape& rSource)
+ : StandardGluePointProvider(),
+ mpSource(&rSource)
+ {
+ }
+
+ SdrObjCustomShapeGluePointProvider::~SdrObjCustomShapeGluePointProvider()
+ {
+ }
+
+ SdrObjCustomShapeGluePointProvider::SdrObjCustomShapeGluePointProvider(const SdrObjCustomShapeGluePointProvider& rCandidate)
+ : StandardGluePointProvider(),
+ mpSource(rCandidate.mpSource)
+ {
+ }
+
+ GluePointProvider& SdrObjCustomShapeGluePointProvider::operator=(const GluePointProvider& rCandidate)
+ {
+ // call parent to copy UserGluePoints
+ StandardGluePointProvider::operator=(rCandidate);
+
+ const SdrObjCustomShapeGluePointProvider* pSource = dynamic_cast< const SdrObjCustomShapeGluePointProvider* >(&rCandidate);
+
+ if(pSource)
+ {
+ // copy source SdrObject
+ mpSource = pSource->mpSource;
+ }
+
+ return *this;
+ }
+
+ GluePointProvider* SdrObjCustomShapeGluePointProvider::Clone() const
+ {
+ return new SdrObjCustomShapeGluePointProvider(*this);
+ }
+
+ GluePointProvider* SdrObjCustomShapeGluePointProvider::getUserDefinedGluePointProvider() const
+ {
+ const SdrObject* pGeometryVisualization = mpSource->GetSdrObjectFromCustomShape();
+
+ if(pGeometryVisualization)
+ {
+ return &pGeometryVisualization->GetGluePointProvider();
+ }
+
+ return 0;
+ }
+
+ GluePoint& SdrObjCustomShapeGluePointProvider::addUserGluePoint(GluePoint& rNew)
+ {
+ if(StandardGluePointProvider::hasUserGluePoints())
+ {
+ // there are already user-defined UserGluePoints, thus the biggest ID
+ // is already set and a newly added one will be based on it, increasing
+ // it; call parent
+ return StandardGluePointProvider::addUserGluePoint(rNew);
+ }
+
+ // no user-defined UserGluePoints yet; check if we have custom-defined oones
+ GluePointProvider* pSource = getUserDefinedGluePointProvider();
+
+ if(!pSource || !pSource->hasUserGluePoints())
+ {
+ // no custom-defined UserGluePoints; call parent
+ return StandardGluePointProvider::addUserGluePoint(rNew);
+ }
+
+ // we have to add the first user-defined UserGluePoint and there are
+ // custom-defined ones. Call parent to get the needed instance
+ GluePoint& rRetval = StandardGluePointProvider::addUserGluePoint(rNew);
+
+ // test if add did work; if yes, a changed entry will be returned
+ if(&rRetval != &rNew)
+ {
+ // get new highest ID
+ const GluePointVector aCustomGluePoints(pSource->getUserGluePointVector());
+
+ if(aCustomGluePoints.empty())
+ {
+ // error: pSource->hasUserGluePoints() had answered true before
+ OSL_ENSURE(false, "no custom-defined UserGluePoints, but was stated so before (!)");
+ }
+ else
+ {
+ const GluePoint* pLastCustomGluePoint = aCustomGluePoints.back();
+
+ if(pLastCustomGluePoint)
+ {
+ // correct ID at new, first user-defined UserGluePoint
+ setIdAtGluePoint(rRetval, pLastCustomGluePoint->getID() + 1);
+ }
+ else
+ {
+ // error: not empty, but no last
+ OSL_ENSURE(false, "custom-defined UserGluePoints, but empty last entry (!)");
+ }
+ }
+ }
+
+ return rRetval;
+ }
+
+ void SdrObjCustomShapeGluePointProvider::removeUserGluePoint(const GluePoint& rNew)
+ {
+ // non-user-defined GluePoints cannot be removed, thus just call parent and
+ // try to remove locally. This method does not need to be overloaded, but it
+ // is better for documentation purposes
+ StandardGluePointProvider::removeUserGluePoint(rNew);
+ }
+
+ bool SdrObjCustomShapeGluePointProvider::hasUserGluePoints() const
+ {
+ if(StandardGluePointProvider::hasUserGluePoints())
+ {
+ // if we alraedy have own user-defined GluePoints we are done
+ return true;
+ }
+
+ GluePointProvider* pSource = getUserDefinedGluePointProvider();
+
+ if(pSource)
+ {
+ // return state of custom shape defining geometry
+ return pSource->hasUserGluePoints();
+ }
+
+ return false;
+ }
+
+ GluePoint* SdrObjCustomShapeGluePointProvider::findUserGluePointByID(sal_uInt32 nID) const
+ {
+ // call parent
+ GluePoint* pRetval = StandardGluePointProvider::findUserGluePointByID(nID);
+
+ if(pRetval)
+ {
+ // done if found locally
+ return pRetval;
+ }
+
+ GluePointProvider* pSource = getUserDefinedGluePointProvider();
+
+ if(pSource)
+ {
+ // try to get from custom shape defining geometry
+ pRetval = pSource->findUserGluePointByID(nID);
+ }
+
+ return pRetval;
+ }
+
+ const GluePointVector SdrObjCustomShapeGluePointProvider::getUserGluePointVector() const
+ {
+ GluePointProvider* pSource = getUserDefinedGluePointProvider();
+
+ if(!pSource)
+ {
+ // no CustomShape GluePoints, return local state by calling parent
+ return StandardGluePointProvider::getUserGluePointVector();
+ }
+
+ if(!StandardGluePointProvider::hasUserGluePoints())
+ {
+ // no local GluePoints, return from custom
+ return pSource->getUserGluePointVector();
+ }
+
+ // need to mix both; add custom first
+ GluePointVector aRetval(pSource->getUserGluePointVector());
+ const GluePointVector aLocal(StandardGluePointProvider::getUserGluePointVector());
+
+ aRetval.insert(aRetval.end(), aLocal.begin(), aLocal.end());
+ return aRetval;
+ }
+
+ void SdrObjCustomShapeGluePointProvider::adaptUserGluePointsToChangedScale(const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale)
+ {
+ // non-user-defined GluePoints cannot be adapted/changed, thus just
+ // call parent. This method does not need to be overloaded, but it
+ // is better for documentation purposes
+ StandardGluePointProvider::adaptUserGluePointsToChangedScale(rOldScale, rNewScale);
+ }
+
+ } // end of namespace glue
+} // end of namespace sdr
+
+sdr::glue::GluePointProvider* SdrObjCustomShape::CreateObjectSpecificGluePointProvider()
+{
+ return new sdr::glue::SdrObjCustomShapeGluePointProvider(*this);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
// #i33136#
+
bool SdrObjCustomShape::doConstructOrthogonal(const ::rtl::OUString& rName)
{
bool bRetval(false);
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index e2b1950a4f96..a449ef4a8b53 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -327,7 +327,7 @@ SdrObjUserData* SdrObjUserDataList::RemoveUserData(sal_uInt32 nNum)
SdrObjGeoData::SdrObjGeoData()
: maSdrObjectTransformation(),
maObjectAnchor(0.0, 0.0),
- mpGPL(0),
+ mpGluePointProvider(0),
mnLayerID(0),
mbMoveProtect(false),
mbSizeProtect(false),
@@ -338,14 +338,16 @@ SdrObjGeoData::SdrObjGeoData()
SdrObjGeoData::~SdrObjGeoData()
{
- delete mpGPL;
+ if(mpGluePointProvider)
+ {
+ delete mpGluePointProvider;
+ }
}
////////////////////////////////////////////////////////////////////////////////////////////////////
SdrObjPlusData::SdrObjPlusData()
: mpUserDataList(0),
- mpGluePoints(0),
maObjName(),
maObjTitle(),
maObjDescription(),
@@ -361,11 +363,6 @@ SdrObjPlusData::~SdrObjPlusData()
{
delete mpUserDataList;
}
-
- if(mpGluePoints)
- {
- delete mpGluePoints;
- }
}
SdrObjPlusData* SdrObjPlusData::Clone(SdrObject* pObj1) const
@@ -394,12 +391,6 @@ SdrObjPlusData* SdrObjPlusData::Clone(SdrObject* pObj1) const
}
}
- // copy GluePoints
- if(mpGluePoints)
- {
- pNeuPlusData->mpGluePoints = new sdr::glue::List(*mpGluePoints);
- }
-
// copy object name, title and description
pNeuPlusData->maObjName = maObjName;
pNeuPlusData->maObjTitle = maObjTitle;
@@ -485,12 +476,12 @@ sdr::contact::ViewContact& SdrObject::GetViewContact() const
return *mpViewContact;
}
-sdr::gluepoint::GluePointProvider* SdrObject::CreateObjectSpecificGluePointProvider()
+sdr::glue::GluePointProvider* SdrObject::CreateObjectSpecificGluePointProvider()
{
- return new sdr::gluepoint::GluePointProvider();
+ return new sdr::glue::StandardGluePointProvider();
}
-sdr::gluepoint::GluePointProvider& SdrObject::GetGluePointProvider() const
+sdr::glue::GluePointProvider& SdrObject::GetGluePointProvider() const
{
if(!mpGluePointProvider)
{
@@ -975,7 +966,7 @@ void SdrObject::copyDataFromSdrObject(const SdrObject& rSource)
if(rSource.mpGluePointProvider)
{
- mpGluePointProvider = &rSource.GetGluePointProvider().Clone();
+ mpGluePointProvider = rSource.mpGluePointProvider->Clone();
}
maSdrObjectTransformation = rSource.maSdrObjectTransformation.getB2DHomMatrix();
@@ -1576,25 +1567,16 @@ void SdrObject::SaveGeoData(SdrObjGeoData& rGeo) const
rGeo.mbVisible = mbVisible;
rGeo.mnLayerID = mnLayerID;
- // Benutzerdefinierte Klebepunkte
- if(mpPlusData && mpPlusData->mpGluePoints)
- {
- if(rGeo.mpGPL)
- {
- *rGeo.mpGPL = *mpPlusData->mpGluePoints;
- }
- else
- {
- rGeo.mpGPL = new sdr::glue::List(*mpPlusData->mpGluePoints);
- }
- }
- else
+ // gluepoints
+ if(mpGluePointProvider)
{
- if(rGeo.mpGPL)
+ if(rGeo.mpGluePointProvider)
{
- delete rGeo.mpGPL;
- rGeo.mpGPL = 0;
+ delete rGeo.mpGluePointProvider;
+ rGeo.mpGluePointProvider = 0;
}
+
+ rGeo.mpGluePointProvider = mpGluePointProvider->Clone();
}
}
@@ -1620,27 +1602,16 @@ void SdrObject::RestGeoData(const SdrObjGeoData& rGeo)
mbVisible = rGeo.mbVisible;
mnLayerID = rGeo.mnLayerID;
- // Benutzerdefinierte Klebepunkte
- if(rGeo.mpGPL)
- {
- ImpForcePlusData();
-
- if(mpPlusData->mpGluePoints)
- {
- *mpPlusData->mpGluePoints = *rGeo.mpGPL;
- }
- else
- {
- mpPlusData->mpGluePoints = new sdr::glue::List(*rGeo.mpGPL);
- }
- }
- else
+ // gluepoints
+ if(rGeo.mpGluePointProvider)
{
- if(mpPlusData && mpPlusData->mpGluePoints)
+ if(mpGluePointProvider)
{
- delete mpPlusData->mpGluePoints;
- mpPlusData->mpGluePoints = 0;
+ delete mpGluePointProvider;
+ mpGluePointProvider = 0;
}
+
+ mpGluePointProvider = rGeo.mpGluePointProvider->Clone();
}
}
@@ -2063,80 +2034,6 @@ void SdrObject::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHar
}
}
-sdr::glue::Point SdrObject::GetVertexGluePoint(sal_uInt32 nPosNum) const
-{
- basegfx::B2DPoint aGluePosition(0.5, 0.5);
-
- switch(nPosNum)
- {
- default: //case 0: TopCenter
- {
- aGluePosition.setY(0.0);
- break;
- }
- case 1: // RightCenter
- {
- aGluePosition.setX(1.0);
- break;
- }
- case 2: // BottomCenter
- {
- aGluePosition.setY(1.0);
- break;
- }
- case 3: // LeftCenter
- {
- aGluePosition.setX(0.0);
- break;
- }
- }
-
- // create GluePoint, need to set UserDefined to false for these default GluePoints
- return sdr::glue::Point(
- aGluePosition,
- sdr::glue::Point::ESCAPE_DIRECTION_SMART,
- sdr::glue::Point::Alignment_Center,
- sdr::glue::Point::Alignment_Center,
- true, // mbRelative
- false); // mbUserDefined
-
- // TTTT:GLUE
- //aGluePosition = getSdrObjectTransformation() * aGluePosition;
- //sdr::glue::Point aGP(aGluePosition - sdr::legacy::GetSnapRange(*this).getCenter());
- //aGP.SetPercent(false);
- //
- //return aGP;
-}
-
-// TTTT:GLUE
-//const sdr::glue::List* SdrObject::GetGluePointList() const
-//{
-// if(mpPlusData)
-// {
-// return mpPlusData->mpGluePoints;
-// }
-//
-// return 0;
-//}
-
-sdr::glue::List* SdrObject::GetGluePointList(bool bForce) const
-{
- if(bForce)
- {
- if(!mpPlusData)
- {
- const_cast< SdrObject* >(this)->ImpForcePlusData();
- }
-
- if(!mpPlusData->mpGluePoints)
- {
- const_cast< SdrObject* >(this)->mpPlusData->mpGluePoints = new sdr::glue::List;
- }
- }
-
- return mpPlusData ? mpPlusData->mpGluePoints : 0;
-}
-
void extractLineContourFromPrimitive2DSequence(
const drawinglayer::primitive2d::Primitive2DSequence& rxSequence,
basegfx::B2DPolygonVector& rExtractedHairlines,
@@ -2628,9 +2525,9 @@ void SdrObject::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransfo
if(rTransformation != getSdrObjectTransformation())
{
basegfx::B2DVector aOldAbsoluteScale;
- sdr::glue::List* pGPL = GetGluePointList(false);
+ const bool bTransformGluePoints(mpGluePointProvider && mpGluePointProvider->hasUserGluePoints());
- if(pGPL)
+ if(bTransformGluePoints)
{
// remember old absolute size
aOldAbsoluteScale = basegfx::absolute(getSdrObjectScale());
@@ -2641,7 +2538,7 @@ void SdrObject::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransfo
maSdrObjectTransformation.setB2DHomMatrix(rTransformation);
SetChanged();
- if(pGPL)
+ if(bTransformGluePoints)
{
// get new absolute size
const basegfx::B2DVector aNewAbsoluteScale(basegfx::absolute(getSdrObjectScale()));
@@ -2649,7 +2546,7 @@ void SdrObject::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransfo
if(!aOldAbsoluteScale.equal(aNewAbsoluteScale))
{
// adapt the non-relative gluepoints according to their alignments
- pGPL->adaptToChangedScale(aOldAbsoluteScale, aNewAbsoluteScale);
+ mpGluePointProvider->adaptUserGluePointsToChangedScale(aOldAbsoluteScale, aNewAbsoluteScale);
}
}
}
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index 24955347716c..a659525968d8 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -55,8 +55,8 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
-#define SDRESC_VERT (sdr::glue::Point::ESCAPE_DIRECTION_TOP|sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM)
-#define SDRESC_HORZ (sdr::glue::Point::ESCAPE_DIRECTION_LEFT|sdr::glue::Point::ESCAPE_DIRECTION_RIGHT)
+#define SDRESC_VERT (sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP|sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM)
+#define SDRESC_HORZ (sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT|sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT)
#define SDRESC_ALL (SDRESC_HORZ|SDRESC_VERT)
SdrObjConnection::~SdrObjConnection()
@@ -72,53 +72,36 @@ void SdrObjConnection::ResetVars()
mbAutoVertex = false;
}
-bool SdrObjConnection::TakeGluePoint(sdr::glue::Point& rGP/* TTTT:GLUE, bool bSetAbsPos*/) const
+bool SdrObjConnection::TakeGluePoint(sdr::glue::GluePoint& rGP) const
{
bool bRet(false);
if(mpConnectedSdrObject)
{
// Ein Obj muss schon angedockt sein!
+ const sdr::glue::GluePointProvider& rProvider = mpConnectedSdrObject->GetGluePointProvider();
+
if(mbAutoVertex)
{
- rGP = mpConnectedSdrObject->GetVertexGluePoint(mnConnectorId);
+ rGP = rProvider.getAutoGluePointByIndex(mnConnectorId);
bRet = true;
}
else
{
- const sdr::glue::List* pGPL = mpConnectedSdrObject->GetGluePointList(false);
- if(pGPL)
+ if(rProvider.hasUserGluePoints())
{
- sdr::glue::Point* pCandidate = pGPL->findByID(mnConnectorId);
+ const sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(mnConnectorId);
if(pCandidate)
{
rGP = *pCandidate;
bRet = true;
}
-
- // TTTT:GLUE
- //const sal_uInt32 nNum(pGPL->FindGluePoint(mnConnectorId));
- //
- //if(SDRGLUEPOINT_NOTFOUND != nNum)
- //{
- // rGP=(*pGPL)[nNum];
- // bRet = true;
- //}
}
}
}
- //if(bRet && bSetAbsPos)
- //{
- //
- //
- // const basegfx::B2DPoint aPt(rGP.GetAbsolutePos(sdr::legacy::GetSnapRange(*mpConnectedSdrObject)));
- //
- // rGP.SetPos(aPt + maObjOfs);
- //}
-
return bRet;
}
@@ -212,6 +195,149 @@ sdr::contact::ViewContact* SdrEdgeObj::CreateObjectSpecificViewContact()
}
//////////////////////////////////////////////////////////////////////////////
+// GluePoint section
+
+namespace sdr
+{
+ namespace glue
+ {
+ // SdrEdgeObj implements it's own GluePointProvider since
+ // - it does not support UserGluePoints -> use GluePointProvider
+ // - it supports AutoGluePoints, but different from standard -> replace
+ // AutoGluePoint methods
+
+ class SdrEdgeObjGluePointProvider : public GluePointProvider
+ {
+ private:
+ // we need a reference to the owner object, given as reference in
+ // the constructor to express that it will always be set
+ const SdrEdgeObj* mpSource;
+
+ protected:
+ SdrEdgeObjGluePointProvider(const SdrEdgeObjGluePointProvider& rCandidate);
+ virtual GluePointProvider& operator=(const GluePointProvider& rCandidate);
+
+ public:
+ // construction, destruction, copying
+ SdrEdgeObjGluePointProvider(const SdrEdgeObj& rSource);
+ virtual ~SdrEdgeObjGluePointProvider();
+
+ // copying
+ virtual GluePointProvider* Clone() const;
+
+ // AutoGluePoint read access (read only)
+ virtual sal_uInt32 getAutoGluePointCount() const;
+ virtual GluePoint getAutoGluePointByIndex(sal_uInt32 nIndex) const;
+ };
+
+ SdrEdgeObjGluePointProvider::SdrEdgeObjGluePointProvider(const SdrEdgeObj& rSource)
+ : GluePointProvider(),
+ mpSource(&rSource)
+ {
+ }
+
+ SdrEdgeObjGluePointProvider::~SdrEdgeObjGluePointProvider()
+ {
+ }
+
+ SdrEdgeObjGluePointProvider::SdrEdgeObjGluePointProvider(const SdrEdgeObjGluePointProvider& rCandidate)
+ : GluePointProvider(),
+ mpSource(rCandidate.mpSource)
+ {
+ }
+
+ GluePointProvider& SdrEdgeObjGluePointProvider::operator=(const GluePointProvider& rCandidate)
+ {
+ // call parent to copy UserGluePoints
+ GluePointProvider::operator=(rCandidate);
+
+ const SdrEdgeObjGluePointProvider* pSource = dynamic_cast< const SdrEdgeObjGluePointProvider* >(&rCandidate);
+
+ if(pSource)
+ {
+ mpSource = pSource->mpSource;
+ }
+
+ return *this;
+ }
+
+ GluePointProvider* SdrEdgeObjGluePointProvider::Clone() const
+ {
+ return new SdrEdgeObjGluePointProvider(*this);
+ }
+
+ sal_uInt32 SdrEdgeObjGluePointProvider::getAutoGluePointCount() const
+ {
+ // to stay compatible, also use four points (anyways UNO API uses a fixed count of four
+ // currently). Seel below, 0,1 create the same point, 2 the start, 3, the end
+ return 4;
+ }
+
+ GluePoint SdrEdgeObjGluePointProvider::getAutoGluePointByIndex(sal_uInt32 nIndex) const
+ {
+ // no error with indices, just repeatedly return last GluePoint as fallback
+ const basegfx::B2DPolygon aEdgeTrack(mpSource->GetEdgeTrackPath());
+ const sal_uInt32 nPntAnz(aEdgeTrack.count());
+ basegfx::B2DPoint aOldPoint(0.0, 0.0);
+
+ if(nPntAnz)
+ {
+ switch(nIndex)
+ {
+ case 2:
+ {
+ if(!mpSource->GetConnectedNode(true))
+ {
+ aOldPoint = aEdgeTrack.getB2DPoint(0);
+ }
+ break;
+ }
+ case 3:
+ {
+ if(!mpSource->GetConnectedNode(false))
+ {
+ aOldPoint = aEdgeTrack.getB2DPoint(nPntAnz - 1);
+ }
+ break;
+ }
+ default:
+ {
+ if(1 == (nPntAnz & 1))
+ {
+ aOldPoint = aEdgeTrack.getB2DPoint(nPntAnz / 2);
+ }
+ else
+ {
+ aOldPoint = (aEdgeTrack.getB2DPoint((nPntAnz/2) - 1) + aEdgeTrack.getB2DPoint(nPntAnz/2)) * 0.5;
+ }
+ break;
+ }
+ }
+ }
+
+ // need to make absolute position relative. temporarily correct zero sizes for invert
+ basegfx::B2DHomMatrix aTransform(basegfx::tools::guaranteeMinimalScaling(mpSource->getSdrObjectTransformation()));
+
+ aTransform.invert();
+ aOldPoint = aTransform * aOldPoint;
+
+ return sdr::glue::GluePoint(
+ aOldPoint,
+ sdr::glue::GluePoint::ESCAPE_DIRECTION_SMART,
+ sdr::glue::GluePoint::Alignment_Center,
+ sdr::glue::GluePoint::Alignment_Center,
+ true, // mbRelative
+ false); // mbUserDefined
+ }
+ } // end of namespace glue
+} // end of namespace sdr
+
+sdr::glue::GluePointProvider* SdrEdgeObj::CreateObjectSpecificGluePointProvider()
+{
+ return new sdr::glue::SdrEdgeObjGluePointProvider(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
SdrEdgeObj::SdrEdgeObj(SdrModel& rSdrModel)
: SdrTextObj(rSdrModel),
@@ -468,64 +594,6 @@ sal_uInt16 SdrEdgeObj::GetObjIdentifier() const
return sal_uInt16(OBJ_EDGE);
}
-sdr::glue::Point SdrEdgeObj::GetVertexGluePoint(sal_uInt32 nNum) const
-{
- //basegfx::B2DPoint aPoint(0.0, 0.0);
- const sal_uInt32 nPntAnz(maEdgeTrack.count());
- basegfx::B2DPoint aOldPoint;
-
- if(nPntAnz)
- {
- if(2 == nNum && !GetConnectedNode(true))
- {
- aOldPoint = maEdgeTrack.getB2DPoint(0);
- }
- else if(3 == nNum && !GetConnectedNode(false))
- {
- aOldPoint = maEdgeTrack.getB2DPoint(nPntAnz - 1);
- }
- else
- {
- if(1 == (nPntAnz & 1))
- {
- aOldPoint = maEdgeTrack.getB2DPoint(nPntAnz / 2);
- }
- else
- {
- aOldPoint = (maEdgeTrack.getB2DPoint((nPntAnz/2) - 1) + maEdgeTrack.getB2DPoint(nPntAnz/2)) * 0.5;
- }
- }
- }
-
- // TTTT:GLUE
- //sdr::glue::Point aGP(aOldPoint);
- //aGP.SetPercent(false);
-
- // need to make absolute position relative. temporarily correct zero sizes for invert
- basegfx::B2DHomMatrix aTransform(basegfx::tools::guaranteeMinimalScaling(getSdrObjectTransformation()));
-
- aTransform.invert();
- aOldPoint = aTransform * aOldPoint;
-
- return sdr::glue::Point(
- aOldPoint,
- sdr::glue::Point::ESCAPE_DIRECTION_SMART,
- sdr::glue::Point::Alignment_Center,
- sdr::glue::Point::Alignment_Center,
- true, // mbRelative
- false); // mbUserDefined
-}
-
-sdr::glue::List* SdrEdgeObj::GetGluePointList(bool /*bForce*/) const
-{
- return NULL; // Keine benutzerdefinierten Klebepunkte fuer Verbinder #31671#
-}
-
-//sdr::glue::List* SdrEdgeObj::ForceGluePointList()
-//{
-// return NULL; // Keine benutzerdefinierten Klebepunkte fuer Verbinder #31671#
-//}
-
void SdrEdgeObj::ConnectToNode(bool bTail1, SdrObject* pObj)
{
SdrObjConnection& rCon=GetConnection(bTail1);
@@ -574,37 +642,41 @@ bool SdrEdgeObj::CheckNodeConnection(bool bTail1) const
if(rCon.mpConnectedSdrObject && rCon.mpConnectedSdrObject->getSdrPageFromSdrObject() == getSdrPageFromSdrObject() && nPtAnz)
{
- const sdr::glue::List* pGPL = rCon.mpConnectedSdrObject->GetGluePointList(false);
- const sdr::glue::PointVector aGluePointVector(pGPL ? pGPL->getVector() : sdr::glue::PointVector());
- const sal_uInt32 nConAnz(aGluePointVector.size());
- const sal_uInt32 nGesAnz(nConAnz + 4);
- const basegfx::B2DPoint aTail(bTail1 ? maEdgeTrack.getB2DPoint(0) : maEdgeTrack.getB2DPoint(nPtAnz - 1));
+ const sdr::glue::GluePointProvider& rProvider = rCon.mpConnectedSdrObject->GetGluePointProvider();
- for(sal_uInt32 i(0); i < nGesAnz && !bRet; i++)
+ if(rProvider.hasUserGluePoints())
{
- if(i < nConAnz)
- {
- // UserDefined or CustomShape
- const sdr::glue::Point* pCandidate = aGluePointVector[i];
+ const sdr::glue::GluePointVector aGluePointVector(rProvider.getUserGluePointVector());
+ const sal_uInt32 nConAnz(aGluePointVector.size());
+ const sal_uInt32 nGesAnz(nConAnz + rProvider.getAutoGluePointCount());
+ const basegfx::B2DPoint aTail(bTail1 ? maEdgeTrack.getB2DPoint(0) : maEdgeTrack.getB2DPoint(nPtAnz - 1));
- if(pCandidate)
+ for(sal_uInt32 i(0); i < nGesAnz && !bRet; i++)
+ {
+ if(i < nConAnz)
{
- const basegfx::B2DPoint aGluePos(rCon.mpConnectedSdrObject->getSdrObjectTransformation() * pCandidate->getUnitPosition());
+ // UserDefined or CustomShape
+ const sdr::glue::GluePoint* pCandidate = aGluePointVector[i];
- bRet = (aTail == aGluePos);
+ if(pCandidate)
+ {
+ const basegfx::B2DPoint aGluePos(rCon.mpConnectedSdrObject->getSdrObjectTransformation() * pCandidate->getUnitPosition());
+
+ bRet = (aTail == aGluePos);
+ }
+ else
+ {
+ OSL_ENSURE(false, "Got sdr::glue::PointVector with emty entries (!)");
+ }
}
- else
+ else //if (i<nConAnz+4)
{
- OSL_ENSURE(false, "Got sdr::glue::PointVector with emty entries (!)");
- }
- }
- else //if (i<nConAnz+4)
- {
- // Vertex
- const sdr::glue::Point aPt(rCon.mpConnectedSdrObject->GetVertexGluePoint(i - nConAnz));
- const basegfx::B2DPoint aGluePos(rCon.mpConnectedSdrObject->getSdrObjectTransformation() * aPt.getUnitPosition());
+ // Vertex
+ const sdr::glue::GluePoint aPt(rProvider.getAutoGluePointByIndex(i - nConAnz));
+ const basegfx::B2DPoint aGluePos(rCon.mpConnectedSdrObject->getSdrObjectTransformation() * aPt.getUnitPosition());
- bRet = (aTail == aGluePos);
+ bRet = (aTail == aGluePos);
+ }
}
}
}
@@ -726,22 +798,22 @@ sal_uInt16 SdrEdgeObj::ImpCalcEscAngle(SdrObject* pObj, const basegfx::B2DPoint&
if (byMitt) nRet|=SDRESC_VERT;
if (bxMitt) nRet|=SDRESC_HORZ;
if (dxl<dxr) { // Links
- if (dyo<dyu) nRet|=sdr::glue::Point::ESCAPE_DIRECTION_LEFT | sdr::glue::Point::ESCAPE_DIRECTION_TOP;
- else nRet|=sdr::glue::Point::ESCAPE_DIRECTION_LEFT | sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM;
+ if (dyo<dyu) nRet|=sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT | sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP;
+ else nRet|=sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT | sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM;
} else { // Rechts
- if (dyo<dyu) nRet|=sdr::glue::Point::ESCAPE_DIRECTION_RIGHT | sdr::glue::Point::ESCAPE_DIRECTION_TOP;
- else nRet|=sdr::glue::Point::ESCAPE_DIRECTION_RIGHT | sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM;
+ if (dyo<dyu) nRet|=sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT | sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP;
+ else nRet|=sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT | sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM;
}
return nRet;
}
if (dx<dy) { // waagerecht
if (bxMitt) return SDRESC_HORZ;
- if (dxl<dxr) return sdr::glue::Point::ESCAPE_DIRECTION_LEFT;
- else return sdr::glue::Point::ESCAPE_DIRECTION_RIGHT;
+ if (dxl<dxr) return sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT;
+ else return sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT;
} else { // senkrecht
if (byMitt) return SDRESC_VERT;
- if (dyo<dyu) return sdr::glue::Point::ESCAPE_DIRECTION_TOP;
- else return sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM;
+ if (dyo<dyu) return sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP;
+ else return sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM;
}
}
@@ -828,7 +900,7 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcEdgeTrack(
basegfx::B2DPoint aPt1(maEdgeTrack.getB2DPoint(0));
basegfx::B2DPoint aPt2(maEdgeTrack.getB2DPoint(nCount - 1));
const basegfx::B2DRange aBaseRange(aPt1, aPt2);
- sdr::glue::Point aGP1,aGP2;
+ sdr::glue::GluePoint aGP1,aGP2;
sal_uInt16 nEsc1(SDRESC_ALL);
sal_uInt16 nEsc2(SDRESC_ALL);
basegfx::B2DRange aBoundRange1;
@@ -851,8 +923,6 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcEdgeTrack(
aBoundRange1 = rCon1.mpConnectedSdrObject->getObjectRange(0);
}
- // TTTT:GLUE aBoundRange1.transform(basegfx::tools::createTranslateB2DHomMatrix(rCon1.maObjOfs));
-
const sal_Int32 nH(((SdrEdgeNode1HorzDistItem&)rSet.Get(SDRATTR_EDGENODE1HORZDIST)).GetValue());
const sal_Int32 nV(((SdrEdgeNode1VertDistItem&)rSet.Get(SDRATTR_EDGENODE1VERTDIST)).GetValue());
@@ -862,7 +932,7 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcEdgeTrack(
}
else
{
- aBewareRange1 = aBoundRange1 = basegfx::B2DRange(aPt1); // TTTT:GLUE + rCon1.maObjOfs);
+ aBewareRange1 = aBoundRange1 = basegfx::B2DRange(aPt1);
}
if(bCon2)
@@ -876,8 +946,6 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcEdgeTrack(
aBoundRange2 = rCon2.mpConnectedSdrObject->getObjectRange(0);
}
- // TTTT:GLUE aBoundRange2.transform(basegfx::tools::createTranslateB2DHomMatrix(rCon2.maObjOfs));
-
const sal_Int32 nH(((SdrEdgeNode2HorzDistItem&)rSet.Get(SDRATTR_EDGENODE2HORZDIST)).GetValue());
const sal_Int32 nV(((SdrEdgeNode2VertDistItem&)rSet.Get(SDRATTR_EDGENODE2VERTDIST)).GetValue());
@@ -887,7 +955,7 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcEdgeTrack(
}
else
{
- aBewareRange2 = aBoundRange2 = basegfx::B2DRange(aPt2); // TTTT:GLUE + rCon2.maObjOfs);
+ aBewareRange2 = aBoundRange2 = basegfx::B2DRange(aPt2);
}
sal_uInt32 nBestQual=0xFFFFFFFF;
@@ -933,14 +1001,14 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcEdgeTrack(
rCon1.mnConnectorId = nNum1;
}
- if(bCon1 && rCon1.TakeGluePoint(aGP1/*TTTT:GLUE, true*/))
+ if(bCon1 && rCon1.TakeGluePoint(aGP1))
{
aPt1 = rCon1.mpConnectedSdrObject->getSdrObjectTransformation() * aGP1.getUnitPosition();
nEsc1 = aGP1.getEscapeDirections();
- if(sdr::glue::Point::ESCAPE_DIRECTION_SMART == nEsc1)
+ if(sdr::glue::GluePoint::ESCAPE_DIRECTION_SMART == nEsc1)
{
- nEsc1 = ImpCalcEscAngle(rCon1.mpConnectedSdrObject, aPt1); // TTTT:GLUE - rCon1.maObjOfs);
+ nEsc1 = ImpCalcEscAngle(rCon1.mpConnectedSdrObject, aPt1);
}
}
@@ -951,24 +1019,24 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcEdgeTrack(
rCon2.mnConnectorId = nNum2;
}
- if(bCon2 && rCon2.TakeGluePoint(aGP2/*TTTT:GLUE, true*/))
+ if(bCon2 && rCon2.TakeGluePoint(aGP2))
{
aPt2 = rCon2.mpConnectedSdrObject->getSdrObjectTransformation() * aGP2.getUnitPosition();
nEsc2 = aGP2.getEscapeDirections();
- if(sdr::glue::Point::ESCAPE_DIRECTION_SMART == nEsc2)
+ if(sdr::glue::GluePoint::ESCAPE_DIRECTION_SMART == nEsc2)
{
- nEsc2 = ImpCalcEscAngle(rCon2.mpConnectedSdrObject, aPt2); // TTTT:GLUE - rCon2.maObjOfs);
+ nEsc2 = ImpCalcEscAngle(rCon2.mpConnectedSdrObject, aPt2);
}
}
for(long nA1(0); nA1 < 36000; nA1 += 9000)
{
- const sal_uInt16 nE1(!nA1 ? sdr::glue::Point::ESCAPE_DIRECTION_RIGHT : 9000 == nA1 ? sdr::glue::Point::ESCAPE_DIRECTION_TOP : 18000 == nA1 ? sdr::glue::Point::ESCAPE_DIRECTION_LEFT : 27000 == nA1 ? sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM : 0);
+ const sal_uInt16 nE1(!nA1 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT : 9000 == nA1 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP : 18000 == nA1 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT : 27000 == nA1 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM : 0);
for(long nA2(0); nA2 < 36000; nA2 += 9000)
{
- const sal_uInt16 nE2(!nA2 ? sdr::glue::Point::ESCAPE_DIRECTION_RIGHT : 9000 == nA2 ? sdr::glue::Point::ESCAPE_DIRECTION_TOP : 18000 == nA2 ? sdr::glue::Point::ESCAPE_DIRECTION_LEFT : 27000 == nA2 ? sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM : 0);
+ const sal_uInt16 nE2(!nA2 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT : 9000 == nA2 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP : 18000 == nA2 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT : 27000 == nA2 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM : 0);
if((nEsc1 & nE1) && (nEsc2 & nE2))
{
@@ -2192,17 +2260,6 @@ basegfx::B2DPolygon SdrEdgeObj::ImplAddConnectorOverlay(SdrDragMethod& rDragMeth
SdrObjConnection aMyCon1(maCon1);
SdrObjConnection aMyCon2(maCon2);
- // TTTT:GLUE
- //if (bTail1)
- //{
- // aMyCon1.maObjOfs *= rDragMethod.getCurrentTransformation();
- //}
- //
- //if (bTail2)
- //{
- // aMyCon2.maObjOfs *= rDragMethod.getCurrentTransformation();
- //}
-
SdrEdgeInfoRec aInfo(maEdgeInfo);
aResult = ImpCalcEdgeTrack(aMyCon1, aMyCon2, &aInfo);
}
@@ -2368,24 +2425,26 @@ void SdrEdgeObj::FindConnector(
// Die Userdefined Konnektoren haben absolute Prioritaet.
// Danach kommt Vertex, Corner und Mitte(Best) gleich priorisiert.
// Zum Schluss kommt noch ein HitTest aufs Obj.
- const sdr::glue::List* pGPL = pObj->GetGluePointList(false);
- const sdr::glue::PointVector aGluePointVector(pGPL ? pGPL->getVector() : sdr::glue::PointVector());
- const sal_uInt32 nConAnz(aGluePointVector.size());
- sal_uInt32 nGesAnz=nConAnz+9;
+ const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
+ const sdr::glue::GluePointVector aUserGluePointVector(rProvider.getUserGluePointVector());
+ const sal_uInt32 nUserGluePointCount(aUserGluePointVector.size());
+ const sal_uInt32 nAutoGluePointCount(rProvider.getAutoGluePointCount());
+ const sal_uInt32 nAllGluePointCount(nUserGluePointCount + nAutoGluePointCount + 1);
bool bUserFnd=false;
sal_uInt32 nBestDist=0xFFFFFFFF;
- for (sal_uInt32 i=0; i<nGesAnz; i++)
+
+ for (sal_uInt32 i=0; i<nAllGluePointCount; i++)
{
- bool bUser=i<nConAnz;
- bool bVertex=i>=nConAnz+0 && i<nConAnz+4;
- bool bCenter=i==nConAnz+4;
+ const bool bUser(i < nUserGluePointCount);
+ const bool bVertex(i >= nUserGluePointCount && i < nUserGluePointCount + nAutoGluePointCount);
+ const bool bCenter(i + 1 == nAllGluePointCount);
bool bOk=false;
Point aConPos;
sal_uInt32 nConNum=i;
if(bUser)
{
- const sdr::glue::Point* pCandidate = aGluePointVector[nConNum];
+ const sdr::glue::GluePoint* pCandidate = aUserGluePointVector[nConNum];
if(pCandidate)
{
@@ -2402,9 +2461,9 @@ void SdrEdgeObj::FindConnector(
}
else if (bVertex && !bUserFnd)
{
- nConNum = nConNum - nConAnz;
+ nConNum = nConNum - nUserGluePointCount;
- const sdr::glue::Point aLocalPt(pObj->GetVertexGluePoint(nConNum));
+ const sdr::glue::GluePoint aLocalPt(rProvider.getAutoGluePointByIndex(nConNum));
const basegfx::B2DPoint aPoint(pObj->getSdrObjectTransformation() * aLocalPt.getUnitPosition());
aConPos = Point(basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()));
@@ -2749,17 +2808,20 @@ void SdrEdgeObj::setGluePointIndex(bool bTail, sal_Int32 nIndex /* = -1 */ )
if( nIndex > 3 )
{
- // TTTT:GLUE no more; check if this works
- // nIndex -= 3; // SJ: the start api index is 0, whereas the implementation in svx starts from 1
- nIndex -= 4; // SJ: the start api index is 0, whereas the implementation in svx starts from 1
+ nIndex -= 4; // The start api index and the implementation index is now both 0
// for user defined glue points we have
// to get the id for this index first
- const sdr::glue::List* pList = rConn1.GetObject() ? rConn1.GetObject()->GetGluePointList(false) : NULL;
+ const SdrObject* pCandidate = rConn1.GetObject();
- if(!pList || !pList->findByID(nIndex))
+ if(pCandidate)
{
- return;
+ const sdr::glue::GluePointProvider& rProvider = pCandidate->GetGluePointProvider();
+
+ if(!rProvider.hasUserGluePoints() || !rProvider.findUserGluePointByID(nIndex))
+ {
+ return;
+ }
}
}
else if( nIndex < 0 )
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index cee9cbfd1175..2cf992db0c96 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -45,7 +45,6 @@
#include <svx/svdmodel.hxx>
#include <svx/svdundo.hxx>
#include <svx/svdview.hxx>
-#include <svx/sdrglue.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdograf.hxx>
#include <svx/svdattrx.hxx>
@@ -55,7 +54,6 @@
#include <svx/sdr/overlay/overlayobjectlist.hxx>
#include <svx/sdr/overlay/overlayrollingrectangle.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
-#include <svx/sdrglue.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdview.hxx>
#include <svl/itemiter.hxx>
@@ -75,6 +73,7 @@
#include <basegfx/numeric/ftools.hxx>
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
using namespace ::rtl;
using namespace ::com::sun::star;
@@ -947,50 +946,38 @@ bool SdrPaintView::KeyInput(const KeyEvent& /*rKEvt*/, Window* /*pWin*/)
void SdrPaintView::GlueInvalidate() const
{
- const sal_uInt32 nWindowCount(PaintWindowCount());
-
- for(sal_uInt32 nWinNum(0); nWinNum < nWindowCount; nWinNum++)
+ if(mpPageView)
{
- SdrPaintWindow* pPaintWindow = GetPaintWindow(nWinNum);
+ // start at current ObjectList (evtl. entered groups)
+ const SdrObjList* pOL = mpPageView->GetCurrentObjectList();
+ const sal_uInt32 nObjAnz(pOL->GetObjCount());
- if(pPaintWindow->OutputToWindow())
+ for(sal_uInt32 nObjNum(0); nObjNum < nObjAnz; nObjNum++)
{
- OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
- const basegfx::B2DVector aLogicHalfSevenPix(rOutDev.GetInverseViewTransformation() * basegfx::B2DVector(3.5, 3.5));
+ const SdrObject* pObj = pOL->GetObj(nObjNum);
- if(mpPageView)
+ if(pObj)
{
- const SdrObjList* pOL = mpPageView->GetCurrentObjectList();
- const sal_uInt32 nObjAnz(pOL->GetObjCount());
+ const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
- for(sal_uInt32 nObjNum(0); nObjNum < nObjAnz; nObjNum++)
+ if(rProvider.hasUserGluePoints())
{
- const SdrObject* pObj = pOL->GetObj(nObjNum);
- const sdr::glue::List* pGPL = pObj ? pObj->GetGluePointList(false) : 0;
-
- if(pGPL)
+ // SdrObject has GluePoints, thus invalidate VOC to force recreation. Do this in
+ // just the VOC belonging to this PageWindow's ObjectContacts, not in all views
+ for(sal_uInt32 b(0); b < mpPageView->PageWindowCount(); b++)
{
- const sdr::glue::PointVector aGluePointVecor(pGPL->getVector());
-
- for(sal_uInt32 a(0); a < aGluePointVecor.size(); a++)
- {
- const sdr::glue::Point* pCandidate = aGluePointVecor[a];
+ const SdrPageWindow& rPageWindow = *(mpPageView->GetPageWindow(b));
+ sdr::contact::ObjectContact& rObjectContact = rPageWindow.GetObjectContact();
+ sdr::contact::ViewObjectContact& rVOC = pObj->GetViewContact().GetViewObjectContact(rObjectContact);
- if(pCandidate)
- {
- const basegfx::B2DPoint aPos(pObj->getSdrObjectTransformation() * pCandidate->getUnitPosition());
- const basegfx::B2DRange aRange(aPos - aLogicHalfSevenPix, aPos + aLogicHalfSevenPix);
-
- InvalidateOneWin((Window&)rOutDev, aRange);
- }
- else
- {
- OSL_ENSURE(false, "Got sdr::glue::PointVector with empty entries (!)");
- }
- }
+ rVOC.ActionChanged();
}
}
}
+ else
+ {
+ OSL_ENSURE(false, "Got selection with empty slots (!)");
+ }
}
}
}
diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index 3bba921a8f8c..b37f4b921ba8 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -2179,7 +2179,6 @@ void SdrView::SetMasterPagePaintCaching(bool bOn)
}
}
-// TTTT:HANDLE
void SdrView::MoveHandleByVector(const SdrHdl& rHdl, const basegfx::B2DVector& rDistance, Window* pMakeVisibleWindow, SdrDragMethod* pOwnDragMethod)
{
if(!rDistance.equalZero())
diff --git a/svx/source/unodraw/gluepts.cxx b/svx/source/unodraw/gluepts.cxx
index 0b6786fbdf6b..5aa073dcb923 100644
--- a/svx/source/unodraw/gluepts.cxx
+++ b/svx/source/unodraw/gluepts.cxx
@@ -28,7 +28,6 @@
#include <cppuhelper/implbase2.hxx>
#include <svx/svdmodel.hxx>
#include <svx/svdobj.hxx>
-#include <svx/sdrglue.hxx>
#include <svx/svdpage.hxx>
using namespace ::com::sun::star;
@@ -90,17 +89,17 @@ sal_Int32 SAL_CALL SvxUnoGluePointAccess::insert( const uno::Any& aElement ) thr
{
if( mpObject.is() )
{
- sdr::glue::List* pList = mpObject->GetGluePointList(true);
+ sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider();
- if( pList )
+ if(rProvider.allowsUserGluePoints())
{
drawing::GluePoint2 aUnoGlue;
if( aElement >>= aUnoGlue )
{
const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale()));
- const sdr::glue::Point aSdrGlue(aUnoGlue, aAbsoluteScale);
- const sdr::glue::Point& rAdded = pList->add(aSdrGlue);
+ sdr::glue::GluePoint aSdrGlue(aUnoGlue, aAbsoluteScale);
+ const sdr::glue::GluePoint& rAdded = rProvider.addUserGluePoint(aSdrGlue);
// only repaint, no objectchange
mpObject->ActionChanged();
@@ -120,15 +119,15 @@ void SAL_CALL SvxUnoGluePointAccess::removeByIdentifier( sal_Int32 Identifier )
if( mpObject.is() && ( Identifier >= NON_USER_DEFINED_GLUE_POINTS ))
{
const sal_uInt32 nId(Identifier - NON_USER_DEFINED_GLUE_POINTS);
- sdr::glue::List* pList = mpObject->GetGluePointList(false);
+ sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider();
- if(pList)
+ if(rProvider.hasUserGluePoints())
{
- const sdr::glue::Point* pCandidate = pList->findByID(nId);
+ const sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nId);
if(pCandidate)
{
- pList->remove(*pCandidate);
+ rProvider.removeUserGluePoint(*pCandidate);
// only repaint, no objectchange
mpObject->ActionChanged();
@@ -136,23 +135,6 @@ void SAL_CALL SvxUnoGluePointAccess::removeByIdentifier( sal_Int32 Identifier )
return;
}
}
-
- // TTTT:GLUE
- //const sal_uInt32 nCount = pList ? pList->GetCount() : 0;
- //sal_uInt32 i;
- //
- //for( i = 0; i < nCount; i++ )
- //{
- // if( (*pList)[i].GetId() == nId )
- // {
- // pList->Delete( i );
- //
- // // only repaint, no objectchange
- // mpObject->ActionChanged();
- //
- // return;
- // }
- //}
}
throw container::NoSuchElementException();
@@ -169,17 +151,17 @@ void SAL_CALL SvxUnoGluePointAccess::replaceByIdentifer( sal_Int32 Identifier, c
throw lang::IllegalArgumentException();
const sal_uInt32 nId(Identifier - NON_USER_DEFINED_GLUE_POINTS);
- sdr::glue::List* pList = mpObject->GetGluePointList(false);
+ sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider();
- if(pList)
+ if(rProvider.hasUserGluePoints())
{
- sdr::glue::Point* pCandidate = pList->findByID(nId);
+ sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nId);
if(pCandidate)
{
// change the glue point (but start with a new GluePoint)
const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale()));
- const sdr::glue::Point aSdrGlue(aGluePoint, aAbsoluteScale);
+ const sdr::glue::GluePoint aSdrGlue(aGluePoint, aAbsoluteScale);
*pCandidate = aSdrGlue;
@@ -190,24 +172,6 @@ void SAL_CALL SvxUnoGluePointAccess::replaceByIdentifer( sal_Int32 Identifier, c
}
}
- // TTTT:GLUE
- //const sal_uInt32 nCount = pList ? pList->GetCount() : 0;
- //sal_uInt32 i;
- //for( i = 0; i < nCount; i++ )
- //{
- // if( (*pList)[i].GetId() == nId )
- // {
- // // change the glue point
- // sdr::glue::Point& rTempPoint = (*pList)[i];
- // convert( aGluePoint, rTempPoint );
- //
- // // only repaint, no objectchange
- // mpObject->ActionChanged();
- //
- // return;
- // }
- //}
-
throw container::NoSuchElementException();
}
}
@@ -217,9 +181,11 @@ uno::Any SAL_CALL SvxUnoGluePointAccess::getByIdentifier( sal_Int32 Identifier )
{
if(mpObject.is())
{
+ const sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider();
+
if( Identifier < NON_USER_DEFINED_GLUE_POINTS ) // default glue point?
{
- const sdr::glue::Point aTempPoint(mpObject->GetVertexGluePoint(Identifier));
+ const sdr::glue::GluePoint aTempPoint(rProvider.getAutoGluePointByIndex(Identifier));
const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale()));
const drawing::GluePoint2 aGluePoint(aTempPoint.convertToGluePoint2(aAbsoluteScale));
@@ -228,11 +194,10 @@ uno::Any SAL_CALL SvxUnoGluePointAccess::getByIdentifier( sal_Int32 Identifier )
else
{
const sal_uInt32 nId(Identifier - NON_USER_DEFINED_GLUE_POINTS);
- const sdr::glue::List* pList = mpObject->GetGluePointList(false);
- if(pList)
+ if(rProvider.hasUserGluePoints())
{
- const sdr::glue::Point* pCandidate = pList->findByID(nId);
+ const sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nId);
if(pCandidate)
{
@@ -242,25 +207,6 @@ uno::Any SAL_CALL SvxUnoGluePointAccess::getByIdentifier( sal_Int32 Identifier )
return uno::makeAny( aGluePoint );
}
}
-
- // TTTT:GLUE
- //const sal_uInt32 nCount = pList ? pList->GetCount() : 0;
- //
- //for( sal_uInt32 i = 0; i < nCount; i++ )
- //{
- // const sdr::glue::Point& rTempPoint = (*pList)[i];
- // if( rTempPoint.GetId() == nId )
- // {
- // // #i38892#
- // if(rTempPoint.IsUserDefined())
- // {
- // aGluePoint.IsUserDefined = sal_True;
- // }
- //
- // convert( rTempPoint, aGluePoint );
- // return uno::makeAny( aGluePoint );
- // }
- //}
}
}
@@ -271,8 +217,8 @@ uno::Sequence< sal_Int32 > SAL_CALL SvxUnoGluePointAccess::getIdentifiers() thro
{
if( mpObject.is() )
{
- const sdr::glue::List* pList = mpObject->GetGluePointList(false);
- const sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector());
+ const sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider();
+ const sdr::glue::GluePointVector aGluePointVector(rProvider.getUserGluePointVector());
uno::Sequence< sal_Int32 > aIdSequence(aGluePointVector.size() + NON_USER_DEFINED_GLUE_POINTS);
sal_Int32 *pIdentifier = aIdSequence.getArray();
sal_uInt32 i(0);
@@ -284,7 +230,7 @@ uno::Sequence< sal_Int32 > SAL_CALL SvxUnoGluePointAccess::getIdentifiers() thro
for(i = 0; i < aGluePointVector.size(); i++)
{
- const sdr::glue::Point* pCandidate = aGluePointVector[i];
+ const sdr::glue::GluePoint* pCandidate = aGluePointVector[i];
if(pCandidate)
{
@@ -296,19 +242,6 @@ uno::Sequence< sal_Int32 > SAL_CALL SvxUnoGluePointAccess::getIdentifiers() thro
}
}
- // TTTT:GLUE
- //const sal_uInt32 nCount = pList ? pList->GetCount() : 0;
- //sal_uInt32 i;
- //
- //uno::Sequence< sal_Int32 > aIdSequence( nCount + NON_USER_DEFINED_GLUE_POINTS );
- //sal_Int32 *pIdentifier = aIdSequence.getArray();
- //
- //for( i = 0; i < NON_USER_DEFINED_GLUE_POINTS; i++ )
- // *pIdentifier++ = i;
- //
- //for( i = 0; i < nCount; i++ )
- // *pIdentifier++ = ( (*pList)[i].GetId() + NON_USER_DEFINED_GLUE_POINTS ) - 1;
-
return aIdSequence;
}
else
@@ -325,18 +258,18 @@ void SAL_CALL SvxUnoGluePointAccess::insertByIndex( sal_Int32, const uno::Any& E
{
if( mpObject.is() )
{
- sdr::glue::List* pList = mpObject->GetGluePointList(true);
+ sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider();
- if( pList )
+ if(rProvider.allowsUserGluePoints())
{
drawing::GluePoint2 aUnoGlue;
if( Element >>= aUnoGlue )
{
const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale()));
- const sdr::glue::Point aSdrGlue(aUnoGlue, aAbsoluteScale);
+ sdr::glue::GluePoint aSdrGlue(aUnoGlue, aAbsoluteScale);
- pList->add(aSdrGlue);
+ rProvider.addUserGluePoint(aSdrGlue);
// only repaint, no objectchange
mpObject->ActionChanged();
@@ -355,39 +288,25 @@ void SAL_CALL SvxUnoGluePointAccess::removeByIndex( sal_Int32 Index ) throw(lang
{
if( mpObject.is() )
{
- sdr::glue::List* pList = mpObject->GetGluePointList(true);
+ sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider();
- if( pList )
+ if(rProvider.hasUserGluePoints())
{
Index -= 4;
if(Index >= 0)
{
- const sdr::glue::Point* pCandidate = pList->findByID(Index);
+ const sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(Index);
if(pCandidate)
{
- pList->remove(*pCandidate);
+ rProvider.removeUserGluePoint(*pCandidate);
// only repaint, no objectchange
mpObject->ActionChanged();
return;
}
-
- // TTTT:GLUE
- //{
- // const sdr::glue::Point* pCandidate = pList->findByID(sal_uInt32 nID) const;
- //
- //
- //
- // pList->Delete( (sal_uInt32)Index );
- //
- // // only repaint, no objectchange
- // mpObject->ActionChanged();
- //
- // return;
- //}
}
}
}
@@ -407,17 +326,17 @@ void SAL_CALL SvxUnoGluePointAccess::replaceByIndex( sal_Int32 Index, const uno:
if( mpObject.is() && Index >= 0 )
{
- const sdr::glue::List* pList = mpObject->GetGluePointList(false);
- const sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector());
+ const sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider();
+ const sdr::glue::GluePointVector aGluePointVector(rProvider.getUserGluePointVector());
if(Index < (sal_Int32)aGluePointVector.size())
{
- sdr::glue::Point* pCandidate = aGluePointVector[Index];
+ sdr::glue::GluePoint* pCandidate = aGluePointVector[Index];
if(pCandidate)
{
const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale()));
- const sdr::glue::Point aSdrGlue(aUnoGlue, aAbsoluteScale);
+ const sdr::glue::GluePoint aSdrGlue(aUnoGlue, aAbsoluteScale);
*pCandidate = aSdrGlue;
@@ -428,13 +347,6 @@ void SAL_CALL SvxUnoGluePointAccess::replaceByIndex( sal_Int32 Index, const uno:
{
OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty entries (!)");
}
-
- // TTTT:GLUE
- //rGlue = (*pList)[(sal_uInt32)Index];
- //convert( aUnoGlue, rGlue );
- //
- //// only repaint, no objectchange
- //mpObject->ActionChanged();
}
}
@@ -452,8 +364,8 @@ sal_Int32 SAL_CALL SvxUnoGluePointAccess::getCount() throw(uno::RuntimeException
// and any number of user defined glue points
nCount += 4;
- const sdr::glue::List* pList = mpObject->GetGluePointList(false);
- const sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector());
+ const sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider();
+ const sdr::glue::GluePointVector aGluePointVector(rProvider.getUserGluePointVector());
nCount += aGluePointVector.size();
}
@@ -465,9 +377,11 @@ uno::Any SAL_CALL SvxUnoGluePointAccess::getByIndex( sal_Int32 Index ) throw(lan
{
if(Index >= 0 && mpObject.is())
{
- if( Index < 4 ) // default glue point?
+ const sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider();
+
+ if(Index < 4) // default glue point?
{
- const sdr::glue::Point aTempPoint(mpObject->GetVertexGluePoint(Index));
+ const sdr::glue::GluePoint aTempPoint(rProvider.getAutoGluePointByIndex(Index));
const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale()));
const drawing::GluePoint2 aGluePoint(aTempPoint.convertToGluePoint2(aAbsoluteScale));
uno::Any aAny;
@@ -478,12 +392,11 @@ uno::Any SAL_CALL SvxUnoGluePointAccess::getByIndex( sal_Int32 Index ) throw(lan
else
{
Index -= 4;
- const sdr::glue::List* pList = mpObject->GetGluePointList(false);
- const sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector());
+ const sdr::glue::GluePointVector aGluePointVector(rProvider.getUserGluePointVector());
- if(pList && Index < (sal_Int32)aGluePointVector.size())
+ if(Index < (sal_Int32)aGluePointVector.size())
{
- const sdr::glue::Point* pCandidate = aGluePointVector[Index];
+ const sdr::glue::GluePoint* pCandidate = aGluePointVector[Index];
if(pCandidate)
{
@@ -498,14 +411,6 @@ uno::Any SAL_CALL SvxUnoGluePointAccess::getByIndex( sal_Int32 Index ) throw(lan
{
OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty entries (!)");
}
-
- // TTTT:GLUE
- //rTempPoint = (*pList)[(sal_uInt32)Index];
- //aGluePoint.IsUserDefined = sal_True;
- //convert( rTempPoint, aGluePoint );
- //uno::Any aAny;
- //aAny <<= aGluePoint;
- //return aAny;
}
}
}
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index bbf2ef2695a3..e61b2ea2b08b 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -1262,37 +1262,7 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir )
{
// move handle with index nHandleIndex
pSdrView->MoveHandleByVector(*pHdl, basegfx::B2DVector(nX, nY), 0, 0);
-
- // TTTT:HANDLE
- //// now move the Handle (nX, nY)
- //const basegfx::B2DPoint aStartPoint(pHdl->getPosition());
- //const basegfx::B2DPoint aEndPoint(aStartPoint + basegfx::B2DPoint(nX, nY));
- //const SdrDragStat& rDragStat = pSdrView->GetDragStat();
- //
- //// start dragging
- //pSdrView->BegDragObj(aStartPoint, pHdl, 0.0);
- //
- //if(pSdrView->IsDragObj())
- //{
- // const bool bWasNoSnap(rDragStat.IsNoSnap());
- // const bool bWasSnapEnabled(pSdrView->IsSnapEnabled());
- //
- // // switch snapping off
- // if(!bWasNoSnap)
- // ((SdrDragStat&)rDragStat).SetNoSnap(true);
- // if(bWasSnapEnabled)
- // pSdrView->SetSnapEnabled(false);
- //
- // pSdrView->MovAction(aEndPoint);
- // pSdrView->EndDragObj();
- rSh.SetModified();
-
- // // restore snap
- // if(!bWasNoSnap)
- // ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
- // if(bWasSnapEnabled)
- // pSdrView->SetSnapEnabled(bWasSnapEnabled);
- //}
+ rSh.SetModified();
}
}
}