summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-10-04 16:20:25 +0000
committerArmin Le Grand <alg@apache.org>2013-10-04 16:20:25 +0000
commitcfc0a1aaae0ee8454d0f84c7307228a0f6f959f5 (patch)
tree77e81db3fa2edf833cb0f7127d0f0ab2ca449021
parent14a9ddcf6966a9c49e188189051968f5f01f01b3 (diff)
GluePoint reworks (all in unit coordinates), needs more checks
-rw-r--r--basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx7
-rw-r--r--basegfx/source/matrix/b2dhommatrixtools.cxx32
-rw-r--r--filter/source/msfilter/escherex.cxx47
-rw-r--r--filter/source/msfilter/msdffimp.cxx122
-rw-r--r--offapi/com/sun/star/drawing/EscapeDirection.idl47
-rw-r--r--sd/inc/pch/precompiled_sd.hxx2
-rw-r--r--sd/source/ui/dlg/gluectrl.cxx19
-rw-r--r--sd/source/ui/dlg/sdtreelb.cxx10
-rw-r--r--sd/source/ui/func/fuediglu.cxx30
-rw-r--r--sd/source/ui/inc/sdtreelb.hxx4
-rw-r--r--sd/source/ui/view/drviews7.cxx27
-rw-r--r--sd/source/ui/view/sdview3.cxx48
-rw-r--r--svx/Library_svxcore.mk2
-rw-r--r--svx/Package_inc.mk2
-rwxr-xr-xsvx/inc/svx/sdrglue.hxx197
-rwxr-xr-xsvx/inc/svx/sdrobjecttools.hxx57
-rw-r--r--svx/inc/svx/svdglev.hxx27
-rw-r--r--svx/inc/svx/svdglue.hxx252
-rw-r--r--svx/inc/svx/svdoashp.hxx8
-rw-r--r--svx/inc/svx/svdobj.hxx14
-rw-r--r--svx/inc/svx/svdoedge.hxx14
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx59
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobj.cxx32
-rwxr-xr-xsvx/source/svdraw/sdrglue.cxx554
-rwxr-xr-xsvx/source/svdraw/sdrobjecttools.cxx157
-rw-r--r--svx/source/svdraw/sdrselection.cxx4
-rw-r--r--svx/source/svdraw/svdcrtv.cxx7
-rw-r--r--svx/source/svdraw/svddrgmt.cxx152
-rw-r--r--svx/source/svdraw/svddrgv.cxx22
-rw-r--r--svx/source/svdraw/svdedtv1.cxx17
-rw-r--r--svx/source/svdraw/svdglev.cxx378
-rw-r--r--svx/source/svdraw/svdglue.cxx546
-rw-r--r--svx/source/svdraw/svdmrkv.cxx23
-rw-r--r--svx/source/svdraw/svdmrkv1.cxx226
-rw-r--r--svx/source/svdraw/svdoashp.cxx180
-rw-r--r--svx/source/svdraw/svdobj.cxx96
-rw-r--r--svx/source/svdraw/svdoedge.cxx229
-rw-r--r--svx/source/svdraw/svdpntv.cxx30
-rw-r--r--svx/source/svdraw/svdpoev.cxx2
-rw-r--r--svx/source/unodraw/gluepts.cxx468
-rw-r--r--svx/source/unodraw/unoshap2.cxx8
41 files changed, 2472 insertions, 1686 deletions
diff --git a/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx b/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx
index 0733af8fb54c..003064889287 100644
--- a/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx
+++ b/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx
@@ -174,6 +174,13 @@ namespace basegfx
const B2DHomMatrix& rSource,
const B2DRange& rRange);
+ // eventually correct the scaling of the given matrix to be not zero. If the
+ // scaling is zero in X and/or Y, it gets corrected to the given default values
+ B2DHomMatrix guaranteeMinimalScaling(
+ const B2DHomMatrix& rSource,
+ double fDefaultScaleX = 1.0,
+ double fDefaultScaleY = 1.0);
+
/* tooling methods for converting API matrices (drawing::HomogenMatrix3)
to B2DHomMatrix
*/
diff --git a/basegfx/source/matrix/b2dhommatrixtools.cxx b/basegfx/source/matrix/b2dhommatrixtools.cxx
index 7a5526f030c8..9afd333b0c3b 100644
--- a/basegfx/source/matrix/b2dhommatrixtools.cxx
+++ b/basegfx/source/matrix/b2dhommatrixtools.cxx
@@ -511,6 +511,38 @@ namespace basegfx
return rSource * createScaleTranslateB2DHomMatrix(aSize, aPos);
}
+ /// adapt given transformation to absolute scale given by the B2DRange. This
+ /// means that rRange.getRange() is used as scale and rRange.getMinimum() is
+ /// used as translation; mirrorings, shear and rotation will be preserved from
+ /// the given transformation
+ B2DHomMatrix guaranteeMinimalScaling(
+ const B2DHomMatrix& rSource,
+ double fDefaultScaleX,
+ double fDefaultScaleY)
+ {
+ const bool bZeroX(fTools::equalZero(rSource.get(0, 0)));
+ const bool bZeroY(fTools::equalZero(rSource.get(1, 1)));
+
+ if(!bZeroX && !bZeroY)
+ {
+ return rSource;
+ }
+
+ B2DHomMatrix aCorrected(rSource);
+
+ if(bZeroX)
+ {
+ aCorrected.set(0, 0, fDefaultScaleX);
+ }
+
+ if(bZeroY)
+ {
+ aCorrected.set(1, 1, fDefaultScaleY);
+ }
+
+ return aCorrected;
+ }
+
/* tooling methods for converting API matrices (drawing::HomogenMatrix3)
to B2DHomMatrix
*/
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 1931d512f537..8c8d06a12132 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -4806,23 +4806,50 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst )
if ( nGluePointType == com::sun::star::drawing::EnhancedCustomShapeGluePointType::CUSTOM )
{
- const SdrGluePointList* pList = pCustoShape->GetGluePointList();
- if ( pList )
+ const sdr::glue::List* pList = pCustoShape->GetGluePointList(false);
+ const sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector());
+
+ if(aGluePointVector.size())
{
Polygon aPoly;
- sal_uInt16 nNum, nAnz = pList->GetCount();
- if ( nAnz )
+
+ for(sal_uInt32 a(0); a < aGluePointVector.size(); a++)
{
- for ( nNum = 0; nNum < nAnz; nNum++ )
+ const sdr::glue::Point* pCandidate = aGluePointVector[a];
+
+ if(pCandidate)
{
- const SdrGluePoint& 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())) );
+ const basegfx::B2DPoint aPt(pCustoShape->getSdrObjectTransformation() * pCandidate->getUnitPosition());
+
+ aPoly.Insert(POLY_APPEND, Point(basegfx::fround(aPt.getX()), basegfx::fround(aPt.getY())));
+ }
+ else
+ {
+ OSL_ENSURE(false, "Got sdr::glue::PointVector with empty entries (!)");
}
- nRule = GetClosestPoint( aPoly, aRefPoint );
- bRectangularConnection = false;
}
+
+ 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 801db013fe64..fc152780cfc1 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -471,11 +471,11 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
if ( pO )
{
Any aAny;
- SdrGluePoint aGluePoint;
+ sdr::glue::Point aGluePoint;
Reference< XShape > aXShape( pO->getUnoShape(), UNO_QUERY );
Reference< XShape > aXConnector( pPtr->pCObj->getUnoShape(), UNO_QUERY );
- SdrGluePointList* pList = pO->ForceGluePointList();
-
+ sdr::glue::List* pList = pO->GetGluePointList(true);
+ sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector());
sal_Bool bValidGluePoint = sal_False;
sal_Int32 nId = nC;
sal_uInt32 nInventor = pO->GetObjInventor();
@@ -524,52 +524,78 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
break;
case OBJ_POLY :
{
- if ( pList && ( pList->GetCount() > nC ) )
+ // TTTT:GLUE if ( pList && ( pList->GetCount() > nC ) )
+ if(aGluePointVector.size() > nC)
{
- bValidGluePoint = sal_True;
- nId = (sal_Int32)((*pList)[ (sal_uInt16)nC].GetId() + 3 );
+ const sdr::glue::Point* pCandidate = aGluePointVector[nC];
+
+ if(pCandidate)
+ {
+ nId = pCandidate->getID() + 4;
+ bValidGluePoint = sal_True;
+ }
+ else
+ {
+ OSL_ENSURE(false, "Got sdr::glue::PointVector with empty entries (!)");
+ }
+
+ // TTTT:GLUE
+ //bValidGluePoint = sal_True;
+ //nId = (sal_Int32)((*pList)[ (sal_uInt16)nC].GetId() + 3 );
}
else
{
sal_Bool bNotFound = sal_True;
-
PolyPolygon aPolyPoly( EscherPropertyContainer::GetPolyPolygon( aXShape ) );
sal_uInt16 k, j, nPolySize = aPolyPoly.Count();
+
if ( nPolySize )
{
sal_uInt32 nPointCount = 0;
Rectangle aBoundRect( aPolyPoly.GetBoundRect() );
+
if ( aBoundRect.GetWidth() && aBoundRect.GetHeight() )
{
for ( k = 0; bNotFound && ( k < nPolySize ); k++ )
{
const Polygon& rPolygon = aPolyPoly.GetObject( k );
+
for ( j = 0; bNotFound && ( j < rPolygon.GetSize() ); j++ )
{
PolyFlags eFlags = rPolygon.GetFlags( j );
+
if ( eFlags == POLY_NORMAL )
{
if ( nC == nPointCount )
{
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.SetEscDir( SDRESC_SMART );
- nId = (sal_Int32)((*pList)[ pList->Insert( aGluePoint ) ].GetId() + 3 );
+ 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)));
+ 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++;
}
@@ -606,11 +632,27 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
}
if ( nGluePointType == EnhancedCustomShapeGluePointType::CUSTOM )
{
- if ( pList && ( pList->GetCount() > nC ) )
+ if(aGluePointVector.size() > nC)
{
- bValidGluePoint = sal_True;
- nId = (sal_Int32)((*pList)[ (sal_uInt16)nC].GetId() + 3 );
+ const sdr::glue::Point* pCandidate = aGluePointVector[nC];
+
+ if(pCandidate)
+ {
+ nId = pCandidate->getID() + 4;
+ bValidGluePoint = sal_True;
+ }
+ else
+ {
+ OSL_ENSURE(false, "Got sdr::glue::PointVector 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 )
{
@@ -732,9 +774,29 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
aGeometryItem.SetPropertyValue( sPath, aProp );
bValidGluePoint = sal_True;
((SdrObjCustomShape*)pO)->SetMergedItem( aGeometryItem );
- SdrGluePointList* pLst = pO->ForceGluePointList();
- if ( (sal_Int32)pLst->GetCount() > nGluePoints )
- nId = (sal_Int32)((*pLst)[ (sal_uInt16)nGluePoints ].GetId() + 3 );
+
+ // 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)
+ {
+ const sdr::glue::Point* pCandidate = aGPVector[nGluePoints];
+
+ if(pCandidate)
+ {
+ nId = pCandidate->getID() + 4;
+ }
+ else
+ {
+ OSL_ENSURE(false, "Got sdr::glue::PointVector 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/offapi/com/sun/star/drawing/EscapeDirection.idl b/offapi/com/sun/star/drawing/EscapeDirection.idl
index 18dad9761dd3..04ffcfdea9b9 100644
--- a/offapi/com/sun/star/drawing/EscapeDirection.idl
+++ b/offapi/com/sun/star/drawing/EscapeDirection.idl
@@ -30,8 +30,9 @@
//=============================================================================
-/** This enumeration defines the escape direction a connector takes on
- a glue point.
+/** This enumeration defines the escape direction a connector can take
+ a glue point. More than one direction may be allowed. When all
+ directions are allowed, SMART is used.
*/
published enum EscapeDirection
{
@@ -56,12 +57,50 @@ published enum EscapeDirection
DOWN,
//-------------------------------------------------------------------------
- // DOCUMENTATION OMITTED FOR EscapeDirection:: HORIZONTAL
+ // DOCUMENTATION OMITTED FOR EscapeDirection:: HORIZONTAL (LEFT & RIGHT)
HORIZONTAL,
//-------------------------------------------------------------------------
- // DOCUMENTATION OMITTED FOR EscapeDirection:: VERTICAL
+ // DOCUMENTATION OMITTED FOR EscapeDirection:: VERTICAL (UP & DOWN)
VERTICAL
+
+ // As can be seen when looking at HORIZONTAL and VERTICAL the true meaning of
+ // this EscapeDirection is a combination of LEFT/RIGHT/UP/DOWN describing all
+ // allowed escape directions from which the router may choose the best one. To
+ // allow this the following incompatible expansion would be needed:
+ //
+ // //-------------------------------------------------------------------------
+ // // DOCUMENTATION OMITTED FOR EscapeDirection:: UPWARD (LEFT & UP)
+ // LEFTUP,
+ //
+ // //-------------------------------------------------------------------------
+ // // DOCUMENTATION OMITTED FOR EscapeDirection:: UPWARD (UP & RIGHT)
+ // UPRIGHT,
+ //
+ // //-------------------------------------------------------------------------
+ // // DOCUMENTATION OMITTED FOR EscapeDirection:: UPWARD (RIGHT & DOWN)
+ // RIGHTDOWN,
+ //
+ // //-------------------------------------------------------------------------
+ // // DOCUMENTATION OMITTED FOR EscapeDirection:: DOWNLEFT (DOWN & LEFT)
+ // DOWNLEFT,
+ //
+ // //-------------------------------------------------------------------------
+ // // DOCUMENTATION OMITTED FOR EscapeDirection:: UPWARD (LEFT & UP & RIGHT)
+ // UPWARD,
+ //
+ // //-------------------------------------------------------------------------
+ // // DOCUMENTATION OMITTED FOR EscapeDirection:: RIGHTWARD (UP & RIGHT & DOWN)
+ // RIGHTWARD,
+ //
+ // //-------------------------------------------------------------------------
+ // // DOCUMENTATION OMITTED FOR EscapeDirection:: DOWNWARD (RIGHT & DOWN & LEFT)
+ // DOWNWARD,
+ //
+ // //-------------------------------------------------------------------------
+ // // DOCUMENTATION OMITTED FOR EscapeDirection:: LEFTWARD (DOWN & LEFT & UP)
+ // LEFTWARD
+
};
//=============================================================================
diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx
index 6329ed0ca750..83b473275db0 100644
--- a/sd/inc/pch/precompiled_sd.hxx
+++ b/sd/inc/pch/precompiled_sd.hxx
@@ -672,7 +672,7 @@
#include "svx/svddef.hxx"
#include "svx/svdetc.hxx"
#include "editeng/measfld.hxx"
-#include "svx/svdglue.hxx"
+#include "svx/sdrglue.hxx"
#include "svx/svditer.hxx"
#include "svx/svdlayer.hxx"
#include "svx/svdoashp.hxx"
diff --git a/sd/source/ui/dlg/gluectrl.cxx b/sd/source/ui/dlg/gluectrl.cxx
index 8f2742af775a..72d2081b9dc6 100644
--- a/sd/source/ui/dlg/gluectrl.cxx
+++ b/sd/source/ui/dlg/gluectrl.cxx
@@ -28,7 +28,7 @@
#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
#include <svx/dialogs.hrc>
-#include <svx/svdglue.hxx>
+#include <svx/sdrglue.hxx>
#include <svl/intitem.hxx>
#include <sfx2/app.hxx>
#include <sfx2/dispatch.hxx>
@@ -48,18 +48,11 @@ using namespace ::com::sun::star::frame;
#define ESCDIR_COUNT 5
static sal_uInt16 aEscDirArray[] =
{
- SDRESC_SMART,
- SDRESC_LEFT,
- SDRESC_RIGHT,
- SDRESC_TOP,
- SDRESC_BOTTOM,
-// SDRESC_LO,
-// SDRESC_LU,
-// SDRESC_RO,
-// SDRESC_RU,
-// SDRESC_HORZ,
-// SDRESC_VERT,
-// SDRESC_ALL
+ 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
};
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index c8cdf819bd22..e49181d35717 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -86,6 +86,16 @@ public:
bool SD_DLLPRIVATE SdPageObjsTLB::bIsInDrag = false;
+void SdPageObjsTLB::SetViewFrame( SfxViewFrame* pViewFrame )
+{
+ mpFrame = pViewFrame;
+}
+
+bool SdPageObjsTLB::IsLinkableSelected() const
+{
+ return mbLinkableSelected;
+}
+
bool SdPageObjsTLB::IsInDrag()
{
return bIsInDrag;
diff --git a/sd/source/ui/func/fuediglu.cxx b/sd/source/ui/func/fuediglu.cxx
index f6af21597913..725d22616540 100644
--- a/sd/source/ui/func/fuediglu.cxx
+++ b/sd/source/ui/func/fuediglu.cxx
@@ -27,7 +27,7 @@
#include "fuediglu.hxx"
#include <svl/eitem.hxx>
#include <svx/dialogs.hrc>
-#include <svx/svdglue.hxx>
+#include <svx/sdrglue.hxx>
#include <sfx2/request.hxx>
@@ -381,29 +381,29 @@ void FuEditGluePoints::ReceiveRequest(SfxRequest& rReq)
case SID_GLUE_ESCDIR_LEFT:
{
- mpView->SetMarkedGluePointsEscDir( SDRESC_LEFT,
- !mpView->IsMarkedGluePointsEscDir( SDRESC_LEFT ) );
+ mpView->SetMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_LEFT,
+ !mpView->IsMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_LEFT ) );
}
break;
case SID_GLUE_ESCDIR_RIGHT:
{
- mpView->SetMarkedGluePointsEscDir( SDRESC_RIGHT,
- !mpView->IsMarkedGluePointsEscDir( SDRESC_RIGHT ) );
+ mpView->SetMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_RIGHT,
+ !mpView->IsMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_RIGHT ) );
}
break;
case SID_GLUE_ESCDIR_TOP:
{
- mpView->SetMarkedGluePointsEscDir( SDRESC_TOP,
- !mpView->IsMarkedGluePointsEscDir( SDRESC_TOP ) );
+ mpView->SetMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_TOP,
+ !mpView->IsMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_TOP ) );
}
break;
case SID_GLUE_ESCDIR_BOTTOM:
{
- mpView->SetMarkedGluePointsEscDir( SDRESC_BOTTOM,
- !mpView->IsMarkedGluePointsEscDir( SDRESC_BOTTOM ) );
+ mpView->SetMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM,
+ !mpView->IsMarkedGluePointsEscDir( sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM ) );
}
break;
@@ -418,37 +418,37 @@ void FuEditGluePoints::ReceiveRequest(SfxRequest& rReq)
case SID_GLUE_HORZALIGN_CENTER:
{
- mpView->SetMarkedGluePointsAlign(false, SDRHORZALIGN_CENTER);
+ mpView->SetMarkedGluePointsAlign(false, sdr::glue::Point::Alignment_Center);
}
break;
case SID_GLUE_HORZALIGN_LEFT:
{
- mpView->SetMarkedGluePointsAlign(false, SDRHORZALIGN_LEFT);
+ mpView->SetMarkedGluePointsAlign(false, sdr::glue::Point::Alignment_Minimum);
}
break;
case SID_GLUE_HORZALIGN_RIGHT:
{
- mpView->SetMarkedGluePointsAlign(false, SDRHORZALIGN_RIGHT);
+ mpView->SetMarkedGluePointsAlign(false, sdr::glue::Point::Alignment_Maximum);
}
break;
case SID_GLUE_VERTALIGN_CENTER:
{
- mpView->SetMarkedGluePointsAlign(true, SDRVERTALIGN_CENTER);
+ mpView->SetMarkedGluePointsAlign(true, sdr::glue::Point::Alignment_Center);
}
break;
case SID_GLUE_VERTALIGN_TOP:
{
- mpView->SetMarkedGluePointsAlign(true, SDRVERTALIGN_TOP);
+ mpView->SetMarkedGluePointsAlign(true, sdr::glue::Point::Alignment_Minimum);
}
break;
case SID_GLUE_VERTALIGN_BOTTOM:
{
- mpView->SetMarkedGluePointsAlign(true, SDRVERTALIGN_BOTTOM);
+ mpView->SetMarkedGluePointsAlign(true, sdr::glue::Point::Alignment_Maximum);
}
break;
}
diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx
index 4f234bb00dfb..f321dedee24a 100644
--- a/sd/source/ui/inc/sdtreelb.hxx
+++ b/sd/source/ui/inc/sdtreelb.hxx
@@ -196,7 +196,7 @@ public:
virtual void SelectHdl();
virtual void KeyInput( const KeyEvent& rKEvt );
- void SetViewFrame( SfxViewFrame* pViewFrame ) { mpFrame = pViewFrame; }
+ void SetViewFrame( SfxViewFrame* pViewFrame );
SfxViewFrame* GetViewFrame() const { return mpFrame; }
void Fill( const SdDrawDocument*, bool bAllPages, const String& rDocName );
@@ -211,7 +211,7 @@ public:
SdDrawDocument* GetBookmarkDoc(SfxMedium* pMedium = NULL);
::sd::DrawDocShell* GetDropDocSh() { return(mpDropDocSh); }
- bool IsLinkableSelected() const { return mbLinkableSelected; }
+ bool IsLinkableSelected() const;
static bool IsInDrag();
using SvLBox::ExecuteDrop;
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 77dd335902c6..5aa45c5db044 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -459,15 +459,18 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
else
{
// Horizontale Ausrichtung
- sal_uInt16 nHorz = mpDrawView->GetMarkedGluePointsAlign( false );
- rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_CENTER, nHorz == SDRHORZALIGN_CENTER ) );
- rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_LEFT, nHorz == SDRHORZALIGN_LEFT ) );
- rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_RIGHT, nHorz == SDRHORZALIGN_RIGHT ) );
+ const sdr::glue::Point::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 ) );
+
// Vertikale Ausrichtung
- sal_uInt16 nVert = mpDrawView->GetMarkedGluePointsAlign( true );
- rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_CENTER, nVert == SDRVERTALIGN_CENTER ) );
- rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_TOP, nVert == SDRVERTALIGN_TOP ) );
- rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_BOTTOM, nVert == SDRVERTALIGN_BOTTOM ) );
+ const sdr::glue::Point::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 ) );
}
// Punkt einfuegen
@@ -475,25 +478,25 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
// Autrittsrichtung
// Links
- eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_LEFT );
+ eState = mpDrawView->IsMarkedGluePointsEscDir( sdr::glue::Point::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( SDRESC_RIGHT );
+ eState = mpDrawView->IsMarkedGluePointsEscDir( sdr::glue::Point::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( SDRESC_TOP );
+ eState = mpDrawView->IsMarkedGluePointsEscDir( sdr::glue::Point::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( SDRESC_BOTTOM );
+ eState = mpDrawView->IsMarkedGluePointsEscDir( sdr::glue::Point::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 814edcda2f79..dcaa73afd8da 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -547,18 +547,28 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
else
{
// set position of connection point of original connected object
- const SdrGluePointList* pGlueList = pConnObj->GetGluePointList();
+ const sdr::glue::List* pGlueList = pConnObj->GetGluePointList(false);
if(pGlueList)
{
- sal_uInt32 nInd = pGlueList->FindGluePoint(rConn0.GetConnectorId());
+ const sdr::glue::Point* pCandidate = pGlueList->findByID(rConn0.GetConnectorId());
- if(SDRGLUEPOINT_NOTFOUND != nInd)
+ if(pCandidate)
{
- const SdrGluePoint& rGluePoint = (*pGlueList)[nInd];
- basegfx::B2DPoint aPosition = rGluePoint.GetAbsolutePos(sdr::legacy::GetSnapRange(*pConnObj));
- aPosition += aVector;
- pCloneEdge->SetTailPoint(false, aPosition);
+ const basegfx::B2DPoint aPosition(pConnObj->getSdrObjectTransformation() * pCandidate->getUnitPosition());
+
+ 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);
+ //}
}
}
}
@@ -578,18 +588,28 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
else
{
// set position of connection point of original connected object
- const SdrGluePointList* pGlueList = pConnObj->GetGluePointList();
+ const sdr::glue::List* pGlueList = pConnObj->GetGluePointList(false);
if(pGlueList)
{
- sal_uInt32 nInd = pGlueList->FindGluePoint(rConn1.GetConnectorId());
+ const sdr::glue::Point* pCandidate = pGlueList->findByID(rConn1.GetConnectorId());
- if(SDRGLUEPOINT_NOTFOUND != nInd)
+ if(pCandidate)
{
- const SdrGluePoint& rGluePoint = (*pGlueList)[nInd];
- basegfx::B2DPoint aPosition = rGluePoint.GetAbsolutePos(sdr::legacy::GetSnapRange(*pConnObj));
- aPosition += aVector;
- pCloneEdge->SetTailPoint(true, aPosition);
+ const basegfx::B2DPoint aPosition(pConnObj->getSdrObjectTransformation() * pCandidate->getUnitPosition());
+
+ 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 94dc19bc26e7..7e0925d8a0b9 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -304,6 +304,7 @@ $(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 \
@@ -317,7 +318,6 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/svdraw/svdetc \
svx/source/svdraw/svdfmtf \
svx/source/svdraw/svdglev \
- svx/source/svdraw/svdglue \
svx/source/svdraw/svdhdl \
svx/source/svdraw/svdhlpln \
svx/source/svdraw/svdibrow \
diff --git a/svx/Package_inc.mk b/svx/Package_inc.mk
index 98b9bec742f8..2d10034cc00f 100644
--- a/svx/Package_inc.mk
+++ b/svx/Package_inc.mk
@@ -315,6 +315,7 @@ $(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))
@@ -358,7 +359,6 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdetc.hxx,svx/svdetc.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdfield.hxx,svx/svdfield.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdglev.hxx,svx/svdglev.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdglob.hxx,svx/svdglob.hxx))
-$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdglue.hxx,svx/svdglue.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdhdl.hxx,svx/svdhdl.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdhlpln.hxx,svx/svdhlpln.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svditer.hxx,svx/svditer.hxx))
diff --git a/svx/inc/svx/sdrglue.hxx b/svx/inc/svx/sdrglue.hxx
new file mode 100755
index 000000000000..e048b2f9182f
--- /dev/null
+++ b/svx/inc/svx/sdrglue.hxx
@@ -0,0 +1,197 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef _SDRGLUE_HXX
+#define _SDRGLUE_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include "svx/svxdllapi.h"
+#include <com/sun/star/drawing/GluePoint2.hpp>
+#include <set>
+#include <vector>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace glue
+ {
+ class SVX_DLLPUBLIC Point
+ {
+ public:
+ // defines for GluePoint alignment (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 List access to setID()
+ friend class List;
+
+ // position in unit coordinates [0.0 .. 1.0] in X,Y
+ 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 Points in one list need unique identifiers
+ // and will be sorted by these. This is administrated by the List 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 points from the ones from CustomShapes
+ bool mbUserDefined : 1;
+
+ // write access to ID is limited to list class only
+ void setID(sal_uInt32 nNew) { maID = nNew; }
+
+ // write access to scale adaption to list class only
+ void adaptToChangedScale(const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale);
+ protected:
+ public:
+ Point(
+ 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
+ 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 sizes of the object the GluePoint belongs to. The converter to
+ // sdr::glue::Point is implemented as constructor
+ com::sun::star::drawing::GluePoint2 convertToGluePoint2(
+ const basegfx::B2DVector& rAbsoluteScale) const;
+ Point(
+ const com::sun::star::drawing::GluePoint2& rGluePoint2,
+ const basegfx::B2DVector& rAbsoluteScale);
+ };
+ } // end of namespace glue
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace glue
+ {
+ // sort by ID
+ struct PointComparator
+ {
+ bool operator()(const Point& rA, const Point& rB) const;
+ };
+
+ // typedef for point set
+ typedef ::std::set< Point, PointComparator > PointSet;
+ typedef ::std::vector< Point* > PointVector;
+
+ class SVX_DLLPUBLIC List
+ {
+ private:
+ // the GluePoint set
+ PointSet maPointSet;
+
+ protected:
+ public:
+ List()
+ : maPointSet()
+ {
+ }
+
+ // add new Point, it gets a new ID assigned and a reference to the
+ // new instance (copied to list) is returned. It will assert when
+ // already added
+ Point& add(const Point& rNew);
+
+ // remove Point (will assert if not added)
+ void remove(const Point& rNew);
+
+ // find by ID
+ Point* findByID(sal_uInt32 nID) const;
+
+ // get vector of Points (pointers to the real points)
+ PointVector getVector() const;
+
+ // adapt to changed absolute scale, e.g. when not relative and alignments have to be addressed
+ void adaptToChangedScale(const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale);
+ };
+ } // end of namespace glue
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDRGLUE_HXX
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/inc/svx/sdrobjecttools.hxx b/svx/inc/svx/sdrobjecttools.hxx
new file mode 100755
index 000000000000..c303ecd536c4
--- /dev/null
+++ b/svx/inc/svx/sdrobjecttools.hxx
@@ -0,0 +1,57 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef _SVDOBJ_TOOLS_HXX
+#define _SVDOBJ_TOOLS_HXX
+
+#include "svx/svxdllapi.h"
+#include <svx/svdobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class SdrPathObj;
+
+//////////////////////////////////////////////////////////////////////////////
+// defines
+
+enum DefaultSdrPathObjType
+{
+ DefaultSdrPathObjType_Line, // SID_DRAW_LINE, SID_DRAW_XLINE, SID_LINE_ARROW_START, SID_LINE_ARROW_END, SID_LINE_ARROWS, SID_LINE_ARROW_CIRCLE, SID_LINE_CIRCLE_ARROW, SID_LINE_ARROW_SQUARE, SID_LINE_SQUARE_ARROW
+ DefaultSdrPathObjType_BezierFill, // SID_DRAW_BEZIER_FILL
+ DefaultSdrPathObjType_Bezier, // SID_DRAW_BEZIER_NOFILL
+ DefaultSdrPathObjType_Freeline, // SID_DRAW_FREELINE, SID_DRAW_FREELINE_NOFILL
+ DefaultSdrPathObjType_Polygon, // SID_DRAW_POLYGON, SID_DRAW_POLYGON_NOFILL
+ DefaultSdrPathObjType_XPolygon, // SID_DRAW_XPOLYGON, SID_DRAW_XPOLYGON_NOFILL
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// helper for constructing views to create default geometries for diverse kinds of
+// SdrPathObjs, as used e.g. in pressing CTRL-Tab in keyboard toolbar navigation
+
+void SVX_DLLPUBLIC initializeDefaultSdrPathObjByObjectType(SdrPathObj& rObj, DefaultSdrPathObjType eType, const basegfx::B2DRange& rRange, bool bClose);
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDOBJ_TOOLS_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/inc/svx/svdglev.hxx b/svx/inc/svx/svdglev.hxx
index 1abdd95bb737..81ed0a84b235 100644
--- a/svx/inc/svx/svdglev.hxx
+++ b/svx/inc/svx/svdglev.hxx
@@ -19,8 +19,6 @@
*
*************************************************************/
-
-
#ifndef _SVDGLEV_HXX
#define _SVDGLEV_HXX
@@ -30,7 +28,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
// predefines
-class SdrGluePoint;
+class sdr::glue::Point;
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -39,10 +37,10 @@ class SVX_DLLPUBLIC SdrGlueEditView: public SdrPolyEditView
private:
// Markierte Klebepunkte kopieren und anstelle der alten markieren
void ImpCopyMarkedGluePoints();
- typedef void (*PGlueDoFunc)(SdrGluePoint&, const SdrObject* pObj, const void*, const void*, const void*, const void*, const void*);
- typedef void (*PGlueTrFunc)(basegfx::B2DPoint&, const void*, const void*, const void*, const void*, const void*);
+ 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*);
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(PGlueTrFunc pTrFunc, 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);
protected:
// #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
@@ -53,7 +51,8 @@ public:
// Durch den Parameter nThisEsc uebergibt man die Richtung, die man
// checken bzw. setzen/loeschen will.
// Moegliche Werte fuer nThisEsc sind z.Zt.
- // SDRESC_LEFT, SDRESC_RIGHT, SDRESC_TOP und SDRESC_BOTTOM
+ // ESCAPE_DIRECTION_LEFT, ESCAPE_DIRECTION_RIGHT,
+ // ESCAPE_DIRECTION_TOP und ESCAPE_DIRECTION_BOTTOM
TRISTATE IsMarkedGluePointsEscDir(sal_uInt16 nThisEsc) const;
void SetMarkedGluePointsEscDir(sal_uInt16 nThisEsc, bool bOn);
bool IsSetMarkedGluePointsEscDirPossible() const { return !IsReadOnly() && areGluesSelected(); }
@@ -74,16 +73,20 @@ public:
// SDRVERTALIGN_TOP
// SDRVERTALIGN_BOTTOM
// SDRVERTALIGN_DONTCARE (nur bei Get())
- sal_uInt16 GetMarkedGluePointsAlign(bool bVert) const;
- void SetMarkedGluePointsAlign(bool bVert, sal_uInt16 nAlign);
+ sdr::glue::Point::Alignment GetMarkedGluePointsAlign(bool bVert) const;
+ void SetMarkedGluePointsAlign(bool bVert, sdr::glue::Point::Alignment nAlign);
bool IsSetMarkedGluePointsAlignPossible() const { return !IsReadOnly() && areGluesSelected(); }
// Alle merkierten Klebepunkte entfernen
void DeleteMarkedGluePoints();
- 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);
+ // 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/svdglue.hxx b/svx/inc/svx/svdglue.hxx
deleted file mode 100644
index e36ea8797522..000000000000
--- a/svx/inc/svx/svdglue.hxx
+++ /dev/null
@@ -1,252 +0,0 @@
-/**************************************************************
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- *************************************************************/
-
-#ifndef _SVDGLUE_HXX
-#define _SVDGLUE_HXX
-
-#include <tools/contnr.hxx>
-#include <tools/gen.hxx>
-#include "svx/svxdllapi.h"
-#include <basegfx/point/b2dpoint.hxx>
-#include <basegfx/range/b2drange.hxx>
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace glue
- {
- class SVX_DLLPUBLIC Point
- {
- public:
- enum Alignment
- {
- Alignment_None,
- Alignment_Minimum,
- Alignment_Center,
- Alignment_Maximum
- };
-
- private:
- // position in unit coordinates [0.0 .. 1.0] in X,Y
- basegfx::B2DPoint maUnitPosition;
-
- // escape direction vector. If zero, escape direction is smart. Else
- // it will be normalized
- basegfx::B2DVector maEscapeVector;
-
- // horizontal and vertical alignments. If != Alignment_None the
- // position will change as distance from the defined anchor position.
- // If == Alignment_None position is relative
- Alignment meHorizontalAlignment;
- Alignment meVerticalAlignment;
-
- // unique identifier ID. All Points in one list need unique identifiers
- // and will be sorted by these. This is administrated by the List class
- sal_uInt32 maID;
-
- /// bitfield
-
- // needed to separate user-defined points from the ones from CustomShapes
- bool mbUserDefined : 1;
-
- // write access to ID is limited to list class only
- void setID(sal_uInt32 nNew) { maID = nNew; }
-
- protected:
- public:
- Point(
- const basegfx::B2DPoint& rUnitPosition = basegfx::B2DPoint(0.5, 0.5),
- const basegfx::B2DVector& rEscapeVector = basegfx::B2DVector(0.0, 0.0),
- Alignment eHorizontalAlignment = Alignment_None,
- Alignment eVerticalAlignment = Alignment_None,
- bool bUserDefined = true)
- : maUnitPosition(rUnitPosition),
- maEscapeVector(rEscapeVector),
- meHorizontalAlignment(eHorizontalAlignment),
- meVerticalAlignment(eVerticalAlignment),
- maID(0),
- mbUserDefined(bUserDefined)
- {
- }
-
- // get/set UnitPosition. Always in [0.0 .. 1.0] in Y and Y, will be truncated at set
- const basegfx::B2DPoint& getUnitPosition() const { return maUnitPosition; }
- void setUnitPosition(const basegfx::B2DPoint& rNew);
-
- // get/set EscapeVector. Set willl normalize the vector
- const basegfx::B2DVector& getEscapeVector() const { return maEscapeVector; }
- void setEscapeVector(const basegfx::B2DVector& rNew);
-
- // 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; }
-
- // read access to ID (write is private and limitied to list class)
- sal_uInt32 getID() const { return maID; }
- };
-
-
-
- } // end of namespace glue
-} // end of namespace sdr
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#define SDRESC_SMART 0x0000
-#define SDRESC_LEFT 0x0001
-#define SDRESC_RIGHT 0x0002
-#define SDRESC_TOP 0x0004
-#define SDRESC_BOTTOM 0x0008
-#define SDRESC_LO 0x0010 /* ni */
-#define SDRESC_LU 0x0020 /* ni */
-#define SDRESC_RO 0x0040 /* ni */
-#define SDRESC_RU 0x0080 /* ni */
-#define SDRESC_HORZ (SDRESC_LEFT|SDRESC_RIGHT)
-#define SDRESC_VERT (SDRESC_TOP|SDRESC_BOTTOM)
-#define SDRESC_ALL 0x00FF
-
-#define SDRHORZALIGN_CENTER 0x0000
-#define SDRHORZALIGN_LEFT 0x0001
-#define SDRHORZALIGN_RIGHT 0x0002
-#define SDRHORZALIGN_DONTCARE 0x0010
-#define SDRVERTALIGN_CENTER 0x0000
-#define SDRVERTALIGN_TOP 0x0100
-#define SDRVERTALIGN_BOTTOM 0x0200
-#define SDRVERTALIGN_DONTCARE 0x1000
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#define SDRGLUEPOINT_NOTFOUND 0xffffffff
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class SVX_DLLPUBLIC SdrGluePoint
-{
-private:
- // Bezugspunkt ist SdrObject::GetSnapRect().Center()
- // bNoPercent=false: Position ist -5000..5000 (1/100)% bzw. 0..10000 (je nach Align)
- // bNoPercent=true : Position ist in log Einh, rel zum Bezugspunkt
- basegfx::B2DPoint maPos;
- sal_uInt16 mnEscDir;
- sal_uInt32 mnId;
- sal_uInt16 mnAlign;
-
- /// bitfield
- bool mbNoPercent : 1;
- bool mbReallyAbsolute : 1; // Temporaer zu setzen fuer Transformationen am Bezugsobjekt
- bool mbUserDefined : 1; // #i38892#
-
-public:
- SdrGluePoint();
- SdrGluePoint(const basegfx::B2DPoint& rNewPos, bool bNewPercent = true, sal_uInt16 nNewAlign = 0);
-
- bool operator==(const SdrGluePoint& rCmpGP) const;
- bool operator!=(const SdrGluePoint& rCmpGP) const { return !operator==(rCmpGP); }
-
- const basegfx::B2DPoint& GetPos() const { return maPos; }
- void SetPos(const basegfx::B2DPoint& rNewPos) { if(maPos != rNewPos) maPos = rNewPos; }
-
- sal_uInt16 GetEscDir() const { return mnEscDir; }
- void SetEscDir(sal_uInt16 nNewEsc) { if(mnEscDir != nNewEsc) mnEscDir = nNewEsc; }
-
- sal_uInt32 GetId() const { return mnId; }
- void SetId(sal_uInt32 nNewId) { if(mnId != nNewId) mnId = nNewId; }
-
- bool IsPercent() const { return !mbNoPercent; }
- void SetPercent(bool bOn) { if(mbNoPercent == bOn) mbNoPercent = !bOn; }
-
- // Temporaer zu setzen fuer Transformationen am Bezugsobjekt
- bool IsReallyAbsolute() const { return mbReallyAbsolute; }
-
- // #i38892#
- bool IsUserDefined() const { return mbUserDefined; }
- void SetUserDefined(bool bNew) { if(mbUserDefined != bNew) mbUserDefined = bNew; }
-
- sal_uInt16 GetAlign() const { return mnAlign; }
- void SetAlign(sal_uInt16 nAlg) { if(mnAlign != nAlg) mnAlign = nAlg; }
-
- sal_uInt16 GetHorzAlign() const { return mnAlign & 0x00FF; }
- void SetHorzAlign(sal_uInt16 nAlg) { if((mnAlign & 0x00FF) != nAlg) mnAlign = (mnAlign & 0xFF00)|(nAlg & 0x00FF); }
-
- sal_uInt16 GetVertAlign() const { return mnAlign & 0xFF00; }
- void SetVertAlign(sal_uInt16 nAlg) { if((mnAlign & 0xFF00) != nAlg) mnAlign = (mnAlign & 0x00FF)|(nAlg & 0xFF00); }
-
- bool IsHit(const basegfx::B2DPoint& rPnt, double fTolLog, const basegfx::B2DRange& rObjectRange) const;
-
- basegfx::B2DPoint GetAbsolutePos(const basegfx::B2DRange& rObjectRange) const;
- void SetAbsolutePos(const basegfx::B2DPoint& rNewPos, const basegfx::B2DRange& rObjectRange);
-
- sal_Int32 GetAlignAngle() const;
- void SetAlignAngle(sal_Int32 nWink);
-
- sal_Int32 EscDirToAngle(sal_uInt16 nEsc) const;
- sal_uInt16 EscAngleToDir(sal_Int32 nWink) const;
-
- void Transform(const basegfx::B2DHomMatrix& rTransformation, const basegfx::B2DRange& rObjectRange);
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class SVX_DLLPUBLIC SdrGluePointList
-{
-private:
- typedef ::std::vector< SdrGluePoint* > SdrGluePointContainerType;
- SdrGluePointContainerType maList;
-
-protected:
- SdrGluePoint* GetObject(sal_uInt32 i) const;
-
-public:
- SdrGluePointList();
- SdrGluePointList(const SdrGluePointList& rSrcList);
- ~SdrGluePointList();
-
- void Clear();
- void operator=(const SdrGluePointList& rSrcList);
-
- sal_uInt32 GetCount() const { return maList.size(); }
-
- // Beim Insert wird dem Objekt (also dem GluePoint) automatisch eine Id zugewiesen.
- // ReturnCode ist der Index des neuen GluePoints in der Liste
- sal_uInt32 Insert(const SdrGluePoint& rGP);
- void Delete(sal_uInt32 nPos);
-
- SdrGluePoint& operator[](sal_uInt32 nPos) { return *GetObject(nPos); }
- const SdrGluePoint& operator[](sal_uInt32 nPos) const { return *GetObject(nPos); }
-
- sal_uInt32 FindGluePoint(sal_uInt32 nId) const;
- sal_uInt32 GPLHitTest(const basegfx::B2DPoint& rPnt, double fTolLog, const basegfx::B2DRange& rObjectRange, bool bBack = false) const;
-
- // Temporaer zu setzen fuer Transformationen am Bezugsobjekt
- void TransformGluePoints(const basegfx::B2DHomMatrix& rTransformation, const basegfx::B2DRange& rObjectRange);
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#endif //_SVDGLUE_HXX
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// eof
diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx
index 3bbf83539162..47f8e0e11a13 100644
--- a/svx/inc/svx/svdoashp.hxx
+++ b/svx/inc/svx/svdoashp.hxx
@@ -112,8 +112,8 @@ public:
// #i37011# centralize throw-away of render geometry
void InvalidateRenderGeometry();
- // #i38892#
- void ImpCheckCustomGluePointsAreAdded();
+ // 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,8 +216,8 @@ public:
virtual void SaveGeoData(SdrObjGeoData &rGeo) const;
virtual void RestGeoData(const SdrObjGeoData &rGeo);
- virtual const SdrGluePointList* GetGluePointList() const;
- virtual SdrGluePointList* ForceGluePointList();
+ virtual sdr::glue::List* GetGluePointList(bool bForce) const;
+ // TTTT:GLUE virtual sdr::glue::List* ForceGluePointList();
virtual void AddToHdlList(SdrHdlList& rHdlList) const;
diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx
index e8dbd2200e51..a2f2c7cbf1e1 100644
--- a/svx/inc/svx/svdobj.hxx
+++ b/svx/inc/svx/svdobj.hxx
@@ -31,8 +31,8 @@
#include <svl/lstner.hxx>
#include <vcl/timer.hxx>
#include <svx/svdsob.hxx>
-#include <svx/svdtypes.hxx> // fuer SdrLayerID
-#include <svx/svdglue.hxx> // Klebepunkte
+#include <svx/svdtypes.hxx>
+#include <svx/sdrglue.hxx>
#include <svx/xdash.hxx>
#include <svx/xpoly.hxx>
#include <svx/xenum.hxx>
@@ -212,7 +212,7 @@ class SVX_DLLPUBLIC SdrObjGeoData
public:
basegfx::B2DHomMatrix maSdrObjectTransformation;
basegfx::B2DPoint maObjectAnchor;
- SdrGluePointList* mpGPL;
+ sdr::glue::List* mpGPL;
SdrLayerID mnLayerID;
/// bitfield
@@ -232,7 +232,7 @@ class SdrObjPlusData
{
public:
SdrObjUserDataList* mpUserDataList; // applikationsspeziefische Daten
- SdrGluePointList* mpGluePoints; // Klebepunkte zum Ankleben von Objektverbindern
+ sdr::glue::List* mpGluePoints; // Klebepunkte zum Ankleben von Objektverbindern
// object name, title and description
String maObjName;
@@ -723,13 +723,13 @@ public:
// Automatische Klebepunkte:
// je 4 Scheitelpunkt- und Eckpositionen muss ein Knotenobjekt liefern
// i.d.R. 0=oben, 1=rechts, 2=unten, 3=links
- virtual SdrGluePoint GetVertexGluePoint(sal_uInt32 nNum) const;
+ virtual sdr::glue::Point GetVertexGluePoint(sal_uInt32 nNum) const;
// Liste aller Klebepunkte. Kann NULL sein.
- virtual const SdrGluePointList* GetGluePointList() const;
+ virtual sdr::glue::List* GetGluePointList(bool bForce) const;
// Nach veraendern der GluePointList muss man am Obj SendRepaintBroadcast rufen!
- virtual SdrGluePointList* ForceGluePointList();
+ // TTTT:GLUE virtual sdr::glue::List* ForceGluePointList();
/** sets the writing mode of the object's context
diff --git a/svx/inc/svx/svdoedge.hxx b/svx/inc/svx/svdoedge.hxx
index a78963b67d36..49ab65144b50 100644
--- a/svx/inc/svx/svdoedge.hxx
+++ b/svx/inc/svx/svdoedge.hxx
@@ -25,7 +25,7 @@
#define _SVDOEDGE_HXX
#include <svx/svdotext.hxx>
-#include <svx/svdglue.hxx>
+#include <svx/sdrglue.hxx>
#include <svx/svxdllapi.h>
#include <basegfx/polygon/b2dpolygon.hxx>
@@ -49,7 +49,7 @@ private:
friend class SdrCreateView;
protected:
- basegfx::B2DPoint maObjOfs; // Wird beim Draggen eines Knotens gesetzt
+ // TTTT:GLUE basegfx::B2DPoint maObjOfs; // Wird beim Draggen eines Knotens gesetzt
SdrObject* mpConnectedSdrObject; // Referenziertes Objekt
sal_uInt16 mnConnectorId; // Konnektornummer
@@ -63,7 +63,7 @@ public:
SdrObjConnection() { ResetVars(); }
void ResetVars();
- bool TakeGluePoint(SdrGluePoint& rGP, bool bSetAbsolutePos) const;
+ bool TakeGluePoint(sdr::glue::Point& rGP/* TTTT:GLUE, bool bSetAbsolutePos*/) const;
inline void SetBestConnection( bool rB ) { mbBestConnection = rB; };
inline void SetBestVertex( bool rB ) { mbBestVertex = rB; };
@@ -114,7 +114,7 @@ public:
basegfx::B2DPoint& ImpGetLineVersatzPoint(SdrEdgeLineCode eLineCode);
const basegfx::B2DPoint& ImpGetLineVersatzPoint(SdrEdgeLineCode eLineCode) const { return const_cast< SdrEdgeInfoRec* >(this)->ImpGetLineVersatzPoint(eLineCode); }
- sal_uInt16 ImpGetPolyIdx(SdrEdgeLineCode eLineCode, sal_uInt32 nPointCount) const;
+ sal_uInt32 ImpGetPolyIdx(SdrEdgeLineCode eLineCode, sal_uInt32 nPointCount) const;
bool ImpIsHorzLine(SdrEdgeLineCode eLineCode, sal_uInt32 nPointCount) const;
void ImpSetLineVersatz(SdrEdgeLineCode eLineCode, sal_uInt32 nPointCount, long nVal);
long ImpGetLineVersatz(SdrEdgeLineCode eLineCode, sal_uInt32 nPointCount) const;
@@ -212,9 +212,9 @@ public:
SdrObjConnection& GetConnection(bool bTail1) { return *(bTail1 ? &maCon1 : &maCon2); }
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
virtual sal_uInt16 GetObjIdentifier() const;
- virtual SdrGluePoint GetVertexGluePoint(sal_uInt32 nNum) const;
- virtual const SdrGluePointList* GetGluePointList() const;
- virtual SdrGluePointList* ForceGluePointList();
+ 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/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index ccf8986050a2..af10385de419 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2296,25 +2296,58 @@ SdrObject* EnhancedCustomShape2d::CreateObject( sal_Bool bLineGeometryNeededOnly
return pRet;
}
-void EnhancedCustomShape2d::ApplyGluePoints( SdrObject* pObj )
+void EnhancedCustomShape2d::ApplyGluePoints(SdrObject* pTarget)
{
- if ( pObj && seqGluePoints.getLength() )
+ if(pTarget)
{
- sal_uInt32 i, nCount = seqGluePoints.getLength();
- for ( i = 0; i < nCount; i++ )
- {
- SdrGluePoint aGluePoint;
+ const sal_uInt32 nCount(seqGluePoints.getLength());
- aGluePoint.SetPos( GetPoint( seqGluePoints[ i ], sal_True, sal_True ) );
- aGluePoint.SetPercent( sal_False );
+ if(nCount)
+ {
+ sdr::glue::List* pList = pTarget->GetGluePointList(true);
- aGluePoint.SetAlign( SDRVERTALIGN_TOP | SDRHORZALIGN_LEFT );
- aGluePoint.SetEscDir( SDRESC_SMART );
- SdrGluePointList* pList = pObj->ForceGluePointList();
- if( pList )
- /* sal_uInt16 nId = */ pList->Insert( aGluePoint );
+ if(pList)
+ {
+ // positions from GetPoint(seqGluePoints) are relative to absolute object size
+ const basegfx::B2DVector aObjectScale(
+ basegfx::absolute(pCustomShapeObj->getSdrObjectScale()));
+ const basegfx::B2DPoint aScaleToUnit(
+ basegfx::fTools::equalZero(aObjectScale.getX()) ? 1.0 : 1.0/ aObjectScale.getX(),
+ basegfx::fTools::equalZero(aObjectScale.getY()) ? 1.0 : 1.0/ aObjectScale.getY());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ const basegfx::B2DPoint aPosition(GetPoint(seqGluePoints[a], sal_True, sal_True));
+ const sdr::glue::Point aNew(
+ aPosition * aScaleToUnit,
+ sdr::glue::Point::ESCAPE_DIRECTION_SMART,
+ sdr::glue::Point::Alignment_Minimum,
+ sdr::glue::Point::Alignment_Minimum);
+
+ pList->add(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/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
index dbd8ca15d7a8..03751e16adf4 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
@@ -154,32 +154,40 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrObj::createGluePointPrimitive2DSequence() const
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
- const SdrGluePointList* pGluePointList = GetSdrObject().GetGluePointList();
+ const sdr::glue::List* pGluePointList = GetSdrObject().GetGluePointList(false);
if(pGluePointList)
{
- const sal_uInt32 nCount(pGluePointList->GetCount());
+ const sdr::glue::PointVector aGluePoints(pGluePointList->getVector());
+ const sal_uInt32 nCount(aGluePoints.size());
if(nCount)
{
- // prepare point vector
- std::vector< basegfx::B2DPoint > aGluepointVector;
+ // TTTT:GLUE
+ // prepare primitives; positions are in unit coordinates
+ const basegfx::B2DHomMatrix& rTransformation = GetSdrObject().getSdrObjectTransformation();
+ std::vector< basegfx::B2DPoint > aPointVector;
- // create GluePoint primitives. ATM these are relative to the SnapRect
- for(sal_uInt32 a(0L); a < nCount; a++)
+ for(sal_uInt32 a(0); a < nCount; a++)
{
- const SdrGluePoint& rCandidate = (*pGluePointList)[(sal_uInt16)a];
- const basegfx::B2DPoint aPosition(rCandidate.GetAbsolutePos(sdr::legacy::GetSnapRange(GetSdrObject())));
-
- aGluepointVector.push_back(aPosition);
+ const sdr::glue::Point* pCandidate = aGluePoints[a];
+
+ if(pCandidate)
+ {
+ aPointVector.push_back(rTransformation * pCandidate->getUnitPosition());
+ }
+ else
+ {
+ OSL_ENSURE(false, "sdr::glue::PointVector with empty entries (!)");
+ }
}
- if(!aGluepointVector.empty())
+ if(!aPointVector.empty())
{
const basegfx::BColor aBackPen(1.0, 1.0, 1.0);
const basegfx::BColor aRGBFrontColor(0.0, 0.0, 1.0); // COL_LIGHTBLUE
const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::MarkerArrayPrimitive2D(
- aGluepointVector,
+ aPointVector,
drawinglayer::primitive2d::createDefaultGluepoint_7x7(aBackPen, aRGBFrontColor)));
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
diff --git a/svx/source/svdraw/sdrglue.cxx b/svx/source/svdraw/sdrglue.cxx
new file mode 100755
index 000000000000..ca150b798b40
--- /dev/null
+++ b/svx/source/svdraw/sdrglue.cxx
@@ -0,0 +1,554 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdrglue.hxx>
+#include <basegfx/range/b2drange.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace glue
+ {
+ Point::Point(
+ 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 Point::getUnitPosition() const
+ {
+ return basegfx::B2DRange::getUnitB2DRange().clamp(maUnitPosition);
+ }
+
+ void Point::setUnitPosition(const basegfx::B2DPoint& rNew)
+ {
+ const basegfx::B2DPoint aClampedNew(basegfx::B2DRange::getUnitB2DRange().clamp(rNew));
+
+ if(aClampedNew != maUnitPosition)
+ {
+ maUnitPosition = aClampedNew;
+ }
+ }
+
+ void Point::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 Point::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 Point::Alignment_Minimum:
+ {
+ // anchored left
+ aChangedPos.setX((aChangedPos.getX() * fCorrectedOldX) / fCorrectedNewX);
+ break;
+ }
+ case Point::Alignment_Center:
+ {
+ aChangedPos.setX(((0.5 * fCorrectedNewX) + (fCorrectedOldX * (aChangedPos.getX() - 0.5))) / fCorrectedNewX);
+ break;
+ }
+ default: // case Point::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 Point::Alignment_Minimum:
+ {
+ // anchored left
+ aChangedPos.setY((aChangedPos.getY() * fCorrectedOldY) / fCorrectedNewY);
+ break;
+ }
+ case Point::Alignment_Center:
+ {
+ aChangedPos.setY(((0.5 * fCorrectedNewY) + (fCorrectedOldY * (aChangedPos.getY() - 0.5))) / fCorrectedNewY);
+ break;
+ }
+ default: // case Point::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 Point::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;
+ }
+
+ Point::Point(
+ 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
+ {
+ bool PointComparator::operator()(const Point& rA, const Point& rB) const
+ {
+ // sort by ID
+ return rA.getID() < rB.getID();
+ }
+
+ Point& List::add(const Point& rNew)
+ {
+ OSL_ENSURE(0 == rNew.getID(), "Someone is adding a new GluePoint which already has an ID");
+
+ if(!maPointSet.size())
+ {
+ const_cast< Point& >(rNew).setID(0);
+ maPointSet.insert(rNew);
+ return *maPointSet.begin();
+ }
+
+ PointSet::iterator aFound(maPointSet.end());
+ aFound--;
+ const_cast< Point& >(rNew).setID(aFound->getID() + 1);
+ maPointSet.insert(rNew);
+ aFound = maPointSet.end();
+ aFound--;
+
+ return *aFound;
+ }
+
+ void List::remove(const Point& rNew)
+ {
+ const PointSet::const_iterator aFound(maPointSet.find(rNew));
+
+ if(aFound == maPointSet.end())
+ {
+ // not a member
+ OSL_ENSURE(false, "GluePoint for removal not found (!)");
+ return;
+ }
+
+ maPointSet.erase(aFound);
+ }
+
+ Point* List::findByID(sal_uInt32 nID) const
+ {
+ Point aPoint;
+
+ aPoint.setID(nID);
+
+ const PointSet::const_iterator aFound(maPointSet.find(aPoint));
+
+ if(aFound == maPointSet.end())
+ {
+ return 0;
+ }
+
+ const Point& rResult = *aFound;
+
+ return &const_cast< Point& >(rResult);
+ }
+
+ PointVector List::getVector() const
+ {
+ PointVector aRetval;
+
+ aRetval.reserve(maPointSet.size());
+
+ for(PointSet::const_iterator aFound(maPointSet.begin()); aFound != maPointSet.end(); aFound++)
+ {
+ aRetval.push_back(&const_cast< Point& >(*aFound));
+ }
+
+ return aRetval;
+ }
+
+ void List::adaptToChangedScale(const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale)
+ {
+ if(!rOldScale.equal(rNewScale))
+ {
+ for(PointSet::iterator aFound(maPointSet.begin()); aFound != maPointSet.end(); aFound++)
+ {
+ aFound->adaptToChangedScale(rOldScale, rNewScale);
+ }
+ }
+ }
+
+ } // end of namespace glue
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/sdrobjecttools.cxx b/svx/source/svdraw/sdrobjecttools.cxx
new file mode 100755
index 000000000000..0589ad95836a
--- /dev/null
+++ b/svx/source/svdraw/sdrobjecttools.cxx
@@ -0,0 +1,157 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdrobjecttools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdlegacy.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+void initializeDefaultSdrPathObjByObjectType(SdrPathObj& rObj, DefaultSdrPathObjType eType, const basegfx::B2DRange& rRange, bool bClose)
+{
+ basegfx::B2DPolyPolygon aNewPolyPolygon;
+
+ switch(eType)
+ {
+ case DefaultSdrPathObjType_Line:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+
+ aInnerPoly.append(basegfx::B2DPoint(rRange.getMinX(), rRange.getCenterY()));
+ aInnerPoly.append(basegfx::B2DPoint(rRange.getMaxX(), rRange.getCenterY()));
+ aNewPolyPolygon.append(aInnerPoly);
+ break;
+ }
+ case DefaultSdrPathObjType_BezierFill:
+ {
+ const basegfx::B2DPolygon aInnerPoly(
+ basegfx::tools::createPolygonFromEllipse(
+ rRange.getCenter(),
+ rRange.getWidth() * 0.5,
+ rRange.getHeight() * 0.5));
+
+ aNewPolyPolygon.append(aInnerPoly);
+ break;
+ }
+ case DefaultSdrPathObjType_Bezier:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+ const basegfx::B2DPoint aTopLeft(rRange.getMinimum());
+ const basegfx::B2DVector aScale(rRange.getRange());
+
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(0.0, 1.0)));
+ aInnerPoly.appendBezierSegment(
+ aTopLeft + (aScale * basegfx::B2DTuple(0.25, 1.0)),
+ aTopLeft + (aScale * basegfx::B2DTuple(0.5, 1.0)),
+ aTopLeft + (aScale * basegfx::B2DTuple(0.5, 0.5)));
+ aInnerPoly.appendBezierSegment(
+ aTopLeft + (aScale * basegfx::B2DTuple(0.5, 0.0)),
+ aTopLeft + (aScale * basegfx::B2DTuple(0.75, 0.0)),
+ aTopLeft + (aScale * basegfx::B2DTuple(1.0, 0.0)));
+ aNewPolyPolygon.append(aInnerPoly);
+ break;
+ }
+ case DefaultSdrPathObjType_Freeline:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+ const basegfx::B2DPoint aTopLeft(rRange.getMinimum());
+ const basegfx::B2DVector aScale(rRange.getRange());
+
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(0.0, 1.0)));
+ aInnerPoly.appendBezierSegment(
+ aTopLeft + (aScale * basegfx::B2DTuple(0.0, 0.5)),
+ aTopLeft + (aScale * basegfx::B2DTuple(0.5, 0.25)),
+ aTopLeft + (aScale * basegfx::B2DTuple(0.5, 0.5)));
+ aInnerPoly.appendBezierSegment(
+ aTopLeft + (aScale * basegfx::B2DTuple(0.5, 0.75)),
+ aTopLeft + (aScale * basegfx::B2DTuple(1.0, 0.5)),
+ aTopLeft + (aScale * basegfx::B2DTuple(1.0, 0.0)));
+
+ if(bClose)
+ {
+ aInnerPoly.append(aTopLeft + aScale);
+ }
+
+ aNewPolyPolygon.append(aInnerPoly);
+ break;
+ }
+ case DefaultSdrPathObjType_Polygon:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+ const basegfx::B2DPoint aTopLeft(rRange.getMinimum());
+ const basegfx::B2DVector aScale(rRange.getRange());
+
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(0.1, 1.0)));
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(0.3, 0.6)));
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(0.0, 0.3)));
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(0.2, 0.0)));
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(0.6, 0.2)));
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(0.8, 0.0)));
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(0.7, 0.8)));
+ aInnerPoly.append(aTopLeft + aScale);
+
+ if(!bClose)
+ {
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(0.6, 1.0)));
+ }
+
+ aNewPolyPolygon.append(aInnerPoly);
+ break;
+ }
+ case DefaultSdrPathObjType_XPolygon:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+ const basegfx::B2DPoint aTopLeft(rRange.getMinimum());
+ const basegfx::B2DVector aScale(rRange.getRange());
+
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(0.0, 1.0)));
+ aInnerPoly.append(aTopLeft);
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(0.5, 0.0)));
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(0.5, 0.5)));
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(1.0, 0.5)));
+ aInnerPoly.append(aTopLeft + aScale);
+
+ if(!bClose)
+ {
+ aInnerPoly.append(aTopLeft + (aScale * basegfx::B2DTuple(0.7, 1.0)));
+ }
+
+ aNewPolyPolygon.append(aInnerPoly);
+ break;
+ }
+ }
+
+ if(bClose)
+ {
+ aNewPolyPolygon.setClosed(true);
+ }
+
+ rObj.setB2DPolyPolygonInObjectCoordinates(aNewPolyPolygon);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/sdrselection.cxx b/svx/source/svdraw/sdrselection.cxx
index 7a6efe5d5256..380e92310072 100644
--- a/svx/source/svdraw/sdrselection.cxx
+++ b/svx/source/svdraw/sdrselection.cxx
@@ -110,7 +110,7 @@ namespace sdr
OSL_ENSURE(pCandidate, "Missing SdrObject pointer in glue selection(!)");
bool bErase(false);
IndicesMap::iterator aNext(aIndices);
- const SdrGluePointList* pGPL = pCandidate->GetGluePointList();
+ const sdr::glue::List* pGPL = pCandidate->GetGluePointList(false);
aNext++;
@@ -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(SDRGLUEPOINT_NOTFOUND != pGPL->FindGluePoint(*aIter))
+ if(pGPL->findByID(*aIter))
{
aNewList.insert(aNewList.end(), *aIter);
}
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
index 0e0e5f82c39d..27400e1373d7 100644
--- a/svx/source/svdraw/svdcrtv.cxx
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -88,12 +88,13 @@ ImplConnectMarkerOverlay::ImplConnectMarkerOverlay(const SdrCreateView& rView, S
pTargetOverlay->add(*pNew);
maObjects.append(*pNew);
+ // TTTT:GLUE
// gluepoints
for(sal_uInt32 i(0); i < 4; i++)
{
- const SdrGluePoint aGluePoint(rObject.GetVertexGluePoint(i));
- const basegfx::B2DPoint& rPosition = aGluePoint.GetAbsolutePos(sdr::legacy::GetSnapRange(rObject));
- const basegfx::B2DRange aBigRange(rPosition - aHalfLogicSize, rPosition + aHalfLogicSize);
+ const sdr::glue::Point aGluePoint(rObject.GetVertexGluePoint(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));
pNew = new ::sdr::overlay::OverlayPolyPolygonStripedAndFilled(
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index ac6841a61abb..05d50e341971 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -531,29 +531,37 @@ void SdrDragMethod::createSdrDragEntries_GlueDrag()
for(sal_uInt32 nm(0); nm < aSelection.size(); nm++)
{
- const sdr::selection::Indices aMarkedGluePoints(getSdrView().getSelectedGluesForSelectedSdrObject(*aSelection[nm]));
+ const SdrObject* pSdrObjCandidate = aSelection[nm];
- if(aMarkedGluePoints.size())
+ if(pSdrObjCandidate)
{
- const SdrGluePointList* pGPL = aSelection[nm]->GetGluePointList();
+ const sdr::selection::Indices aMarkedGluePoints(getSdrView().getSelectedGluesForSelectedSdrObject(*pSdrObjCandidate));
- if(pGPL)
+ if(aMarkedGluePoints.size())
{
- const basegfx::B2DRange aSnapRange(sdr::legacy::GetSnapRange(*aSelection[nm]));
+ // TTTT:GLUE
+ const sdr::glue::List* pGPL = pSdrObjCandidate->GetGluePointList(false);
- for(sdr::selection::Indices::const_iterator aCurrent(aMarkedGluePoints.begin());
- aCurrent != aMarkedGluePoints.end(); aCurrent++)
+ if(pGPL)
{
- const sal_uInt32 nObjPt(*aCurrent);
- const sal_uInt32 nGlueNum(pGPL->FindGluePoint(nObjPt));
-
- if(SDRGLUEPOINT_NOTFOUND != nGlueNum)
+ for(sdr::selection::Indices::const_iterator aCurrent(aMarkedGluePoints.begin());
+ aCurrent != aMarkedGluePoints.end(); aCurrent++)
{
- aPositions.push_back((*pGPL)[nGlueNum].GetAbsolutePos(aSnapRange));
+ const sal_uInt32 nObjPt(*aCurrent);
+ const sdr::glue::Point* pCandidate = pGPL->findByID(nObjPt);
+
+ if(pCandidate)
+ {
+ aPositions.push_back(pSdrObjCandidate->getSdrObjectTransformation() * pCandidate->getUnitPosition());
+ }
}
}
}
}
+ else
+ {
+ OSL_ENSURE(false, "ObjectSelection vector with unallowed gaps (!)");
+ }
}
if(aPositions.size())
@@ -599,21 +607,10 @@ SdrObject* SdrDragMethod::GetDragObj() const
void SdrDragMethod::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
{
// use get/setSdrObjectTransformation now. This will also work when object has a path
- basegfx::B2DHomMatrix aObjectMatrix(rTarget.getSdrObjectTransformation());
-
- // check for zero-width/height objects
- if(basegfx::fTools::equalZero(aObjectMatrix.get(0, 0)))
- {
- // no width
- aObjectMatrix.set(0, 0, 1.0);
- }
-
- if(basegfx::fTools::equalZero(aObjectMatrix.get(1, 1)))
- {
- // no height
- aObjectMatrix.set(1, 1, 1.0);
- }
+ // correct to minimal scaling for zero-width/height objects
+ basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::guaranteeMinimalScaling(rTarget.getSdrObjectTransformation()));
+ // apply current transformation and set
aObjectMatrix = getCurrentTransformation() * aObjectMatrix;
rTarget.setSdrObjectTransformation(aObjectMatrix);
}
@@ -1688,52 +1685,73 @@ void SdrDragMove::MoveSdrDrag(const basegfx::B2DPoint& rPoint)
if(getSdrView().IsDraggingGluePoints() && getSdrView().areSdrObjectsSelected())
{
- // Klebepunkte aufs BoundRect des Obj limitieren
- aNewPos -= DragStat().GetStart();
+ // limit delta move to possible GluePoint move possibilities
+ const basegfx::B2DVector aOriginalAbsoluteDelta(aNewPos - DragStat().GetStart());
+ basegfx::B2DVector aNewAbsoluteDelta(aOriginalAbsoluteDelta);
const SdrObjectVector aSelection(getSdrView().getSelectedSdrObjectVectorFromSdrMarkView());
for(sal_uInt32 nMarkNum(0); nMarkNum < aSelection.size(); nMarkNum++)
{
const SdrObject* pObj = aSelection[nMarkNum];
- const sdr::selection::Indices rMarkedGluePoints = getSdrView().getSelectedGluesForSelectedSdrObject(*pObj);
- if(rMarkedGluePoints.size())
+ if(pObj)
{
- const SdrGluePointList* pGPL = pObj->GetGluePointList();
- const basegfx::B2DRange& rObjectRange(pObj->getObjectRange(&getSdrView()));
- const basegfx::B2DRange aObjectSnapRange(sdr::legacy::GetSnapRange(*pObj));
+ const sdr::selection::Indices rMarkedGluePoints = getSdrView().getSelectedGluesForSelectedSdrObject(*pObj);
- for(sdr::selection::Indices::const_iterator aCurrent(rMarkedGluePoints.begin()); aCurrent != rMarkedGluePoints.end(); aCurrent++)
+ if(rMarkedGluePoints.size())
{
- const sal_uInt32 nId(*aCurrent);
- const sal_uInt32 nGlueNum(pGPL->FindGluePoint(nId));
+ const sdr::glue::List* pGPL = pObj->GetGluePointList(false);
- if(SDRGLUEPOINT_NOTFOUND != nGlueNum)
+ if(pGPL)
{
- basegfx::B2DPoint aPt((*pGPL)[nGlueNum].GetAbsolutePos(aObjectSnapRange) + aNewPos);
+ // the SdrObject candidate with potentially moved GluePoints is identified. GetObjectMatrix,
+ // but take care for objects with zero width/height. Also prepare inverse transformation
+ const basegfx::B2DHomMatrix aCorrectedObjectTransformation(basegfx::tools::guaranteeMinimalScaling(pObj->getSdrObjectTransformation()));
+ basegfx::B2DHomMatrix aInverseCorrectedObjectTransformation(aCorrectedObjectTransformation);
- if(aPt.getX() < rObjectRange.getMinX())
- {
- aNewPos.setX(aNewPos.getX() - (aPt.getX() - rObjectRange.getMinX()));
- }
- if(aPt.getX() > rObjectRange.getMaxX())
- {
- aNewPos.setX(aNewPos.getX() - (aPt.getX() - rObjectRange.getMaxX()));
- }
- if(aPt.getY() < rObjectRange.getMinY())
- {
- aNewPos.setY(aNewPos.getY() - (aPt.getY() - rObjectRange.getMinY()));
- }
- if(aPt.getY() > rObjectRange.getMaxY())
+ aInverseCorrectedObjectTransformation.invert();
+
+ for(sdr::selection::Indices::const_iterator aCurrent(rMarkedGluePoints.begin()); aCurrent != rMarkedGluePoints.end(); aCurrent++)
{
- aNewPos.setY(aNewPos.getY() - (aPt.getY() - rObjectRange.getMaxY()));
+ const sal_uInt32 nId(*aCurrent);
+ const sdr::glue::Point* pGlueCandidate = pGPL->findByID(nId);
+
+ if(pGlueCandidate)
+ {
+ // get potentially moved position as absolute position and add absolute delta
+ const basegfx::B2DPoint aAbsolutePosition(aCorrectedObjectTransformation * pGlueCandidate->getUnitPosition());
+ basegfx::B2DPoint aClampedAbsolutePosition(aAbsolutePosition + aNewAbsoluteDelta);
+
+ // calculate back to unit position of moved point, clamp that position in unit coordinates
+ // to unit coordinates and convert back to absolute coordinates; this gives the clamped potentially
+ // moved position
+ aClampedAbsolutePosition = aInverseCorrectedObjectTransformation * aClampedAbsolutePosition;
+ aClampedAbsolutePosition = basegfx::B2DRange::getUnitB2DRange().clamp(aClampedAbsolutePosition);
+ aClampedAbsolutePosition = aCorrectedObjectTransformation * aClampedAbsolutePosition;
+
+ // calculate the potentially changed delta move
+ const basegfx::B2DVector aClampedDelta(aClampedAbsolutePosition - aAbsolutePosition);
+
+ // prefer the new delta move vector when it's shorter than the original
+ if(aClampedDelta.getLength() < aNewAbsoluteDelta.getLength())
+ {
+ aNewAbsoluteDelta = aClampedDelta;
+ }
+ }
}
}
}
}
+ else
+ {
+ OSL_ENSURE(false, "ObjectSelection vector with illegal empty slots (!)");
+ }
}
- aNewPos += DragStat().GetStart();
+ if(!aOriginalAbsoluteDelta.equal(aNewAbsoluteDelta))
+ {
+ aNewPos = aNewPos - aOriginalAbsoluteDelta + aNewAbsoluteDelta;
+ }
}
if(getSdrView().IsOrthogonal())
@@ -1769,9 +1787,13 @@ bool SdrDragMove::EndSdrDrag(bool bCopy)
SDRREPFUNC_OBJ_MOVE,
bCopy);
}
- else if (IsDraggingGluePoints())
+ else if(IsDraggingGluePoints())
{
- getSdrView().MoveMarkedGluePoints(DragStat().GetNow() - DragStat().GetPrev(), bCopy);
+ getSdrView().TransformMarkedGluePoints(
+ basegfx::tools::createTranslateB2DHomMatrix(DragStat().GetNow() - DragStat().GetPrev()),
+ SDRREPFUNC_OBJ_MOVE,
+ bCopy);
+ // TTTT:GLUE getSdrView().MoveMarkedGluePoints(DragStat().GetNow() - DragStat().GetPrev(), bCopy);
}
else
{
@@ -2064,9 +2086,19 @@ bool SdrDragResize::EndSdrDrag(bool bCopy)
SDRREPFUNC_OBJ_RESIZE,
bCopy);
}
- else if (IsDraggingGluePoints())
+ else if(IsDraggingGluePoints())
{
- getSdrView().ResizeMarkedGluePoints(DragStat().GetRef1(), maScale, bCopy);
+ basegfx::B2DHomMatrix aTransform;
+
+ aTransform.translate(-DragStat().GetRef1());
+ aTransform.scale(maScale);
+ aTransform.translate(DragStat().GetRef1());
+
+ getSdrView().TransformMarkedGluePoints(
+ aTransform,
+ SDRREPFUNC_OBJ_MOVE,
+ bCopy);
+ // TTTT:GLUE getSdrView().ResizeMarkedGluePoints(DragStat().GetRef1(), maScale, bCopy);
}
else
{
@@ -2192,7 +2224,11 @@ bool SdrDragRotate::EndSdrDrag(bool bCopy)
}
else if(IsDraggingGluePoints())
{
- getSdrView().RotateMarkedGluePoints(DragStat().GetRef1(), mfDeltaRotation, bCopy);
+ getSdrView().TransformMarkedGluePoints(
+ 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 14acc7a77184..0d557a9755dd 100644
--- a/svx/source/svdraw/svddrgv.cxx
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -852,20 +852,30 @@ bool SdrDragView::BegInsGluePoint(const basegfx::B2DPoint& rPnt)
pObj->TakeObjNameSingul(aName);
aStr.SearchAndReplaceAscii("%1", aName);
maInsPointUndoStr = aStr;
- SdrGluePointList* pGPL=pObj->ForceGluePointList();
+ sdr::glue::List* pGPL=pObj->GetGluePointList(true);
if(pGPL)
{
- const sal_uInt32 nGlueIdx(pGPL->Insert(SdrGluePoint()));
- SdrGluePoint& rGP=(*pGPL)[nGlueIdx];
- const sal_uInt32 nGlueId(rGP.GetId());
+ sdr::glue::Point& rNew = pGPL->add(sdr::glue::Point());
+ const sal_uInt32 nGlueId(rNew.getID());
SdrHdl* pHdl = 0;
- rGP.SetAbsolutePos(rPnt, sdr::legacy::GetSnapRange(*pObj));
+ // 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))
{
- pHdl=GetGluePointHdl(pObj,nGlueId);
+ pHdl = GetGluePointHdl(pObj, nGlueId);
}
if(pHdl && HDL_GLUE == pHdl->GetKind() && pHdl->GetObj() == pObj && pHdl->GetObjHdlNum() == nGlueId)
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index c42b0227dd63..6ab7d6628e5b 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -251,21 +251,10 @@ void SdrEditView::ResizeMarkedObj(const basegfx::B2DPoint& rRefPoint, const base
AddUndo( getSdrModelFromSdrView().GetSdrUndoFactory().CreateUndoGeoObject(*pO));
}
- basegfx::B2DHomMatrix aObjectMatrix(pO->getSdrObjectTransformation());
-
- // check for zero-width/height objects
- if(basegfx::fTools::equalZero(aObjectMatrix.get(0, 0)))
- {
- // no width
- aObjectMatrix.set(0, 0, 1.0);
- }
-
- if(basegfx::fTools::equalZero(aObjectMatrix.get(1, 1)))
- {
- // no height
- aObjectMatrix.set(1, 1, 1.0);
- }
+ // get transformation and correct to minimal scaling for zero-width/height objects
+ basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::guaranteeMinimalScaling(pO->getSdrObjectTransformation()));
+ // apply current transformation and set
aObjectMatrix = aTransformation * aObjectMatrix;
pO->setSdrObjectTransformation(aObjectMatrix);
}
diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx
index e71c36c5386d..3da7f330f7fc 100644
--- a/svx/source/svdraw/svdglev.cxx
+++ b/svx/source/svdraw/svdglev.cxx
@@ -30,7 +30,7 @@
#include "svx/svdstr.hrc" // Namen aus der Resource
#include "svx/svdglob.hxx" // StringCache
#include <svx/svdpagv.hxx>
-#include <svx/svdglue.hxx>
+#include <svx/sdrglue.hxx>
#include <svx/svdtrans.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdlegacy.hxx>
@@ -61,16 +61,16 @@ void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, co
if(aMarkedGluePoints.size())
{
- SdrGluePointList* pGPL = 0;
+ sdr::glue::List* pGPL = pObj->GetGluePointList(!bConst); // 0;
- if(bConst)
- {
- pGPL = const_cast< SdrGluePointList* >(pObj->GetGluePointList());
- }
- else
- {
- pGPL=pObj->ForceGluePointList();
- }
+ //if(bConst)
+ //{
+ // pGPL = const_cast< sdr::glue::List* >(pObj->GetGluePointList());
+ //}
+ //else
+ //{
+ // pGPL = pObj->GetGluePointList(true);
+ //}
if(pGPL)
{
@@ -85,13 +85,16 @@ void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, co
aCurrent != aMarkedGluePoints.end(); aCurrent++)
{
const sal_uInt32 nPtId(*aCurrent);
- const sal_uInt32 nGlueIdx(pGPL->FindGluePoint(nPtId));
+ sdr::glue::Point* pCandidate = pGPL->findByID(nPtId);
+ // TTTT:GLUE
+ //const sal_uInt32 nGlueIdx(pGPL->FindGluePoint(nPtId));
- if(SDRGLUEPOINT_NOTFOUND != nGlueIdx)
+ if(pCandidate)
+ //if(SDRGLUEPOINT_NOTFOUND != nGlueIdx)
{
- SdrGluePoint& rGP=(*pGPL)[nGlueIdx];
+ //sdr::glue::Point& rGP=(*pGPL)[nGlueIdx];
- (*pDoFunc)(rGP,pObj,p1,p2,p3,p4,p5);
+ (*pDoFunc)(*pCandidate, pObj, p1, p2, p3, p4, p5);
}
}
@@ -112,14 +115,14 @@ void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, co
////////////////////////////////////////////////////////////////////////////////////////////////////
-static void ImpGetEscDir(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnThisEsc, const void* pnRet, const void*, const void*)
+static void ImpGetEscDir(sdr::glue::Point& 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;
if(FUZZY != nRet)
{
- const sal_uInt16 nEsc(rGP.GetEscDir());
+ const sal_uInt16 nEsc(rGP.getEscapeDirections());
bool bOn(nEsc & *(sal_uInt16*)pnThisEsc);
if(bFirst)
@@ -142,9 +145,9 @@ TRISTATE SdrGlueEditView::IsMarkedGluePointsEscDir(sal_uInt16 nThisEsc) const
return (TRISTATE)nRet;
}
-static void ImpSetEscDir(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pnThisEsc, const void* pbOn, const void*, const void*, const void*)
+static void ImpSetEscDir(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const void* pnThisEsc, const void* pbOn, const void*, const void*, const void*)
{
- sal_uInt16 nEsc=rGP.GetEscDir();
+ sal_uInt16 nEsc=rGP.getEscapeDirections();
if(*(bool*)pbOn)
{
@@ -155,7 +158,7 @@ static void ImpSetEscDir(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const voi
nEsc &= ~*(sal_uInt16*)pnThisEsc;
}
- rGP.SetEscDir(nEsc);
+ rGP.setEscapeDirections(nEsc);
}
void SdrGlueEditView::SetMarkedGluePointsEscDir(sal_uInt16 nThisEsc, bool bOn)
@@ -167,14 +170,14 @@ void SdrGlueEditView::SetMarkedGluePointsEscDir(sal_uInt16 nThisEsc, bool bOn)
////////////////////////////////////////////////////////////////////////////////////////////////////
-static void ImpGetPercent(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnRet, const void*, const void*, const void*)
+static void ImpGetPercent(sdr::glue::Point& 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;
if(FUZZY != nRet)
{
- bool bOn(rGP.IsPercent());
+ bool bOn(rGP.getRelative());
if(bFirst)
{
@@ -196,13 +199,15 @@ TRISTATE SdrGlueEditView::IsMarkedGluePointsPercent() const
return (TRISTATE)nRet;
}
-static void ImpSetPercent(SdrGluePoint& rGP, const SdrObject* pObj, const void* pbOn, const void*, const void*, const void*, const void*)
+static void ImpSetPercent(sdr::glue::Point& 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));
+ //const basegfx::B2DRange aObjectRange(sdr::legacy::GetSnapRange(*pObj));
+ //const basegfx::B2DPoint aPos(rGP.GetAbsolutePos(aObjectRange));
- rGP.SetPercent(*(bool*)pbOn);
- rGP.SetAbsolutePos(aPos, aObjectRange);
+ // TTTT:GLUE
+ rGP.setRelative(*(bool*)pbOn);
+ //rGP.SetPercent(*(bool*)pbOn);
+ //rGP.SetAbsolutePos(aPos, aObjectRange);
}
void SdrGlueEditView::SetMarkedGluePointsPercent(bool bOn)
@@ -214,24 +219,24 @@ void SdrGlueEditView::SetMarkedGluePointsPercent(bool bOn)
////////////////////////////////////////////////////////////////////////////////////////////////////
-static void ImpGetAlign(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pbDontCare, const void* pbVert, const void* pnRet, const void*)
+static void ImpGetAlign(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pbDontCare, const void* pbVert, const void* pnRet, const void*)
{
- sal_uInt16& nRet=*(sal_uInt16*)pnRet;
+ sdr::glue::Point::Alignment& nRet=*(sdr::glue::Point::Alignment*)pnRet;
bool& bFirst = *(bool*)pbFirst;
bool& bDontCare = *(bool*)pbDontCare;
bool bVert = *(bool*)pbVert;
if(!bDontCare)
{
- sal_uInt16 nAlg(0);
+ sdr::glue::Point::Alignment nAlg(sdr::glue::Point::Alignment_Center);
if(bVert)
{
- nAlg=rGP.GetVertAlign();
+ nAlg = rGP.getVerticalAlignment();
}
else
{
- nAlg=rGP.GetHorzAlign();
+ nAlg = rGP.getHorizontalAlignment();
}
if(bFirst)
@@ -241,48 +246,38 @@ static void ImpGetAlign(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void
}
else if(nRet != nAlg)
{
- if(bVert)
- {
- nRet=SDRVERTALIGN_DONTCARE;
- }
- else
- {
- nRet=SDRHORZALIGN_DONTCARE;
- }
-
bDontCare = true;
}
}
}
-sal_uInt16 SdrGlueEditView::GetMarkedGluePointsAlign(bool bVert) const
+sdr::glue::Point::Alignment SdrGlueEditView::GetMarkedGluePointsAlign(bool bVert) const
{
bool bFirst(true);
bool bDontCare(false);
- sal_uInt16 nRet(0);
+ sdr::glue::Point::Alignment nRet(sdr::glue::Point::Alignment_Center);
const_cast< SdrGlueEditView* >(this)->ImpDoMarkedGluePoints(ImpGetAlign, true, &bFirst, &bDontCare, &bVert, &nRet);
return nRet;
}
-static void ImpSetAlign(SdrGluePoint& rGP, const SdrObject* pObj, const void* pbVert, const void* pnAlign, const void*, const void*, const void*)
+static void ImpSetAlign(sdr::glue::Point& 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));
+ //const basegfx::B2DRange aObjectRange(sdr::legacy::GetSnapRange(*pObj));
+ //const basegfx::B2DPoint aPos(rGP.GetAbsolutePos(aObjectRange));
if(*(bool*)pbVert)
{
- // bVert?
- rGP.SetVertAlign(*(sal_uInt16*)pnAlign);
+ rGP.setVerticalAlignment(*(sdr::glue::Point::Alignment *)pnAlign);
}
else
{
- rGP.SetHorzAlign(*(sal_uInt16*)pnAlign);
+ rGP.setHorizontalAlignment(*(sdr::glue::Point::Alignment *)pnAlign);
}
- rGP.SetAbsolutePos(aPos, aObjectRange);
+ //rGP.SetAbsolutePos(aPos, aObjectRange);
}
-void SdrGlueEditView::SetMarkedGluePointsAlign(bool bVert, sal_uInt16 nAlign)
+void SdrGlueEditView::SetMarkedGluePointsAlign(bool bVert, sdr::glue::Point::Alignment nAlign)
{
BegUndo(ImpGetResStr(STR_EditSetGlueAlign), getSelectedGluesDescription());
ImpDoMarkedGluePoints(ImpSetAlign, false, &bVert, &nAlign);
@@ -312,7 +307,7 @@ void SdrGlueEditView::DeleteMarkedGluePoints()
if(!aMarkedGluePoints.empty())
{
- SdrGluePointList* pGPL=pObj->ForceGluePointList();
+ sdr::glue::List* pGPL = pObj->GetGluePointList(false);
if(pGPL)
{
@@ -327,12 +322,20 @@ void SdrGlueEditView::DeleteMarkedGluePoints()
aCurrent != aMarkedGluePoints.end(); aCurrent++)
{
const sal_uInt32 nPtId(*aCurrent);
- const sal_uInt32 nGlueIdx(pGPL->FindGluePoint(nPtId));
+ sdr::glue::Point* pCandidate = pGPL->findByID(nPtId);
- if(SDRGLUEPOINT_NOTFOUND != nGlueIdx)
+ if(pCandidate)
{
- pGPL->Delete(nGlueIdx);
+ pGPL->remove(*pCandidate);
}
+
+ // TTTT:GLUE
+ //const sal_uInt32 nGlueIdx(pGPL->FindGluePoint(nPtId));
+ //
+ //if(SDRGLUEPOINT_NOTFOUND != nGlueIdx)
+ //{
+ // pGPL->Delete(nGlueIdx);
+ //}
}
pObj->SetChanged();
@@ -373,7 +376,7 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints()
SdrObject* pObj = aSelection[nm];
sdr::selection::Indices aMarkedGluePoints(getSelectedGluesForSelectedSdrObject(*pObj));
bool bMarkedGluePointsChanged(false);
- SdrGluePointList* pGPL=pObj->ForceGluePointList();
+ sdr::glue::List* pGPL = pObj->GetGluePointList(false);
if(!aMarkedGluePoints.empty() && pGPL)
{
@@ -386,21 +389,36 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints()
aCurrent != aMarkedGluePoints.end(); aCurrent++)
{
const sal_uInt32 nPtId(*aCurrent);
- const sal_uInt32 nGlueIdx(pGPL->FindGluePoint(nPtId));
+ sdr::glue::Point* pCandidate = pGPL->findByID(nPtId);
- if(SDRGLUEPOINT_NOTFOUND != nGlueIdx)
+ if(pCandidate)
{
- SdrGluePoint aNewGP((*pGPL)[nGlueIdx]);
- const sal_uInt32 nNewIdx(pGPL->Insert(aNewGP));
- const sal_uInt32 nNewId((*pGPL)[nNewIdx].GetId());
-
+ const sdr::glue::Point& rNew = pGPL->add(*pCandidate);
sdr::selection::Indices::iterator aNext(aCurrent);
+
aNext++;
aMarkedGluePoints.erase(aCurrent);
- aMarkedGluePoints.insert(nNewId);
+ aMarkedGluePoints.insert(rNew.getID());
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;
+ //}
}
}
@@ -424,7 +442,7 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints()
////////////////////////////////////////////////////////////////////////////////////////////////////
-void SdrGlueEditView::ImpTransformMarkedGluePoints(PGlueTrFunc pTrFunc, const void* p1, const void* p2, const void* p3, const void* p4, const void* p5)
+void SdrGlueEditView::ImpTransformMarkedGluePoints(const basegfx::B2DHomMatrix& rTransform)
{
if(areSdrObjectsSelected())
{
@@ -437,7 +455,7 @@ void SdrGlueEditView::ImpTransformMarkedGluePoints(PGlueTrFunc pTrFunc, const vo
if(!aMarkedGluePoints.empty())
{
- SdrGluePointList* pGPL=pObj->ForceGluePointList();
+ sdr::glue::List* pGPL = pObj->GetGluePointList(false);
if(pGPL)
{
@@ -448,20 +466,39 @@ void SdrGlueEditView::ImpTransformMarkedGluePoints(PGlueTrFunc pTrFunc, const vo
AddUndo(getSdrModelFromSdrView().GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
}
+ // Get ObjectMatrix, but take care for objects with zero width/height
+ const basegfx::B2DHomMatrix aCorrectedObjectTransformation(basegfx::tools::guaranteeMinimalScaling(pObj->getSdrObjectTransformation()));
+
+ // prepare inverse and get unit position of moved point
+ basegfx::B2DHomMatrix aInverseCorrectedObjectTransformation(aCorrectedObjectTransformation);
+
+ aInverseCorrectedObjectTransformation.invert();
+
for(sdr::selection::Indices::const_iterator aCurrent(aMarkedGluePoints.begin());
aCurrent != aMarkedGluePoints.end(); aCurrent++)
{
const sal_uInt32 nPtId(*aCurrent);
- const sal_uInt32 nGlueIdx(pGPL->FindGluePoint(nPtId));
+ sdr::glue::Point* pCandidate = pGPL->findByID(nPtId);
- if(SDRGLUEPOINT_NOTFOUND != nGlueIdx)
+ if(pCandidate)
{
- SdrGluePoint& 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);
+ const basegfx::B2DPoint aAbsolutePos(aCorrectedObjectTransformation * pCandidate->getUnitPosition());
+ const basegfx::B2DPoint aTransformedPos(rTransform * aAbsolutePos);
+
+ 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();
@@ -476,102 +513,141 @@ void SdrGlueEditView::ImpTransformMarkedGluePoints(PGlueTrFunc pTrFunc, const vo
}
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-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)
+void SdrGlueEditView::TransformMarkedGluePoints(const basegfx::B2DHomMatrix& rTransformation, const SdrRepeatFunc aRepFunc, bool bCopy)
{
- XubString aStr(ImpGetResStr(STR_EditMove));
-
- if(bCopy)
- {
- aStr += ImpGetResStr(STR_EditWithCopy);
- }
-
- BegUndo(aStr, getSelectedGluesDescription(), SDRREPFUNC_OBJ_MOVE);
-
- if(bCopy)
+ if(areGluesSelected() && !rTransformation.isIdentity())
{
- ImpCopyMarkedGluePoints();
- }
+ XubString aStr;
- 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);
+ switch(aRepFunc)
+ {
+ default: //case SDRREPFUNC_OBJ_MOVE:
+ aStr = ImpGetResStr(STR_EditMove);
+ break;
+ case SDRREPFUNC_OBJ_RESIZE:
+ aStr = ImpGetResStr(STR_EditResize);
+ break;
+ case SDRREPFUNC_OBJ_ROTATE:
+ aStr = ImpGetResStr(STR_EditRotate); // no own string for rotate ?!?
+ break;
+ }
- rPt = ((rPt - (*pRef)) * (*pScale)) + (*pRef);
-}
+ if(bCopy)
+ {
+ aStr += ImpGetResStr(STR_EditWithCopy);
+ }
-void SdrGlueEditView::ResizeMarkedGluePoints(const basegfx::B2DPoint& rRef, const basegfx::B2DVector& rScale, bool bCopy)
-{
- XubString aStr(ImpGetResStr(STR_EditResize));
+ BegUndo(aStr, getSelectedGluesDescription(), SDRREPFUNC_OBJ_MOVE);
- if(bCopy)
- {
- aStr += ImpGetResStr(STR_EditWithCopy);
- }
+ if(bCopy)
+ {
+ ImpCopyMarkedGluePoints();
+ }
- BegUndo(aStr, getSelectedGluesDescription(), SDRREPFUNC_OBJ_RESIZE);
+ ImpTransformMarkedGluePoints(rTransformation);
- if(bCopy)
- {
- ImpCopyMarkedGluePoints();
+ EndUndo();
+ RecreateAllMarkHandles();
}
-
- ImpTransformMarkedGluePoints(ImpResize, &rRef, &rScale);
- EndUndo();
- RecreateAllMarkHandles();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+// 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 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();
- }
+//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();
+//}
- const double fSin(sin(fAngle));
- const double fCos(cos(fAngle));
+////////////////////////////////////////////////////////////////////////////////////////////////////
- ImpTransformMarkedGluePoints(ImpRotate, &rRef, &fAngle, &fSin, &fCos);
- 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/svdglue.cxx b/svx/source/svdraw/svdglue.cxx
deleted file mode 100644
index c22941e8f812..000000000000
--- a/svx/source/svdraw/svdglue.cxx
+++ /dev/null
@@ -1,546 +0,0 @@
-/**************************************************************
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svx.hxx"
-#include <tools/debug.hxx>
-
-#include <svx/svdglue.hxx>
-#include <svx/svdobj.hxx>
-#include <svx/svdtrans.hxx>
-#include <svx/svdlegacy.hxx>
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace glue
- {
- void Point::setUnitPosition(const basegfx::B2DPoint& rNew)
- {
- const aClampedNew(basegfx::clamp(rNew, 0.0, 1.0));
-
- if(aClampedNew != maUnitPosition)
- {
- maUnitPosition = aClampedNew;
- }
- }
-
- void Point::setEscapeVector(const basegfx::B2DVector& rNew)
- {
- const basegfx::B2DVector aNormalizedNew(rNew.normalize());
-
- if(aNormalizedNew != maEscapeVector)
- {
- maEscapeVector = aNormalizedNew;
- }
- }
-
-
-
-
-
-
- } // end of namespace glue
-} // end of namespace sdr
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-SdrGluePoint::SdrGluePoint()
-: mnEscDir(SDRESC_SMART),
- mnId(0),
- mnAlign(0),
- mbNoPercent(false),
- mbReallyAbsolute(false),
- mbUserDefined(true)
-{
-}
-
-SdrGluePoint::SdrGluePoint(const basegfx::B2DPoint& rNewPos,
- bool bNewPercent,
- sal_uInt16 nNewAlign)
-: maPos(rNewPos),
- mnEscDir(SDRESC_SMART),
- mnId(0),
- mnAlign(nNewAlign),
- mbNoPercent(!bNewPercent),
- mbReallyAbsolute(false),
- mbUserDefined(true)
-{
-}
-
-bool SdrGluePoint::operator==(const SdrGluePoint& rCmpGP) const
-{
- return GetPos() == rCmpGP.GetPos()
- && GetEscDir() == rCmpGP.GetEscDir()
- && GetId() == rCmpGP.GetId()
- && GetAlign() == rCmpGP.GetAlign()
- && IsPercent() == rCmpGP.IsPercent()
- && IsReallyAbsolute() == rCmpGP.IsReallyAbsolute()
- && IsUserDefined() == rCmpGP.IsUserDefined();
-}
-
-basegfx::B2DPoint SdrGluePoint::GetAbsolutePos(const basegfx::B2DRange& rObjectRange) const
-{
- if(IsReallyAbsolute() || rObjectRange.isEmpty())
- {
- return GetPos();
- }
-
- basegfx::B2DPoint aPt(GetPos());
- basegfx::B2DPoint aOfs(rObjectRange.getCenter());
-
- switch(GetHorzAlign())
- {
- case SDRHORZALIGN_LEFT :
- {
- aOfs.setX(rObjectRange.getMinX());
- break;
- }
- case SDRHORZALIGN_RIGHT :
- {
- aOfs.setX(rObjectRange.getMaxX());
- break;
- }
- }
-
- switch(GetVertAlign())
- {
- case SDRVERTALIGN_TOP :
- {
- aOfs.setY(rObjectRange.getMinY());
- break;
- }
- case SDRVERTALIGN_BOTTOM:
- {
- aOfs.setY(rObjectRange.getMaxY());
- break;
- }
- }
-
- if(IsPercent())
- {
- const basegfx::B2DVector aScale(rObjectRange.getRange() / basegfx::B2DTuple(10000.0, 10000.0));
-
- aPt *= aScale;
- }
-
- aPt+=aOfs;
-
- // limit to object bound
- aPt = rObjectRange.clamp(aPt);
-
- return aPt;
-}
-
-void SdrGluePoint::SetAbsolutePos(const basegfx::B2DPoint& rNewPos, const basegfx::B2DRange& rObjectRange)
-{
- if(IsReallyAbsolute() || rObjectRange.isEmpty())
- {
- SetPos(rNewPos);
- return;
- }
-
- basegfx::B2DPoint aPt(rNewPos);
- basegfx::B2DPoint aOfs(rObjectRange.getCenter());
-
- switch(GetHorzAlign())
- {
- case SDRHORZALIGN_LEFT :
- {
- aOfs.setX(rObjectRange.getMinX());
- break;
- }
- case SDRHORZALIGN_RIGHT :
- {
- aOfs.setX(rObjectRange.getMaxX());
- break;
- }
- }
-
- switch(GetVertAlign())
- {
- case SDRVERTALIGN_TOP :
- {
- aOfs.setY(rObjectRange.getMinY());
- break;
- }
- case SDRVERTALIGN_BOTTOM:
- {
- aOfs.setY(rObjectRange.getMaxY());
- break;
- }
- }
-
- aPt -= aOfs;
-
- if(IsPercent())
- {
- const basegfx::B2DVector aScale(
- 10000.0 / (basegfx::fTools::equalZero(rObjectRange.getWidth()) ? rObjectRange.getWidth() : 1.0),
- 10000.0 / (basegfx::fTools::equalZero(rObjectRange.getHeight()) ? rObjectRange.getHeight() : 1.0));
-
- aPt *= aScale;
- }
-
- SetPos(aPt);
-}
-
-sal_Int32 SdrGluePoint::GetAlignAngle() const
-{
- switch(GetAlign())
- {
- case SDRHORZALIGN_CENTER|SDRVERTALIGN_CENTER: return 0; // Invalid!
- case SDRHORZALIGN_RIGHT |SDRVERTALIGN_CENTER: return 0;
- case SDRHORZALIGN_RIGHT |SDRVERTALIGN_TOP : return 4500;
- case SDRHORZALIGN_CENTER|SDRVERTALIGN_TOP : return 9000;
- case SDRHORZALIGN_LEFT |SDRVERTALIGN_TOP : return 13500;
- case SDRHORZALIGN_LEFT |SDRVERTALIGN_CENTER: return 18000;
- case SDRHORZALIGN_LEFT |SDRVERTALIGN_BOTTOM: return 22500;
- case SDRHORZALIGN_CENTER|SDRVERTALIGN_BOTTOM: return 27000;
- case SDRHORZALIGN_RIGHT |SDRVERTALIGN_BOTTOM: return 31500;
- }
-
- return 0;
-}
-
-void SdrGluePoint::SetAlignAngle(sal_Int32 nWink)
-{
- nWink=NormAngle360(nWink);
-
- if(nWink >= 33750 || nWink < 2250)
- {
- SetAlign(SDRHORZALIGN_RIGHT |SDRVERTALIGN_CENTER);
- }
- else if(nWink < 6750)
- {
- SetAlign(SDRHORZALIGN_RIGHT |SDRVERTALIGN_TOP );
- }
- else if(nWink < 11250)
- {
- SetAlign(SDRHORZALIGN_CENTER|SDRVERTALIGN_TOP );
- }
- else if(nWink < 15750)
- {
- SetAlign(SDRHORZALIGN_LEFT |SDRVERTALIGN_TOP );
- }
- else if(nWink < 20250)
- {
- SetAlign(SDRHORZALIGN_LEFT |SDRVERTALIGN_CENTER);
- }
- else if(nWink < 24750)
- {
- SetAlign(SDRHORZALIGN_LEFT |SDRVERTALIGN_BOTTOM);
- }
- else if(nWink < 29250)
- {
- SetAlign(SDRHORZALIGN_CENTER|SDRVERTALIGN_BOTTOM);
- }
- else if(nWink < 33750)
- {
- SetAlign(SDRHORZALIGN_RIGHT |SDRVERTALIGN_BOTTOM);
- }
-}
-
-sal_Int32 SdrGluePoint::EscDirToAngle(sal_uInt16 nEsc) const
-{
- switch(nEsc)
- {
- case SDRESC_RIGHT : return 0;
- case SDRESC_TOP : return 9000;
- case SDRESC_LEFT : return 18000;
- case SDRESC_BOTTOM: return 27000;
- }
-
- return 0;
-}
-
-sal_uInt16 SdrGluePoint::EscAngleToDir(sal_Int32 nWink) const
-{
- nWink=NormAngle360(nWink);
-
- if(nWink >= 31500 || nWink < 4500)
- {
- return SDRESC_RIGHT;
- }
- if(nWink < 13500)
- {
- return SDRESC_TOP;
- }
- if(nWink < 22500)
- {
- return SDRESC_LEFT;
- }
- if(nWink < 31500)
- {
- return SDRESC_BOTTOM;
- }
-
- return 0;
-}
-
-void SdrGluePoint::Transform(const basegfx::B2DHomMatrix& rTransformation, const basegfx::B2DRange& rObjectRange)
-{
- basegfx::B2DPoint aPt(GetAbsolutePos(rObjectRange));
- aPt = rTransformation * aPt;
-
- // check if old angle is needed
- sal_Int32 nOldAngle(0);
- const bool bTransformEscapes(GetEscDir() & (SDRESC_HORZ|SDRESC_VERT));
- const bool bTransformAligns(GetAlign() != (SDRHORZALIGN_CENTER|SDRVERTALIGN_CENTER));
-
- if(bTransformEscapes || bTransformAligns)
- {
- const basegfx::B2DPoint aRotated(rTransformation * basegfx::B2DPoint(1.0, 0.0));
- const double fAngleToXAxis(atan2(aRotated.getY(), aRotated.getX()));
- nOldAngle = basegfx::fround((-fAngleToXAxis * 18000.0) / F_PI) % 36000;
- }
-
- // transform escape directions
- if(bTransformEscapes)
- {
- sal_uInt16 nNewEscDir(0);
-
- if(GetEscDir() & SDRESC_LEFT)
- {
- nNewEscDir |= EscAngleToDir(EscDirToAngle(SDRESC_LEFT) + nOldAngle);
- }
-
- if(GetEscDir() & SDRESC_TOP)
- {
- nNewEscDir |= EscAngleToDir(EscDirToAngle(SDRESC_TOP) + nOldAngle);
- }
-
- if(GetEscDir() & SDRESC_RIGHT)
- {
- nNewEscDir |= EscAngleToDir(EscDirToAngle(SDRESC_RIGHT) + nOldAngle);
- }
-
- if(GetEscDir() & SDRESC_BOTTOM)
- {
- nNewEscDir |= EscAngleToDir(EscDirToAngle(SDRESC_BOTTOM) + nOldAngle);
- }
-
- SetEscDir(nNewEscDir);
- }
-
- // transform alignment edge
- if(bTransformAligns)
- {
- SetAlignAngle(GetAlignAngle() + nOldAngle);
- }
-
- SetAbsolutePos(aPt, rObjectRange);
-}
-
-bool SdrGluePoint::IsHit(const basegfx::B2DPoint& rPnt, double fTolLog, const basegfx::B2DRange& rObjectRange) const
-{
- const basegfx::B2DPoint aPt(GetAbsolutePos(rObjectRange));
- const double fDist(basegfx::B2DVector(aPt - rPnt).getLength());
-
- return basegfx::fTools::lessOrEqual(fDist, fTolLog);
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-SdrGluePointList::SdrGluePointList()
-: maList()
-{
-}
-
-SdrGluePointList::SdrGluePointList(const SdrGluePointList& rSrcList)
-: maList()
-{
- *this = rSrcList;
-}
-
-SdrGluePointList::~SdrGluePointList()
-{
- Clear();
-}
-
-SdrGluePoint* SdrGluePointList::GetObject(sal_uInt32 i) const
-{
- if(i < maList.size())
- {
- return *(maList.begin() + i);
- }
- else
- {
- OSL_ENSURE(false, "SdrGluePointList::GetObject access out of range (!)");
- return 0;
- }
-}
-
-void SdrGluePointList::Clear()
-{
- const sal_uInt32 nAnz(GetCount());
-
- for(sal_uInt32 i(0); i < nAnz; i++)
- {
- delete GetObject(i);
- }
-
- maList.clear();
-}
-
-void SdrGluePointList::operator=(const SdrGluePointList& rSrcList)
-{
- if(GetCount())
- {
- Clear();
- }
-
- const sal_uInt32 nAnz(rSrcList.GetCount());
-
- for(sal_uInt32 i(0); i < nAnz; i++)
- {
- Insert(rSrcList[i]);
- }
-}
-
-// Die Id's der Klebepunkte in der Liste sind stets streng monoton steigend!
-// Ggf. wird dem neuen Klebepunkt eine neue Id zugewiesen (wenn diese bereits
-// vergeben ist). Die Id 0 ist reserviert.
-sal_uInt32 SdrGluePointList::Insert(const SdrGluePoint& rGP)
-{
- SdrGluePoint* pGP=new SdrGluePoint(rGP);
- sal_uInt32 nId(pGP->GetId());
- const sal_uInt32 nAnz(GetCount());
- sal_uInt32 nInsPos(nAnz);
- const sal_uInt32 nLastId(nAnz ? GetObject(nAnz - 1)->GetId() : 0);
- DBG_ASSERT(nLastId>=nAnz,"SdrGluePointList::Insert(): nLastId<nAnz");
- const bool bHole(nLastId > nAnz);
-
- if(nId <= nLastId)
- {
- if(!bHole || 0 == nId)
- {
- nId=nLastId+1;
- }
- else
- {
- bool bBrk(false);
-
- for(sal_uInt32 nNum(0); nNum < nAnz && !bBrk; nNum++)
- {
- const SdrGluePoint* pGP2=GetObject(nNum);
- const sal_uInt32 nTmpId(pGP2->GetId());
-
- if(nTmpId == nId)
- {
- nId=nLastId+1; // bereits vorhanden
- bBrk = true;
- }
-
- if(nTmpId > nId)
- {
- nInsPos=nNum; // Hier einfuegen (einsortieren)
- bBrk = true;
- }
- }
- }
-
- pGP->SetId(nId);
- }
-
- maList.insert(maList.begin() + nInsPos, pGP);
-
- return nInsPos;
-}
-
-void SdrGluePointList::Delete(sal_uInt32 nPos)
-{
- if(nPos < maList.size())
- {
- SdrGluePointContainerType::iterator a(maList.begin() + nPos);
- delete *a;
- maList.erase(a);
- }
- else
- {
- OSL_ENSURE(false, "SdrGluePointList::Delete out of range (!)");
- }
-}
-
-sal_uInt32 SdrGluePointList::FindGluePoint(sal_uInt32 nId) const
-{
- // Hier noch einen optimaleren Suchalgorithmus implementieren.
- // Die Liste sollte stets sortiert sein!!!!
- const sal_uInt32 nAnz(GetCount());
- sal_uInt32 nRet(SDRGLUEPOINT_NOTFOUND);
-
- for(sal_uInt32 nNum(0); nNum < nAnz && SDRGLUEPOINT_NOTFOUND == nRet; nNum++)
- {
- const SdrGluePoint* pGP=GetObject(nNum);
-
- if(pGP->GetId() == nId)
- {
- nRet = nNum;
- }
- }
-
- return nRet;
-}
-
-sal_uInt32 SdrGluePointList::GPLHitTest(const basegfx::B2DPoint& rPnt, double fTolLog, const basegfx::B2DRange& rObjectRange, bool bBack) const
-{
- const sal_uInt32 nAnz(GetCount());
- sal_uInt32 nRet(SDRGLUEPOINT_NOTFOUND);
- sal_uInt32 nNum(bBack ? 0 : nAnz);
-
- while((bBack ? nNum < nAnz : nNum > 0) && SDRGLUEPOINT_NOTFOUND == nRet)
- {
- if(!bBack)
- {
- nNum--;
- }
-
- const SdrGluePoint* pGP = GetObject(nNum);
-
- if(pGP->IsHit(rPnt, fTolLog, rObjectRange))
- {
- nRet = nNum;
- }
-
- if(bBack)
- {
- nNum++;
- }
- }
-
- return nRet;
-}
-
-void SdrGluePointList::TransformGluePoints(const basegfx::B2DHomMatrix& rTransformation, const basegfx::B2DRange& rObjectRange)
-{
- const sal_uInt32 nAnz(GetCount());
-
- for(sal_uInt32 nNum(0); nNum < nAnz; nNum++)
- {
- GetObject(nNum)->Transform(rTransformation, rObjectRange);
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// eof
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 294a3d42feeb..9ef54f777e02 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -1069,25 +1069,36 @@ void SdrMarkView::CreateMarkHandles(SdrHdlList& rTarget)
if(!aMarkedGluePoints.empty())
{
- const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ const sdr::glue::List* pGPL=pObj->GetGluePointList(false);
if(pGPL)
{
- const basegfx::B2DRange aObjSnapRange(sdr::legacy::GetSnapRange(*pObj));
+ // 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 sal_uInt32 nNumGP(pGPL->FindGluePoint(nId));
+ const sdr::glue::Point* pCandidate = pGPL->findByID(nId);
- if(SDRGLUEPOINT_NOTFOUND != nNumGP)
+ if(pCandidate)
{
- const SdrGluePoint& rGP=(*pGPL)[nNumGP];
- basegfx::B2DPoint aPos(rGP.GetAbsolutePos(aObjSnapRange));
+ const basegfx::B2DPoint aPos(pObj->getSdrObjectTransformation() * pCandidate->getUnitPosition());
SdrHdl* pGlueHdl = new SdrHdl(rTarget, pObj, HDL_GLUE, aPos);
+
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 bcc534c26a31..24d962c85515 100644
--- a/svx/source/svdraw/svdmrkv1.cxx
+++ b/svx/source/svdraw/svdmrkv1.cxx
@@ -312,31 +312,40 @@ void SdrMarkView::impCreatePointRanges() const
bool SdrMarkView::HasMarkableGluePoints() const
{
- bool bRet(false);
-
if(IsGluePointEditMode() && areSdrObjectsSelected())
{
const SdrObjectVector aSelection(getSelectedSdrObjectVectorFromSdrMarkView());
- for(sal_uInt32 nMarkNum(0); nMarkNum < aSelection.size() && !bRet; nMarkNum++)
+ for(sal_uInt32 nMarkNum(0); nMarkNum < aSelection.size(); nMarkNum++)
{
const SdrObject* pObj = aSelection[nMarkNum];
- const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ const sdr::glue::List* pGPL = pObj ? pObj->GetGluePointList(false) : 0;
- if(pGPL && pGPL->GetCount())
+ if(pGPL)
{
- for(sal_uInt32 a(0); !bRet && a < pGPL->GetCount(); a++)
+ const sdr::glue::PointVector aCandidates(pGPL->getVector());
+
+ for(sal_uInt32 a(0); a < aCandidates.size(); a++)
{
- if((*pGPL)[a].IsUserDefined())
+ const sdr::glue::Point* pCandidate = aCandidates[a];
+
+ if(pCandidate)
{
- bRet = true;
+ if(aCandidates[a]->getUserDefined())
+ {
+ return true;
+ }
+ }
+ else
+ {
+ OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
}
}
}
}
}
- return bRet;
+ return false;
}
sal_uInt32 SdrMarkView::GetMarkableGluePointCount() const
@@ -350,17 +359,37 @@ sal_uInt32 SdrMarkView::GetMarkableGluePointCount() const
for(sal_uInt32 nMarkNum(0); nMarkNum < aSelection.size(); nMarkNum++)
{
const SdrObject* pObj = aSelection[nMarkNum];
- const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ const sdr::glue::List* pGPL = pObj ? pObj->GetGluePointList(false) : 0;
- if(pGPL && pGPL->GetCount())
+ if(pGPL)
{
- for(sal_uInt32 a(0); a < pGPL->GetCount(); a++)
+ const sdr::glue::PointVector aCandidates(pGPL->getVector());
+
+ for(sal_uInt32 a(0); a < aCandidates.size(); a++)
{
- if((*pGPL)[a].IsUserDefined())
+ const sdr::glue::Point* pCandidate = aCandidates[a];
+
+ if(pCandidate)
{
- nAnz++;
+ if(aCandidates[a]->getUserDefined())
+ {
+ nAnz++;
+ }
+ }
+ 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++;
+ // }
+ //}
}
}
}
@@ -399,61 +428,110 @@ void SdrMarkView::MarkGluePoints(const basegfx::B2DRange* pRange, bool bUnmark)
for(sal_uInt32 nMarkNum(0); nMarkNum < aSelection.size(); nMarkNum++)
{
const SdrObject* pObj = aSelection[nMarkNum];
- const SdrGluePointList* pGPL=pObj->GetGluePointList();
- sdr::selection::Indices aMarkedGluePoints(getSelectedGluesForSelectedSdrObject(*pObj));
- bool bGluePointsChanged(false);
- if(bUnmark && !pRange)
+ if(!pObj)
{
- // UnmarkAll
- if(aMarkedGluePoints.size())
- {
- aMarkedGluePoints.clear();
- bGluePointsChanged = true;
- }
+ OSL_ENSURE(false, "Got SdrObjectVector from selection with empty entries (!)");
}
else
{
- if(pGPL && (!aMarkedGluePoints.empty() || !bUnmark))
+ sdr::selection::Indices aMarkedGluePoints(getSelectedGluesForSelectedSdrObject(*pObj));
+ bool bGluePointsChanged(false);
+
+ if(bUnmark && !pRange)
+ {
+ // UnmarkAll
+ if(aMarkedGluePoints.size())
+ {
+ aMarkedGluePoints.clear();
+ bGluePointsChanged = true;
+ }
+ }
+ else
{
- const sal_uInt32 nGPAnz(pGPL->GetCount());
- const basegfx::B2DRange aObjSnapRange(nGPAnz ? sdr::legacy::GetSnapRange(*pObj) : basegfx::B2DRange());
+ const sdr::glue::List* pGPL = pObj->GetGluePointList(false);
- for(sal_uInt32 nGPNum(0); nGPNum < nGPAnz; nGPNum++)
+ if(pGPL && (!aMarkedGluePoints.empty() || !bUnmark))
{
- const SdrGluePoint& rGP=(*pGPL)[nGPNum];
+ const sdr::glue::PointVector aCandidates(pGPL->getVector());
- if(rGP.IsUserDefined())
+ for(sal_uInt32 a(0); a < aCandidates.size(); a++)
{
- if(!pRange || pRange->isInside(rGP.GetAbsolutePos(aObjSnapRange)))
- {
- sdr::selection::Indices::iterator aFound(aMarkedGluePoints.find(rGP.GetId()));
+ const sdr::glue::Point* pCandidate = aCandidates[a];
- if(bUnmark)
- {
- if(aFound != aMarkedGluePoints.end())
- {
- aMarkedGluePoints.erase(aFound);
- bGluePointsChanged = true;
- }
- }
- else
+ if(pCandidate)
+ {
+ if(pCandidate->getUserDefined())
{
- if(aFound == aMarkedGluePoints.end())
+ if(!pRange || pRange->isInside(pObj->getSdrObjectTransformation() * pCandidate->getUnitPosition()))
{
- aMarkedGluePoints.insert(rGP.GetId());
- bGluePointsChanged = true;
+ sdr::selection::Indices::iterator aFound(aMarkedGluePoints.find(pCandidate->getID()));
+
+ if(bUnmark)
+ {
+ if(aFound != aMarkedGluePoints.end())
+ {
+ aMarkedGluePoints.erase(aFound);
+ bGluePointsChanged = true;
+ }
+ }
+ else
+ {
+ if(aFound == aMarkedGluePoints.end())
+ {
+ aMarkedGluePoints.insert(pCandidate->getID());
+ bGluePointsChanged = true;
+ }
+ }
}
}
}
+ else
+ {
+ 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;
+ // }
+ // }
+ // }
+ // }
+ //}
}
}
- }
- if(bGluePointsChanged)
- {
- setSelectedGluesForSelectedSdrObject(*pObj, aMarkedGluePoints);
+ if(bGluePointsChanged)
+ {
+ setSelectedGluesForSelectedSdrObject(*pObj, aMarkedGluePoints);
+ }
}
}
}
@@ -468,7 +546,7 @@ bool SdrMarkView::PickGluePoint(const basegfx::B2DPoint& rPnt, SdrObject*& rpObj
return false;
}
- SdrObject* pObj0=rpObj;
+ // SdrObject* pObj0 = rpObj;
const SdrObjectVector aSelection(getSelectedSdrObjectVectorFromSdrMarkView());
sal_uInt32 nMarkNum(aSelection.size());
@@ -476,26 +554,56 @@ bool SdrMarkView::PickGluePoint(const basegfx::B2DPoint& rPnt, SdrObject*& rpObj
{
nMarkNum--;
SdrObject* pObj = aSelection[nMarkNum];
- const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ const sdr::glue::List* pGPL = pObj ? pObj->GetGluePointList(false) : 0;
if(pGPL)
{
- const sal_uInt32 nNum(pGPL->GPLHitTest(rPnt, getHitTolLog(), sdr::legacy::GetSnapRange(*pObj), false));
+ const sdr::glue::PointVector aCandidates(pGPL->getVector());
- if(SDRGLUEPOINT_NOTFOUND != nNum)
+ for(sal_uInt32 a(0); a < aCandidates.size(); a++)
{
- // #i38892#
- const SdrGluePoint& rCandidate = (*pGPL)[nNum];
+ const sdr::glue::Point* pCandidate = aCandidates[a];
- if(rCandidate.IsUserDefined())
+ if(pCandidate)
{
- rpObj=pObj;
- rnId=(*pGPL)[nNum].GetId();
+ if(pCandidate->getUserDefined())
+ {
+ 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 (!)");
}
}
}
+
+ // 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;
+ // }
+ // }
+ //}
}
return false;
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 0fda7cfd974f..b9a1f0c266b5 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1812,90 +1812,146 @@ void SdrObjCustomShape::setSdrObjectTransformation(const basegfx::B2DHomMatrix&
////////////////////////////////////////////////////////////////////////////////////////////////////
-// #i38892#
-void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded()
+// 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
{
- const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
+ sdr::glue::List* pOld = GetGluePointList(false);
+ sdr::glue::List* pNew = GetGluePointList(bForce);
- if(pSdrObject)
+ if(bForce && !pOld && pNew)
{
- const SdrGluePointList* pSource = pSdrObject->GetGluePointList();
+ // new list was created, add GluePoints from created visualization as non-user-defined GluePoints
+ const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
- if(pSource && pSource->GetCount())
+ if(pSdrObject)
{
- if(!SdrTextObj::GetGluePointList())
- {
- SdrTextObj::ForceGluePointList();
- }
-
- const SdrGluePointList* pList = SdrTextObj::GetGluePointList();
+ const sdr::glue::List* pSource = pSdrObject->GetGluePointList(false);
- if(pList)
+ if(pSource)
{
- SdrGluePointList aNewList;
- sal_uInt16 a;
+ // 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 transform matrix from helper object to local
- basegfx::B2DHomMatrix aTransFromHelperToLocal(pSdrObject->getSdrObjectTransformation());
- aTransFromHelperToLocal.invert();
- aTransFromHelperToLocal = getSdrObjectTransformation() * aTransFromHelperToLocal;
+ // build full transform
+ basegfx::B2DHomMatrix aFullHelperUnitToTargetUnit(aInvLocal * pSdrObject->getSdrObjectTransformation());
- for(a = 0; a < pSource->GetCount(); a++)
- {
- SdrGluePoint aCopy((*pSource)[a]);
- aCopy.SetUserDefined(false);
-
- basegfx::B2DPoint aGluePos(aCopy.GetPos());
- aGluePos *= aTransFromHelperToLocal;
- aCopy.SetPos(aGluePos);
-
- aNewList.Insert(aCopy);
- }
+ // get vector, change and copy points
+ const sdr::glue::PointVector aCandidates(pSource->getVector());
- for(a = 0; a < pList->GetCount(); a++)
+ for(sal_uInt32 a(0); a < aCandidates.size(); a++)
{
- const SdrGluePoint& rCandidate = (*pList)[a];
+ const sdr::glue::Point* pCandidate(aCandidates[a]);
- if(rCandidate.IsUserDefined())
+ if(pCandidate)
{
- aNewList.Insert(rCandidate);
+ 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 (!)");
}
- }
-
- // 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;
}
}
}
+
+ // TTTT:GLUE check here (!)
+ // Add custom glues here (!)
+ // ((SdrObjCustomShape*)this)->ImpCheckCustomGluePointsAreAdded();
}
-}
-// #i38892#
-const SdrGluePointList* SdrObjCustomShape::GetGluePointList() const
-{
- ((SdrObjCustomShape*)this)->ImpCheckCustomGluePointsAreAdded();
- return SdrTextObj::GetGluePointList();
-}
+ return mpPlusData ? mpPlusData->mpGluePoints : 0;
-// #i38892#
-SdrGluePointList* SdrObjCustomShape::ForceGluePointList()
-{
- if(SdrTextObj::ForceGluePointList())
- {
- ImpCheckCustomGluePointsAreAdded();
- return SdrTextObj::ForceGluePointList();
- }
- else
- {
- return 0L;
- }
+ //((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
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index fe4a00eba940..e2b1950a4f96 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -397,7 +397,7 @@ SdrObjPlusData* SdrObjPlusData::Clone(SdrObject* pObj1) const
// copy GluePoints
if(mpGluePoints)
{
- pNeuPlusData->mpGluePoints = new SdrGluePointList(*mpGluePoints);
+ pNeuPlusData->mpGluePoints = new sdr::glue::List(*mpGluePoints);
}
// copy object name, title and description
@@ -1585,7 +1585,7 @@ void SdrObject::SaveGeoData(SdrObjGeoData& rGeo) const
}
else
{
- rGeo.mpGPL = new SdrGluePointList(*mpPlusData->mpGluePoints);
+ rGeo.mpGPL = new sdr::glue::List(*mpPlusData->mpGluePoints);
}
}
else
@@ -1631,7 +1631,7 @@ void SdrObject::RestGeoData(const SdrObjGeoData& rGeo)
}
else
{
- mpPlusData->mpGluePoints = new SdrGluePointList(*rGeo.mpGPL);
+ mpPlusData->mpGluePoints = new sdr::glue::List(*rGeo.mpGPL);
}
}
else
@@ -2063,61 +2063,78 @@ void SdrObject::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHar
}
}
-SdrGluePoint SdrObject::GetVertexGluePoint(sal_uInt32 nPosNum) const
+sdr::glue::Point SdrObject::GetVertexGluePoint(sal_uInt32 nPosNum) const
{
- basegfx::B2DPoint aGluePoint(0.5, 0.5);
+ basegfx::B2DPoint aGluePosition(0.5, 0.5);
switch(nPosNum)
{
default: //case 0: TopCenter
{
- aGluePoint.setY(0.0);
+ aGluePosition.setY(0.0);
break;
}
case 1: // RightCenter
{
- aGluePoint.setX(1.0);
+ aGluePosition.setX(1.0);
break;
}
case 2: // BottomCenter
{
- aGluePoint.setY(1.0);
+ aGluePosition.setY(1.0);
break;
}
case 3: // LeftCenter
{
- aGluePoint.setX(0.0);
+ aGluePosition.setX(0.0);
break;
}
}
- aGluePoint = getSdrObjectTransformation() * aGluePoint;
- SdrGluePoint aGP(aGluePoint - sdr::legacy::GetSnapRange(*this).getCenter());
- aGP.SetPercent(false);
+ // 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
- return aGP;
+ // TTTT:GLUE
+ //aGluePosition = getSdrObjectTransformation() * aGluePosition;
+ //sdr::glue::Point aGP(aGluePosition - sdr::legacy::GetSnapRange(*this).getCenter());
+ //aGP.SetPercent(false);
+ //
+ //return aGP;
}
-const SdrGluePointList* SdrObject::GetGluePointList() const
-{
- if(mpPlusData)
- {
- return mpPlusData->mpGluePoints;
- }
-
- return 0;
-}
+// TTTT:GLUE
+//const sdr::glue::List* SdrObject::GetGluePointList() const
+//{
+// if(mpPlusData)
+// {
+// return mpPlusData->mpGluePoints;
+// }
+//
+// return 0;
+//}
-SdrGluePointList* SdrObject::ForceGluePointList()
+sdr::glue::List* SdrObject::GetGluePointList(bool bForce) const
{
- ImpForcePlusData();
-
- if(!mpPlusData->mpGluePoints)
+ if(bForce)
{
- mpPlusData->mpGluePoints = new SdrGluePointList;
+ if(!mpPlusData)
+ {
+ const_cast< SdrObject* >(this)->ImpForcePlusData();
+ }
+
+ if(!mpPlusData->mpGluePoints)
+ {
+ const_cast< SdrObject* >(this)->mpPlusData->mpGluePoints = new sdr::glue::List;
+ }
}
- return mpPlusData->mpGluePoints;
+ return mpPlusData ? mpPlusData->mpGluePoints : 0;
}
void extractLineContourFromPrimitive2DSequence(
@@ -2602,7 +2619,7 @@ void SdrObject::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransfo
//SetGlueReallyAbsolute(false);
//if (GetGluePointList()!=NULL) {
- // SdrGluePointList* pGPL=ForceGluePointList();
+ // sdr::glue::List* pGPL=GetGluePointList(true);
// pGPL->SetReallyAbsolute(true,*this);
// NbcShearGluePoints(rRef,nWink,tn,bVShear);
// pGPL->SetReallyAbsolute(false,*this);
@@ -2610,14 +2627,31 @@ void SdrObject::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransfo
if(rTransformation != getSdrObjectTransformation())
{
- if(GetGluePointList())
+ basegfx::B2DVector aOldAbsoluteScale;
+ sdr::glue::List* pGPL = GetGluePointList(false);
+
+ if(pGPL)
{
- ForceGluePointList()->TransformGluePoints(rTransformation, sdr::legacy::GetSnapRange(*this));
+ // remember old absolute size
+ aOldAbsoluteScale = basegfx::absolute(getSdrObjectScale());
}
const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*this);
+
maSdrObjectTransformation.setB2DHomMatrix(rTransformation);
SetChanged();
+
+ if(pGPL)
+ {
+ // get new absolute size
+ const basegfx::B2DVector aNewAbsoluteScale(basegfx::absolute(getSdrObjectScale()));
+
+ if(!aOldAbsoluteScale.equal(aNewAbsoluteScale))
+ {
+ // adapt the non-relative gluepoints according to their alignments
+ pGPL->adaptToChangedScale(aOldAbsoluteScale, aNewAbsoluteScale);
+ }
+ }
}
}
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index 40c9906d71fe..24955347716c 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -55,6 +55,10 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
+#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_ALL (SDRESC_HORZ|SDRESC_VERT)
+
SdrObjConnection::~SdrObjConnection()
{
}
@@ -68,9 +72,9 @@ void SdrObjConnection::ResetVars()
mbAutoVertex = false;
}
-bool SdrObjConnection::TakeGluePoint(SdrGluePoint& rGP, bool bSetAbsPos) const
+bool SdrObjConnection::TakeGluePoint(sdr::glue::Point& rGP/* TTTT:GLUE, bool bSetAbsPos*/) const
{
- bool bRet=false;
+ bool bRet(false);
if(mpConnectedSdrObject)
{
@@ -82,27 +86,38 @@ bool SdrObjConnection::TakeGluePoint(SdrGluePoint& rGP, bool bSetAbsPos) const
}
else
{
- const SdrGluePointList* pGPL = mpConnectedSdrObject->GetGluePointList();
+ const sdr::glue::List* pGPL = mpConnectedSdrObject->GetGluePointList(false);
if(pGPL)
{
- const sal_uInt32 nNum(pGPL->FindGluePoint(mnConnectorId));
+ sdr::glue::Point* pCandidate = pGPL->findByID(mnConnectorId);
- if(SDRGLUEPOINT_NOTFOUND != nNum)
+ if(pCandidate)
{
- rGP=(*pGPL)[nNum];
+ 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);
- }
+ //if(bRet && bSetAbsPos)
+ //{
+ //
+ //
+ // const basegfx::B2DPoint aPt(rGP.GetAbsolutePos(sdr::legacy::GetSnapRange(*mpConnectedSdrObject)));
+ //
+ // rGP.SetPos(aPt + maObjOfs);
+ //}
return bRet;
}
@@ -120,7 +135,7 @@ basegfx::B2DPoint& SdrEdgeInfoRec::ImpGetLineVersatzPoint(SdrEdgeLineCode eLineC
return aMiddleLine;
}
-sal_uInt16 SdrEdgeInfoRec::ImpGetPolyIdx(SdrEdgeLineCode eLineCode, sal_uInt32 nPointCount) const
+sal_uInt32 SdrEdgeInfoRec::ImpGetPolyIdx(SdrEdgeLineCode eLineCode, sal_uInt32 nPointCount) const
{
switch (eLineCode)
{
@@ -135,7 +150,7 @@ sal_uInt16 SdrEdgeInfoRec::ImpGetPolyIdx(SdrEdgeLineCode eLineCode, sal_uInt32 n
bool SdrEdgeInfoRec::ImpIsHorzLine(SdrEdgeLineCode eLineCode, sal_uInt32 nPointCount) const
{
- sal_uInt16 nIdx(ImpGetPolyIdx(eLineCode, nPointCount));
+ sal_uInt32 nIdx(ImpGetPolyIdx(eLineCode, nPointCount));
bool bHorz(0 == nAngle1 || 18000 == nAngle1);
if(OBJ2LINE2 == eLineCode || OBJ2LINE3 == eLineCode)
@@ -453,9 +468,9 @@ sal_uInt16 SdrEdgeObj::GetObjIdentifier() const
return sal_uInt16(OBJ_EDGE);
}
-SdrGluePoint SdrEdgeObj::GetVertexGluePoint(sal_uInt32 nNum) const
+sdr::glue::Point SdrEdgeObj::GetVertexGluePoint(sal_uInt32 nNum) const
{
- basegfx::B2DPoint aPoint(0.0, 0.0);
+ //basegfx::B2DPoint aPoint(0.0, 0.0);
const sal_uInt32 nPntAnz(maEdgeTrack.count());
basegfx::B2DPoint aOldPoint;
@@ -480,26 +495,37 @@ SdrGluePoint SdrEdgeObj::GetVertexGluePoint(sal_uInt32 nNum) const
aOldPoint = (maEdgeTrack.getB2DPoint((nPntAnz/2) - 1) + maEdgeTrack.getB2DPoint(nPntAnz/2)) * 0.5;
}
}
-
- aOldPoint -= sdr::legacy::GetSnapRange(*this).getCenter();
}
- SdrGluePoint aGP(aOldPoint);
- aGP.SetPercent(false);
+ // TTTT:GLUE
+ //sdr::glue::Point aGP(aOldPoint);
+ //aGP.SetPercent(false);
- return aGP;
-}
+ // need to make absolute position relative. temporarily correct zero sizes for invert
+ basegfx::B2DHomMatrix aTransform(basegfx::tools::guaranteeMinimalScaling(getSdrObjectTransformation()));
-const SdrGluePointList* SdrEdgeObj::GetGluePointList() const
-{
- return NULL; // Keine benutzerdefinierten Klebepunkte fuer Verbinder #31671#
+ 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
}
-SdrGluePointList* SdrEdgeObj::ForceGluePointList()
+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);
@@ -548,8 +574,9 @@ bool SdrEdgeObj::CheckNodeConnection(bool bTail1) const
if(rCon.mpConnectedSdrObject && rCon.mpConnectedSdrObject->getSdrPageFromSdrObject() == getSdrPageFromSdrObject() && nPtAnz)
{
- const SdrGluePointList* pGPL = rCon.mpConnectedSdrObject->GetGluePointList();
- const sal_uInt32 nConAnz(pGPL ? pGPL->GetCount() : 0);
+ 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));
@@ -557,16 +584,25 @@ bool SdrEdgeObj::CheckNodeConnection(bool bTail1) const
{
if(i < nConAnz)
{
- // UserDefined
- const basegfx::B2DPoint aGluePos((*pGPL)[i].GetAbsolutePos(sdr::legacy::GetSnapRange(*rCon.mpConnectedSdrObject)));
+ // UserDefined or CustomShape
+ const sdr::glue::Point* 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 //if (i<nConAnz+4)
{
// Vertex
- const SdrGluePoint aPt(rCon.mpConnectedSdrObject->GetVertexGluePoint(i - nConAnz));
- const basegfx::B2DPoint aGluePos(aPt.GetAbsolutePos(sdr::legacy::GetSnapRange(*rCon.mpConnectedSdrObject)));
+ const sdr::glue::Point aPt(rCon.mpConnectedSdrObject->GetVertexGluePoint(i - nConAnz));
+ const basegfx::B2DPoint aGluePos(rCon.mpConnectedSdrObject->getSdrObjectTransformation() * aPt.getUnitPosition());
bRet = (aTail == aGluePos);
}
@@ -690,22 +726,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|=SDRESC_LEFT | SDRESC_TOP;
- else nRet|=SDRESC_LEFT | SDRESC_BOTTOM;
+ 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;
} else { // Rechts
- if (dyo<dyu) nRet|=SDRESC_RIGHT | SDRESC_TOP;
- else nRet|=SDRESC_RIGHT | SDRESC_BOTTOM;
+ 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;
}
return nRet;
}
if (dx<dy) { // waagerecht
if (bxMitt) return SDRESC_HORZ;
- if (dxl<dxr) return SDRESC_LEFT;
- else return SDRESC_RIGHT;
+ if (dxl<dxr) return sdr::glue::Point::ESCAPE_DIRECTION_LEFT;
+ else return sdr::glue::Point::ESCAPE_DIRECTION_RIGHT;
} else { // senkrecht
if (byMitt) return SDRESC_VERT;
- if (dyo<dyu) return SDRESC_TOP;
- else return SDRESC_BOTTOM;
+ if (dyo<dyu) return sdr::glue::Point::ESCAPE_DIRECTION_TOP;
+ else return sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM;
}
}
@@ -792,7 +828,7 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcEdgeTrack(
basegfx::B2DPoint aPt1(maEdgeTrack.getB2DPoint(0));
basegfx::B2DPoint aPt2(maEdgeTrack.getB2DPoint(nCount - 1));
const basegfx::B2DRange aBaseRange(aPt1, aPt2);
- SdrGluePoint aGP1,aGP2;
+ sdr::glue::Point aGP1,aGP2;
sal_uInt16 nEsc1(SDRESC_ALL);
sal_uInt16 nEsc2(SDRESC_ALL);
basegfx::B2DRange aBoundRange1;
@@ -815,7 +851,7 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcEdgeTrack(
aBoundRange1 = rCon1.mpConnectedSdrObject->getObjectRange(0);
}
- aBoundRange1.transform(basegfx::tools::createTranslateB2DHomMatrix(rCon1.maObjOfs));
+ // 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());
@@ -826,7 +862,7 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcEdgeTrack(
}
else
{
- aBewareRange1 = aBoundRange1 = basegfx::B2DRange(aPt1 + rCon1.maObjOfs);
+ aBewareRange1 = aBoundRange1 = basegfx::B2DRange(aPt1); // TTTT:GLUE + rCon1.maObjOfs);
}
if(bCon2)
@@ -840,7 +876,7 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcEdgeTrack(
aBoundRange2 = rCon2.mpConnectedSdrObject->getObjectRange(0);
}
- aBoundRange2.transform(basegfx::tools::createTranslateB2DHomMatrix(rCon2.maObjOfs));
+ // 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());
@@ -851,7 +887,7 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcEdgeTrack(
}
else
{
- aBewareRange2 = aBoundRange2 = basegfx::B2DRange(aPt2 + rCon2.maObjOfs);
+ aBewareRange2 = aBoundRange2 = basegfx::B2DRange(aPt2); // TTTT:GLUE + rCon2.maObjOfs);
}
sal_uInt32 nBestQual=0xFFFFFFFF;
@@ -897,14 +933,14 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcEdgeTrack(
rCon1.mnConnectorId = nNum1;
}
- if(bCon1 && rCon1.TakeGluePoint(aGP1, true))
+ if(bCon1 && rCon1.TakeGluePoint(aGP1/*TTTT:GLUE, true*/))
{
- aPt1 = aGP1.GetPos();
- nEsc1 = aGP1.GetEscDir();
+ aPt1 = rCon1.mpConnectedSdrObject->getSdrObjectTransformation() * aGP1.getUnitPosition();
+ nEsc1 = aGP1.getEscapeDirections();
- if(SDRESC_SMART == nEsc1)
+ if(sdr::glue::Point::ESCAPE_DIRECTION_SMART == nEsc1)
{
- nEsc1 = ImpCalcEscAngle(rCon1.mpConnectedSdrObject, aPt1 - rCon1.maObjOfs);
+ nEsc1 = ImpCalcEscAngle(rCon1.mpConnectedSdrObject, aPt1); // TTTT:GLUE - rCon1.maObjOfs);
}
}
@@ -915,24 +951,24 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcEdgeTrack(
rCon2.mnConnectorId = nNum2;
}
- if(bCon2 && rCon2.TakeGluePoint(aGP2, true))
+ if(bCon2 && rCon2.TakeGluePoint(aGP2/*TTTT:GLUE, true*/))
{
- aPt2 = aGP2.GetPos();
- nEsc2 = aGP2.GetEscDir();
+ aPt2 = rCon2.mpConnectedSdrObject->getSdrObjectTransformation() * aGP2.getUnitPosition();
+ nEsc2 = aGP2.getEscapeDirections();
- if(SDRESC_SMART == nEsc2)
+ if(sdr::glue::Point::ESCAPE_DIRECTION_SMART == nEsc2)
{
- nEsc2 = ImpCalcEscAngle(rCon2.mpConnectedSdrObject, aPt2 - rCon2.maObjOfs);
+ nEsc2 = ImpCalcEscAngle(rCon2.mpConnectedSdrObject, aPt2); // TTTT:GLUE - rCon2.maObjOfs);
}
}
for(long nA1(0); nA1 < 36000; nA1 += 9000)
{
- const sal_uInt16 nE1(!nA1 ? SDRESC_RIGHT : 9000 == nA1 ? SDRESC_TOP : 18000 == nA1 ? SDRESC_LEFT : 27000 == nA1 ? SDRESC_BOTTOM : 0);
+ 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);
for(long nA2(0); nA2 < 36000; nA2 += 9000)
{
- const sal_uInt16 nE2(!nA2 ? SDRESC_RIGHT : 9000 == nA2 ? SDRESC_TOP : 18000 == nA2 ? SDRESC_LEFT : 27000 == nA2 ? SDRESC_BOTTOM : 0);
+ 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);
if((nEsc1 & nE1) && (nEsc2 & nE2))
{
@@ -1554,7 +1590,7 @@ basegfx::B2DPolygon ImpOldCalcEdgeTrack(
}
if (bInfo) { // nun die Linienversaetze auf aXP1 anwenden
if (pInfo->nMiddleLine!=0xFFFF) {
- sal_uInt16 nIdx=pInfo->ImpGetPolyIdx(MIDDLELINE,aXP1.GetPointCount());
+ const sal_uInt16 nIdx = (sal_uInt16)pInfo->ImpGetPolyIdx(MIDDLELINE,aXP1.GetPointCount());
if (pInfo->ImpIsHorzLine(MIDDLELINE,aXP1.GetPointCount())) {
aXP1[nIdx].Y()+=pInfo->aMiddleLine.getY();
aXP1[nIdx+1].Y()+=pInfo->aMiddleLine.getY();
@@ -1564,7 +1600,7 @@ basegfx::B2DPolygon ImpOldCalcEdgeTrack(
}
}
if (pInfo->nObj1Lines>=2) {
- sal_uInt16 nIdx=pInfo->ImpGetPolyIdx(OBJ1LINE2,aXP1.GetPointCount());
+ const sal_uInt16 nIdx = (sal_uInt16)pInfo->ImpGetPolyIdx(OBJ1LINE2,aXP1.GetPointCount());
if (pInfo->ImpIsHorzLine(OBJ1LINE2,aXP1.GetPointCount())) {
aXP1[nIdx].Y()+=pInfo->aObj1Line2.getY();
aXP1[nIdx+1].Y()+=pInfo->aObj1Line2.getY();
@@ -1574,7 +1610,7 @@ basegfx::B2DPolygon ImpOldCalcEdgeTrack(
}
}
if (pInfo->nObj1Lines>=3) {
- sal_uInt16 nIdx=pInfo->ImpGetPolyIdx(OBJ1LINE3,aXP1.GetPointCount());
+ const sal_uInt16 nIdx = (sal_uInt16)pInfo->ImpGetPolyIdx(OBJ1LINE3,aXP1.GetPointCount());
if (pInfo->ImpIsHorzLine(OBJ1LINE3,aXP1.GetPointCount())) {
aXP1[nIdx].Y()+=pInfo->aObj1Line3.getY();
aXP1[nIdx+1].Y()+=pInfo->aObj1Line3.getY();
@@ -1584,7 +1620,7 @@ basegfx::B2DPolygon ImpOldCalcEdgeTrack(
}
}
if (pInfo->nObj2Lines>=2) {
- sal_uInt16 nIdx=pInfo->ImpGetPolyIdx(OBJ2LINE2,aXP1.GetPointCount());
+ const sal_uInt16 nIdx = (sal_uInt16)pInfo->ImpGetPolyIdx(OBJ2LINE2,aXP1.GetPointCount());
if (pInfo->ImpIsHorzLine(OBJ2LINE2,aXP1.GetPointCount())) {
aXP1[nIdx].Y()+=pInfo->aObj2Line2.getY();
aXP1[nIdx+1].Y()+=pInfo->aObj2Line2.getY();
@@ -1594,7 +1630,7 @@ basegfx::B2DPolygon ImpOldCalcEdgeTrack(
}
}
if (pInfo->nObj2Lines>=3) {
- sal_uInt16 nIdx=pInfo->ImpGetPolyIdx(OBJ2LINE3,aXP1.GetPointCount());
+ const sal_uInt16 nIdx = (sal_uInt16)pInfo->ImpGetPolyIdx(OBJ2LINE3,aXP1.GetPointCount());
if (pInfo->ImpIsHorzLine(OBJ2LINE3,aXP1.GetPointCount())) {
aXP1[nIdx].Y()+=pInfo->aObj2Line3.getY();
aXP1[nIdx+1].Y()+=pInfo->aObj2Line3.getY();
@@ -2156,15 +2192,16 @@ basegfx::B2DPolygon SdrEdgeObj::ImplAddConnectorOverlay(SdrDragMethod& rDragMeth
SdrObjConnection aMyCon1(maCon1);
SdrObjConnection aMyCon2(maCon2);
- if (bTail1)
- {
- aMyCon1.maObjOfs *= rDragMethod.getCurrentTransformation();
- }
-
- if (bTail2)
- {
- aMyCon2.maObjOfs *= rDragMethod.getCurrentTransformation();
- }
+ // TTTT:GLUE
+ //if (bTail1)
+ //{
+ // aMyCon1.maObjOfs *= rDragMethod.getCurrentTransformation();
+ //}
+ //
+ //if (bTail2)
+ //{
+ // aMyCon2.maObjOfs *= rDragMethod.getCurrentTransformation();
+ //}
SdrEdgeInfoRec aInfo(maEdgeInfo);
aResult = ImpCalcEdgeTrack(aMyCon1, aMyCon2, &aInfo);
@@ -2331,8 +2368,9 @@ 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 SdrGluePointList* pGPL = pObj->GetGluePointList();
- sal_uInt32 nConAnz=pGPL==NULL ? 0 : pGPL->GetCount();
+ 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;
bool bUserFnd=false;
sal_uInt32 nBestDist=0xFFFFFFFF;
@@ -2347,19 +2385,30 @@ void SdrEdgeObj::FindConnector(
if(bUser)
{
- const SdrGluePoint& rGP=(*pGPL)[nConNum];
- const basegfx::B2DPoint aPoint(rGP.GetAbsolutePos(sdr::legacy::GetSnapRange(*pObj)));
- aConPos=Point(basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()));
- nConNum=rGP.GetId();
- bOk=true;
+ const sdr::glue::Point* pCandidate = aGluePointVector[nConNum];
+
+ if(pCandidate)
+ {
+ const basegfx::B2DPoint aPoint(pObj->getSdrObjectTransformation() * pCandidate->getUnitPosition());
+
+ aConPos = Point(basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()));
+ nConNum = pCandidate->getID();
+ bOk = true;
+ }
+ else
+ {
+ OSL_ENSURE(false, "Got sdr::glue::PointVector with empty entries (!)");
+ }
}
else if (bVertex && !bUserFnd)
{
- nConNum=nConNum-nConAnz;
- SdrGluePoint aLocalPt(pObj->GetVertexGluePoint(nConNum));
- const basegfx::B2DPoint aPoint(aLocalPt.GetAbsolutePos(sdr::legacy::GetSnapRange(*pObj)));
- aConPos=Point(basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()));
- bOk=true;
+ nConNum = nConNum - nConAnz;
+
+ const sdr::glue::Point aLocalPt(pObj->GetVertexGluePoint(nConNum));
+ const basegfx::B2DPoint aPoint(pObj->getSdrObjectTransformation() * aLocalPt.getUnitPosition());
+
+ aConPos = Point(basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()));
+ bOk = true;
}
else if (bCenter && !bUserFnd && !bEdge)
{
@@ -2700,21 +2749,25 @@ void SdrEdgeObj::setGluePointIndex(bool bTail, sal_Int32 nIndex /* = -1 */ )
if( nIndex > 3 )
{
- nIndex -= 3; // SJ: the start api index is 0, whereas the implementation in svx starts from 1
+ // 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
// for user defined glue points we have
// to get the id for this index first
- const SdrGluePointList* pList = rConn1.GetObject() ? rConn1.GetObject()->GetGluePointList() : NULL;
+ const sdr::glue::List* pList = rConn1.GetObject() ? rConn1.GetObject()->GetGluePointList(false) : NULL;
- if( pList == NULL || SDRGLUEPOINT_NOTFOUND == pList->FindGluePoint((sal_uInt16)nIndex) )
+ if(!pList || !pList->findByID(nIndex))
+ {
return;
+ }
}
else if( nIndex < 0 )
{
nIndex = 0;
}
- rConn1.SetConnectorId( (sal_uInt16)nIndex );
+ rConn1.SetConnectorId(nIndex);
SetChanged();
ImpRecalcEdgeTrack();
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index 7adee555e71c..cee9cbfd1175 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -45,7 +45,7 @@
#include <svx/svdmodel.hxx>
#include <svx/svdundo.hxx>
#include <svx/svdview.hxx>
-#include <svx/svdglue.hxx>
+#include <svx/sdrglue.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdograf.hxx>
#include <svx/svdattrx.hxx>
@@ -55,7 +55,7 @@
#include <svx/sdr/overlay/overlayobjectlist.hxx>
#include <svx/sdr/overlay/overlayrollingrectangle.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
-#include <svx/svdglue.hxx>
+#include <svx/sdrglue.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdview.hxx>
#include <svl/itemiter.hxx>
@@ -965,20 +965,28 @@ void SdrPaintView::GlueInvalidate() const
for(sal_uInt32 nObjNum(0); nObjNum < nObjAnz; nObjNum++)
{
- const SdrObject* pObj=pOL->GetObj(nObjNum);
- const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ const SdrObject* pObj = pOL->GetObj(nObjNum);
+ const sdr::glue::List* pGPL = pObj ? pObj->GetGluePointList(false) : 0;
- if(pGPL && pGPL->GetCount())
+ if(pGPL)
{
- const basegfx::B2DRange aObjectRange(sdr::legacy::GetSnapRange(*pObj));
+ const sdr::glue::PointVector aGluePointVecor(pGPL->getVector());
- for(sal_uInt32 a(0); a < pGPL->GetCount(); a++)
+ for(sal_uInt32 a(0); a < aGluePointVecor.size(); a++)
{
- const SdrGluePoint& rCandidate = (*pGPL)[a];
- const basegfx::B2DPoint aPos(rCandidate.GetAbsolutePos(aObjectRange));
- const basegfx::B2DRange aRange(aPos - aLogicHalfSevenPix, aPos + aLogicHalfSevenPix);
+ const sdr::glue::Point* pCandidate = aGluePointVecor[a];
- InvalidateOneWin((Window&)rOutDev, aRange);
+ 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 (!)");
+ }
}
}
}
diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx
index fae45677f190..a281fb8d3d70 100644
--- a/svx/source/svdraw/svdpoev.cxx
+++ b/svx/source/svdraw/svdpoev.cxx
@@ -682,7 +682,7 @@ void SdrPolyEditView::TransformMarkedPoints(
aStr = ImpGetResStr(STR_EditResize);
break;
case SDRREPFUNC_OBJ_ROTATE:
- aStr = ImpGetResStr(STR_EditResize); // no own string for rotate ?!?
+ aStr = ImpGetResStr(STR_EditRotate /*STR_EditResize*/); // TTTT: maybe there is, check // no own string for rotate ?!?
break;
}
diff --git a/svx/source/unodraw/gluepts.cxx b/svx/source/unodraw/gluepts.cxx
index 4c729eb92548..0b6786fbdf6b 100644
--- a/svx/source/unodraw/gluepts.cxx
+++ b/svx/source/unodraw/gluepts.cxx
@@ -19,21 +19,16 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
+
#include <com/sun/star/container/XIdentifierContainer.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
-#ifndef _COM_SUN_STAR_DRAWING_GLUEPOINT2_HDL_
#include <com/sun/star/drawing/GluePoint2.hpp>
-#endif
-
#include <cppuhelper/implbase2.hxx>
-
#include <svx/svdmodel.hxx>
#include <svx/svdobj.hxx>
-#include <svx/svdglue.hxx>
+#include <svx/sdrglue.hxx>
#include <svx/svdpage.hxx>
using namespace ::com::sun::star;
@@ -81,134 +76,6 @@ public:
virtual sal_Bool SAL_CALL hasElements( ) throw( uno::RuntimeException);
};
-static void convert( const SdrGluePoint& rSdrGlue, drawing::GluePoint2& rUnoGlue ) throw()
-{
- rUnoGlue.Position.X = basegfx::fround(rSdrGlue.GetPos().getX());
- rUnoGlue.Position.Y = basegfx::fround(rSdrGlue.GetPos().getY());
- rUnoGlue.IsRelative = rSdrGlue.IsPercent();
-
- switch( rSdrGlue.GetAlign() )
- {
- case SDRVERTALIGN_TOP|SDRHORZALIGN_LEFT:
- rUnoGlue.PositionAlignment = drawing::Alignment_TOP_LEFT;
- break;
- case SDRHORZALIGN_CENTER|SDRVERTALIGN_TOP:
- rUnoGlue.PositionAlignment = drawing::Alignment_TOP;
- break;
- case SDRVERTALIGN_TOP|SDRHORZALIGN_RIGHT:
- rUnoGlue.PositionAlignment = drawing::Alignment_TOP_RIGHT;
- break;
- case SDRHORZALIGN_CENTER|SDRVERTALIGN_CENTER:
- rUnoGlue.PositionAlignment = drawing::Alignment_CENTER;
- break;
- case SDRHORZALIGN_RIGHT|SDRVERTALIGN_CENTER:
- rUnoGlue.PositionAlignment = drawing::Alignment_RIGHT;
- break;
- case SDRHORZALIGN_LEFT|SDRVERTALIGN_BOTTOM:
- rUnoGlue.PositionAlignment = drawing::Alignment_BOTTOM_LEFT;
- break;
- case SDRHORZALIGN_CENTER|SDRVERTALIGN_BOTTOM:
- rUnoGlue.PositionAlignment = drawing::Alignment_BOTTOM;
- break;
- case SDRHORZALIGN_RIGHT|SDRVERTALIGN_BOTTOM:
- rUnoGlue.PositionAlignment = drawing::Alignment_BOTTOM_RIGHT;
- break;
-// case SDRHORZALIGN_LEFT:
- default:
- rUnoGlue.PositionAlignment = drawing::Alignment_LEFT;
- break;
- }
-
- switch( rSdrGlue.GetEscDir() )
- {
- case SDRESC_LEFT:
- rUnoGlue.Escape = drawing::EscapeDirection_LEFT;
- break;
- case SDRESC_RIGHT:
- rUnoGlue.Escape = drawing::EscapeDirection_RIGHT;
- break;
- case SDRESC_TOP:
- rUnoGlue.Escape = drawing::EscapeDirection_UP;
- break;
- case SDRESC_BOTTOM:
- rUnoGlue.Escape = drawing::EscapeDirection_DOWN;
- break;
- case SDRESC_HORZ:
- rUnoGlue.Escape = drawing::EscapeDirection_HORIZONTAL;
- break;
- case SDRESC_VERT:
- rUnoGlue.Escape = drawing::EscapeDirection_VERTICAL;
- break;
-// case SDRESC_SMART:
- default:
- rUnoGlue.Escape = drawing::EscapeDirection_SMART;
- break;
- }
-}
-
-static void convert( const drawing::GluePoint2& rUnoGlue, SdrGluePoint& rSdrGlue ) throw()
-{
- rSdrGlue.SetPos( basegfx::B2DPoint( rUnoGlue.Position.X, rUnoGlue.Position.Y ) );
- rSdrGlue.SetPercent( rUnoGlue.IsRelative );
-
- switch( rUnoGlue.PositionAlignment )
- {
- case drawing::Alignment_TOP_LEFT:
- rSdrGlue.SetAlign( SDRVERTALIGN_TOP|SDRHORZALIGN_LEFT );
- break;
- case drawing::Alignment_TOP:
- rSdrGlue.SetAlign( SDRHORZALIGN_CENTER|SDRVERTALIGN_TOP );
- break;
- case drawing::Alignment_TOP_RIGHT:
- rSdrGlue.SetAlign( SDRVERTALIGN_TOP|SDRHORZALIGN_RIGHT );
- break;
- case drawing::Alignment_CENTER:
- rSdrGlue.SetAlign( SDRHORZALIGN_CENTER|SDRVERTALIGN_CENTER );
- break;
- case drawing::Alignment_RIGHT:
- rSdrGlue.SetAlign( SDRHORZALIGN_RIGHT|SDRVERTALIGN_CENTER );
- break;
- case drawing::Alignment_BOTTOM_LEFT:
- rSdrGlue.SetAlign( SDRHORZALIGN_LEFT|SDRVERTALIGN_BOTTOM );
- break;
- case drawing::Alignment_BOTTOM:
- rSdrGlue.SetAlign( SDRHORZALIGN_CENTER|SDRVERTALIGN_BOTTOM );
- break;
- case drawing::Alignment_BOTTOM_RIGHT:
- rSdrGlue.SetAlign( SDRHORZALIGN_RIGHT|SDRVERTALIGN_BOTTOM );
- break;
-// case SDRHORZALIGN_LEFT:
- default:
- rSdrGlue.SetAlign( SDRHORZALIGN_LEFT );
- break;
- }
- switch( rUnoGlue.Escape )
- {
- case drawing::EscapeDirection_LEFT:
- rSdrGlue.SetEscDir(SDRESC_LEFT);
- break;
- case drawing::EscapeDirection_RIGHT:
- rSdrGlue.SetEscDir(SDRESC_RIGHT);
- break;
- case drawing::EscapeDirection_UP:
- rSdrGlue.SetEscDir(SDRESC_TOP);
- break;
- case drawing::EscapeDirection_DOWN:
- rSdrGlue.SetEscDir(SDRESC_BOTTOM);
- break;
- case drawing::EscapeDirection_HORIZONTAL:
- rSdrGlue.SetEscDir(SDRESC_HORZ);
- break;
- case drawing::EscapeDirection_VERTICAL:
- rSdrGlue.SetEscDir(SDRESC_VERT);
- break;
-// case drawing::EscapeDirection_SMART:
- default:
- rSdrGlue.SetEscDir(SDRESC_SMART);
- break;
- }
-}
-
SvxUnoGluePointAccess::SvxUnoGluePointAccess( SdrObject* pObject ) throw()
: mpObject( pObject )
{
@@ -223,22 +90,22 @@ sal_Int32 SAL_CALL SvxUnoGluePointAccess::insert( const uno::Any& aElement ) thr
{
if( mpObject.is() )
{
- SdrGluePointList* pList = mpObject->ForceGluePointList();
+ sdr::glue::List* pList = mpObject->GetGluePointList(true);
+
if( pList )
{
- // second, insert the new glue point
drawing::GluePoint2 aUnoGlue;
if( aElement >>= aUnoGlue )
{
- SdrGluePoint aSdrGlue;
- convert( aUnoGlue, aSdrGlue );
- sal_uInt32 nId = pList->Insert( aSdrGlue );
+ const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale()));
+ const sdr::glue::Point aSdrGlue(aUnoGlue, aAbsoluteScale);
+ const sdr::glue::Point& rAdded = pList->add(aSdrGlue);
// only repaint, no objectchange
mpObject->ActionChanged();
- return (sal_Int32)((*pList)[nId].GetId() + NON_USER_DEFINED_GLUE_POINTS) - 1;
+ return rAdded.getID() + NON_USER_DEFINED_GLUE_POINTS;
}
throw lang::IllegalArgumentException();
@@ -252,17 +119,16 @@ void SAL_CALL SvxUnoGluePointAccess::removeByIdentifier( sal_Int32 Identifier )
{
if( mpObject.is() && ( Identifier >= NON_USER_DEFINED_GLUE_POINTS ))
{
- const sal_uInt16 nId = (sal_uInt16)(Identifier - NON_USER_DEFINED_GLUE_POINTS) + 1;
-
- SdrGluePointList* pList = const_cast<SdrGluePointList*>(mpObject->GetGluePointList());
- const sal_uInt32 nCount = pList ? pList->GetCount() : 0;
- sal_uInt32 i;
+ const sal_uInt32 nId(Identifier - NON_USER_DEFINED_GLUE_POINTS);
+ sdr::glue::List* pList = mpObject->GetGluePointList(false);
- for( i = 0; i < nCount; i++ )
+ if(pList)
{
- if( (*pList)[i].GetId() == nId )
+ const sdr::glue::Point* pCandidate = pList->findByID(nId);
+
+ if(pCandidate)
{
- pList->Delete( i );
+ pList->remove(*pCandidate);
// only repaint, no objectchange
mpObject->ActionChanged();
@@ -270,6 +136,23 @@ 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();
@@ -281,21 +164,24 @@ void SAL_CALL SvxUnoGluePointAccess::replaceByIdentifer( sal_Int32 Identifier, c
if(mpObject.is())
{
struct drawing::GluePoint2 aGluePoint;
+
if( (Identifier < NON_USER_DEFINED_GLUE_POINTS) || !(aElement >>= aGluePoint))
throw lang::IllegalArgumentException();
- const sal_uInt16 nId = (sal_uInt16)( Identifier - NON_USER_DEFINED_GLUE_POINTS ) + 1;
+ const sal_uInt32 nId(Identifier - NON_USER_DEFINED_GLUE_POINTS);
+ sdr::glue::List* pList = mpObject->GetGluePointList(false);
- SdrGluePointList* pList = const_cast< SdrGluePointList* >( mpObject->GetGluePointList() );
- const sal_uInt32 nCount = pList ? pList->GetCount() : 0;
- sal_uInt32 i;
- for( i = 0; i < nCount; i++ )
+ if(pList)
{
- if( (*pList)[i].GetId() == nId )
+ sdr::glue::Point* pCandidate = pList->findByID(nId);
+
+ if(pCandidate)
{
- // change the glue point
- SdrGluePoint& rTempPoint = (*pList)[i];
- convert( aGluePoint, rTempPoint );
+ // 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);
+
+ *pCandidate = aSdrGlue;
// only repaint, no objectchange
mpObject->ActionChanged();
@@ -304,6 +190,24 @@ 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();
}
}
@@ -313,37 +217,50 @@ uno::Any SAL_CALL SvxUnoGluePointAccess::getByIdentifier( sal_Int32 Identifier )
{
if(mpObject.is())
{
- struct drawing::GluePoint2 aGluePoint;
-
if( Identifier < NON_USER_DEFINED_GLUE_POINTS ) // default glue point?
{
- SdrGluePoint aTempPoint = mpObject->GetVertexGluePoint( Identifier );
- aGluePoint.IsUserDefined = sal_False;
- convert( aTempPoint, aGluePoint );
+ const sdr::glue::Point aTempPoint(mpObject->GetVertexGluePoint(Identifier));
+ const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale()));
+ const drawing::GluePoint2 aGluePoint(aTempPoint.convertToGluePoint2(aAbsoluteScale));
+
return uno::makeAny( aGluePoint );
}
else
{
- const sal_uInt16 nId = (sal_uInt16)( Identifier - NON_USER_DEFINED_GLUE_POINTS ) + 1;
+ const sal_uInt32 nId(Identifier - NON_USER_DEFINED_GLUE_POINTS);
+ const sdr::glue::List* pList = mpObject->GetGluePointList(false);
- const SdrGluePointList* pList = mpObject->GetGluePointList();
- const sal_uInt32 nCount = pList ? pList->GetCount() : 0;
-
- for( sal_uInt32 i = 0; i < nCount; i++ )
+ if(pList)
{
- const SdrGluePoint& rTempPoint = (*pList)[i];
- if( rTempPoint.GetId() == nId )
+ const sdr::glue::Point* pCandidate = pList->findByID(nId);
+
+ if(pCandidate)
{
- // #i38892#
- if(rTempPoint.IsUserDefined())
- {
- aGluePoint.IsUserDefined = sal_True;
- }
+ const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale()));
+ const drawing::GluePoint2 aGluePoint(pCandidate->convertToGluePoint2(aAbsoluteScale));
- convert( rTempPoint, aGluePoint );
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 );
+ // }
+ //}
}
}
@@ -354,18 +271,43 @@ uno::Sequence< sal_Int32 > SAL_CALL SvxUnoGluePointAccess::getIdentifiers() thro
{
if( mpObject.is() )
{
- const SdrGluePointList* pList = mpObject->GetGluePointList();
- const sal_uInt32 nCount = pList ? pList->GetCount() : 0;
- sal_uInt32 i;
-
- uno::Sequence< sal_Int32 > aIdSequence( nCount + NON_USER_DEFINED_GLUE_POINTS );
+ const sdr::glue::List* pList = mpObject->GetGluePointList(false);
+ const sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector());
+ uno::Sequence< sal_Int32 > aIdSequence(aGluePointVector.size() + NON_USER_DEFINED_GLUE_POINTS);
sal_Int32 *pIdentifier = aIdSequence.getArray();
+ sal_uInt32 i(0);
- for( i = 0; i < NON_USER_DEFINED_GLUE_POINTS; i++ )
+ for(i = 0; i < NON_USER_DEFINED_GLUE_POINTS; i++)
+ {
*pIdentifier++ = i;
+ }
+
+ for(i = 0; i < aGluePointVector.size(); i++)
+ {
+ const sdr::glue::Point* pCandidate = aGluePointVector[i];
+
+ if(pCandidate)
+ {
+ *pIdentifier++ = pCandidate->getID() + NON_USER_DEFINED_GLUE_POINTS;
+ }
+ else
+ {
+ OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty entries (!)");
+ }
+ }
- for( i = 0; i < nCount; i++ )
- *pIdentifier++ = ( (*pList)[i].GetId() + NON_USER_DEFINED_GLUE_POINTS ) - 1;
+ // 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;
}
@@ -379,22 +321,22 @@ uno::Sequence< sal_Int32 > SAL_CALL SvxUnoGluePointAccess::getIdentifiers() thro
/* deprecated */
// XIndexContainer
-void SAL_CALL SvxUnoGluePointAccess::insertByIndex( sal_Int32, const uno::Any& Element )
- throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
- lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL SvxUnoGluePointAccess::insertByIndex( sal_Int32, const uno::Any& Element ) throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
{
if( mpObject.is() )
{
- SdrGluePointList* pList = mpObject->ForceGluePointList();
+ sdr::glue::List* pList = mpObject->GetGluePointList(true);
+
if( pList )
{
- SdrGluePoint aSdrGlue;
drawing::GluePoint2 aUnoGlue;
if( Element >>= aUnoGlue )
{
- convert( aUnoGlue, aSdrGlue );
- pList->Insert( aSdrGlue );
+ const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale()));
+ const sdr::glue::Point aSdrGlue(aUnoGlue, aAbsoluteScale);
+
+ pList->add(aSdrGlue);
// only repaint, no objectchange
mpObject->ActionChanged();
@@ -409,23 +351,43 @@ void SAL_CALL SvxUnoGluePointAccess::insertByIndex( sal_Int32, const uno::Any& E
throw lang::IndexOutOfBoundsException();
}
-void SAL_CALL SvxUnoGluePointAccess::removeByIndex( sal_Int32 Index )
- throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL SvxUnoGluePointAccess::removeByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
{
if( mpObject.is() )
{
- SdrGluePointList* pList = mpObject->ForceGluePointList();
+ sdr::glue::List* pList = mpObject->GetGluePointList(true);
+
if( pList )
{
Index -= 4;
- if( Index >= 0 && Index < (sal_Int32)pList->GetCount() )
+
+ if(Index >= 0)
{
- pList->Delete( (sal_uInt32)Index );
+ const sdr::glue::Point* pCandidate = pList->findByID(Index);
- // only repaint, no objectchange
- mpObject->ActionChanged();
+ if(pCandidate)
+ {
+ pList->remove(*pCandidate);
- return;
+ // 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;
+ //}
}
}
}
@@ -434,25 +396,45 @@ void SAL_CALL SvxUnoGluePointAccess::removeByIndex( sal_Int32 Index )
}
// XIndexReplace
-void SAL_CALL SvxUnoGluePointAccess::replaceByIndex( sal_Int32 Index, const uno::Any& Element )
- throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException,
- uno::RuntimeException)
+void SAL_CALL SvxUnoGluePointAccess::replaceByIndex( sal_Int32 Index, const uno::Any& Element ) throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
{
drawing::GluePoint2 aUnoGlue;
+
if(!(Element >>= aUnoGlue))
throw lang::IllegalArgumentException();
Index -= 4;
+
if( mpObject.is() && Index >= 0 )
{
- SdrGluePointList* pList = const_cast< SdrGluePointList* >( mpObject->GetGluePointList() );
- if( pList && Index < (sal_Int32)pList->GetCount() )
+ const sdr::glue::List* pList = mpObject->GetGluePointList(false);
+ const sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector());
+
+ if(Index < (sal_Int32)aGluePointVector.size())
{
- SdrGluePoint& rGlue = (*pList)[(sal_uInt32)Index];
- convert( aUnoGlue, rGlue );
+ sdr::glue::Point* pCandidate = aGluePointVector[Index];
+
+ if(pCandidate)
+ {
+ const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale()));
+ const sdr::glue::Point aSdrGlue(aUnoGlue, aAbsoluteScale);
- // only repaint, no objectchange
- mpObject->ActionChanged();
+ *pCandidate = aSdrGlue;
+
+ // only repaint, no objectchange
+ mpObject->ActionChanged();
+ }
+ else
+ {
+ 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();
}
}
@@ -460,52 +442,70 @@ void SAL_CALL SvxUnoGluePointAccess::replaceByIndex( sal_Int32 Index, const uno:
}
// XIndexAccess
-sal_Int32 SAL_CALL SvxUnoGluePointAccess::getCount()
- throw(uno::RuntimeException)
+sal_Int32 SAL_CALL SvxUnoGluePointAccess::getCount() throw(uno::RuntimeException)
{
sal_Int32 nCount = 0;
+
if( mpObject.is() )
{
// each node has a default of 4 glue points
// and any number of user defined glue points
- nCount += 4;
+ nCount += 4;
- const SdrGluePointList* pList = mpObject->GetGluePointList();
- if( pList )
- nCount += pList->GetCount();
- }
+ const sdr::glue::List* pList = mpObject->GetGluePointList(false);
+ const sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector());
+
+ nCount += aGluePointVector.size();
+ }
return nCount;
}
-uno::Any SAL_CALL SvxUnoGluePointAccess::getByIndex( sal_Int32 Index )
- throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+uno::Any SAL_CALL SvxUnoGluePointAccess::getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
{
if(Index >= 0 && mpObject.is())
{
- struct drawing::GluePoint2 aGluePoint;
-
if( Index < 4 ) // default glue point?
{
- SdrGluePoint aTempPoint = mpObject->GetVertexGluePoint( (sal_uInt32)Index );
- aGluePoint.IsUserDefined = sal_False;
- convert( aTempPoint, aGluePoint );
+ const sdr::glue::Point aTempPoint(mpObject->GetVertexGluePoint(Index));
+ const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale()));
+ const drawing::GluePoint2 aGluePoint(aTempPoint.convertToGluePoint2(aAbsoluteScale));
uno::Any aAny;
+
aAny <<= aGluePoint;
return aAny;
}
else
{
Index -= 4;
- const SdrGluePointList* pList = mpObject->GetGluePointList();
- if( pList && Index < (sal_Int32)pList->GetCount() )
+ const sdr::glue::List* pList = mpObject->GetGluePointList(false);
+ const sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector());
+
+ if(pList && Index < (sal_Int32)aGluePointVector.size())
{
- const SdrGluePoint& rTempPoint = (*pList)[(sal_uInt32)Index];
- aGluePoint.IsUserDefined = sal_True;
- convert( rTempPoint, aGluePoint );
- uno::Any aAny;
- aAny <<= aGluePoint;
- return aAny;
+ const sdr::glue::Point* pCandidate = aGluePointVector[Index];
+
+ if(pCandidate)
+ {
+ const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale()));
+ const drawing::GluePoint2 aGluePoint(pCandidate->convertToGluePoint2(aAbsoluteScale));
+ uno::Any aAny;
+
+ aAny <<= aGluePoint;
+ return aAny;
+ }
+ else
+ {
+ 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;
}
}
}
@@ -514,14 +514,12 @@ uno::Any SAL_CALL SvxUnoGluePointAccess::getByIndex( sal_Int32 Index )
}
// XElementAccess
-uno::Type SAL_CALL SvxUnoGluePointAccess::getElementType()
- throw( uno::RuntimeException)
+uno::Type SAL_CALL SvxUnoGluePointAccess::getElementType() throw( uno::RuntimeException)
{
return ::getCppuType((const struct drawing::GluePoint2*)0);
}
-sal_Bool SAL_CALL SvxUnoGluePointAccess::hasElements()
- throw( uno::RuntimeException)
+sal_Bool SAL_CALL SvxUnoGluePointAccess::hasElements() throw( uno::RuntimeException)
{
return mpObject.is();
}
@@ -533,3 +531,5 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoGluePointAccess_createInstance(
{
return *new SvxUnoGluePointAccess(pObject);
}
+
+// eof
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index cd0c47186112..fbeeea73674a 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -2107,13 +2107,13 @@ void SAL_CALL SvxCustomShape::setPropertyValue( const OUString& aPropertyName, c
// // #i38892#
// const bool bNeedsMirrorX(((SdrObjCustomShape*)pObject)->IsMirroredX() != bMirroredX);
// const bool bNeedsMirrorY(((SdrObjCustomShape*)pObject)->IsMirroredY() != bMirroredY);
- // boost::scoped_ptr< SdrGluePointList > pListCopy;
+ // boost::scoped_ptr< sdr::glue::List > pListCopy;
//
// if( bNeedsMirrorX || bNeedsMirrorY )
// {
- // const SdrGluePointList* pList = pObject->GetGluePointList();
+ // const sdr::glue::List* pList = pObject->GetGluePointList(false);
// if( pList )
- // pListCopy.reset( new SdrGluePointList(*pList) );
+ // pListCopy.reset( new sdr::glue::List(*pList) );
// }
//
// if ( bNeedsMirrorX )
@@ -2137,7 +2137,7 @@ void SAL_CALL SvxCustomShape::setPropertyValue( const OUString& aPropertyName, c
//
// if( pListCopy )
// {
- // SdrGluePointList* pNewList = const_cast< SdrGluePointList* >( pObject->GetGluePointList() );
+ // sdr::glue::List* pNewList = pObject->GetGluePointList(false);
// if(pNewList)
// *pNewList = *pListCopy;
// }