openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1533203 [2/3] - in /openoffice/branches/alg/aw080/main: basctl/source/dlged/ filter/source/msfilter/ reportdesign/source/ui/report/ sc/source/ui/drawfunc/ sd/source/ui/animations/ sd/source/ui/dlg/ sd/source/ui/func/ sd/source/ui/view/ svx...
Date Thu, 17 Oct 2013 18:36:04 GMT
Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/gluepoint.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/gluepoint.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/gluepoint.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/gluepoint.cxx Thu Oct 17 18:36:03 2013
@@ -21,14 +21,448 @@
 
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svx.hxx"
+
 #include <svx/gluepoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+    namespace glue
+    {
+        GluePoint::GluePoint(
+            const basegfx::B2DPoint& rUnitPosition,
+            sal_uInt16 eEscapeDirections,
+            Alignment eHorizontalAlignment,
+            Alignment eVerticalAlignment,
+            bool bRelative,
+            bool bUserDefined)
+        :   maUnitPosition(basegfx::B2DRange::getUnitB2DRange().clamp(rUnitPosition)),
+            meEscapeDirections(eEscapeDirections),
+            meHorizontalAlignment(eHorizontalAlignment),
+            meVerticalAlignment(eVerticalAlignment),
+            maID(0),
+            mbRelative(bRelative),
+            mbUserDefined(bUserDefined)
+        {
+        }
+
+        basegfx::B2DPoint GluePoint::getUnitPosition() const 
+        { 
+            return basegfx::B2DRange::getUnitB2DRange().clamp(maUnitPosition); 
+        }
+
+        void GluePoint::setUnitPosition(const basegfx::B2DPoint& rNew)
+        {
+            const basegfx::B2DPoint aClampedNew(basegfx::B2DRange::getUnitB2DRange().clamp(rNew));
+
+            if(aClampedNew != maUnitPosition)
+            {
+                maUnitPosition = aClampedNew;
+            }
+        }
+
+        void GluePoint::setRelative(bool bNew)
+        {
+            if(mbRelative != bNew)
+            {
+                mbRelative = bNew;
+
+                if(mbRelative)
+                {
+                    // truncate UnitPosition when switching off; the non-relative mode allows
+                    // values outside the UnitRange to represent positions moving outside the
+                    // range
+                    maUnitPosition = basegfx::B2DRange::getUnitB2DRange().clamp(maUnitPosition);
+                }
+            }
+        }
+
+        void GluePoint::adaptToChangedScale(const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale)
+        {
+            if(!getRelative())
+            {
+                const bool bChangeX(!basegfx::fTools::equal(rOldScale.getX(), rNewScale.getX()));
+                const bool bChangeY(!basegfx::fTools::equal(rOldScale.getY(), rNewScale.getY()));
+
+                if(bChangeX || bChangeY)
+                {
+                    // do not use getUnitPosition() here, we do not want to clamp the value
+                    basegfx::B2DPoint aChangedPos(maUnitPosition);
+
+                    if(bChangeX)
+                    {
+                        // avoid using values below 1.0 when working with relative scales; thus even the
+                        // values outside the unit range will be preserved
+                        const double fCorrectedOldX(std::max(1.0, rOldScale.getX()));
+                        const double fCorrectedNewX(std::max(1.0, rNewScale.getX()));
+
+                        switch(getHorizontalAlignment())
+                        {
+                            case GluePoint::Alignment_Minimum:
+                            {
+                                // anchored left
+                                aChangedPos.setX((aChangedPos.getX() * fCorrectedOldX) / fCorrectedNewX);
+                                break;
+                            }
+                            case GluePoint::Alignment_Center:
+                            {
+                                aChangedPos.setX(((0.5 * fCorrectedNewX) + (fCorrectedOldX * (aChangedPos.getX() - 0.5))) / fCorrectedNewX);
+                                break;
+                            }
+                            default: // case GluePoint::Alignment_Maximum:
+                            {
+                                aChangedPos.setX((fCorrectedNewX - (fCorrectedOldX * (1.0 - aChangedPos.getX()))) / fCorrectedNewX);
+                                break;
+                            }
+                        }
+                    }
+
+                    if(bChangeY)
+                    {
+                        // avoid using values below 1.0 when working with relative scales; thus even the
+                        // values outside the unit range will be preserved
+                        const double fCorrectedOldY(std::max(1.0, rOldScale.getY()));
+                        const double fCorrectedNewY(std::max(1.0, rNewScale.getY()));
+
+                        switch(getVerticalAlignment())
+                        {
+                            case GluePoint::Alignment_Minimum:
+                            {
+                                // anchored left
+                                aChangedPos.setY((aChangedPos.getY() * fCorrectedOldY) / fCorrectedNewY);
+                                break;
+                            }
+                            case GluePoint::Alignment_Center:
+                            {
+                                aChangedPos.setY(((0.5 * fCorrectedNewY) + (fCorrectedOldY * (aChangedPos.getY() - 0.5))) / fCorrectedNewY);
+                                break;
+                            }
+                            default: // case GluePoint::Alignment_Maximum:
+                            {
+                                aChangedPos.setY((fCorrectedNewY - (fCorrectedOldY * (1.0 - aChangedPos.getY()))) / fCorrectedNewY);
+                                break;
+                            }
+                        }
+                    }
+
+                    if(!aChangedPos.equal(maUnitPosition))
+                    {
+                        // do not use setUnitPosition() here, we do not want to clamp the value
+                        maUnitPosition = aChangedPos;
+                    }
+                }
+            }
+        }
+
+        com::sun::star::drawing::GluePoint2 GluePoint::convertToGluePoint2(const basegfx::B2DVector& rAbsoluteScale) const
+        {
+            com::sun::star::drawing::GluePoint2 aRetval;
+
+            // copy UserDefined
+            aRetval.IsUserDefined = getUserDefined();
+
+            // copy relative
+            aRetval.IsRelative = getRelative();
+
+            // copy position; get maUnitPosition directly, we do not want to crop here
+            double fX(maUnitPosition.getX());
+            double fY(maUnitPosition.getY());
+
+            switch(getHorizontalAlignment())
+            {
+                case Alignment_Minimum: break;
+                case Alignment_Center: fX = fX - 0.5; break;
+                case Alignment_Maximum: fX = fX - 1.0; break;
+            }
+
+            switch(getVerticalAlignment())
+            {
+                case Alignment_Minimum: break;
+                case Alignment_Center: fY = fY - 0.5; break;
+                case Alignment_Maximum: fY = fY - 1.0; break;
+            }
+
+            if(aRetval.IsRelative)
+            {
+                fX *= 10000.0;
+                fY *= 10000.0;
+            }
+            else
+            {
+                // avoid values below 1.0 to not lose relative values outside object scale
+                fX *= std::max(1.0, rAbsoluteScale.getX());
+                fY *= std::max(1.0, rAbsoluteScale.getY());
+            }
+
+            aRetval.Position.X = basegfx::fround(fX);
+            aRetval.Position.Y = basegfx::fround(fY);
+
+            // copy alignment
+            switch(getHorizontalAlignment())
+            {
+                case Alignment_Minimum:
+                    switch(getVerticalAlignment())
+                    {
+                        case Alignment_Minimum:
+                            aRetval.PositionAlignment = com::sun::star::drawing::Alignment_TOP_LEFT;
+                            break;
+                        case Alignment_Maximum:
+                            aRetval.PositionAlignment = com::sun::star::drawing::Alignment_BOTTOM_LEFT;
+                            break;
+                        default:
+                        case Alignment_Center:
+                            aRetval.PositionAlignment = com::sun::star::drawing::Alignment_LEFT;
+                            break;
+                    }
+                    break;
+                case Alignment_Maximum:
+                    switch(getVerticalAlignment())
+                    {
+                        case Alignment_Minimum:
+                            aRetval.PositionAlignment = com::sun::star::drawing::Alignment_TOP_RIGHT;
+                            break;
+                        case Alignment_Maximum:
+                            aRetval.PositionAlignment = com::sun::star::drawing::Alignment_BOTTOM_RIGHT;
+                            break;
+                        default:
+                        case Alignment_Center:
+                            aRetval.PositionAlignment = com::sun::star::drawing::Alignment_RIGHT;
+                            break;
+                    }
+                    break;
+                default:
+                case Alignment_Center:
+                    switch(getVerticalAlignment())
+                    {
+                        case Alignment_Minimum:
+                            aRetval.PositionAlignment = com::sun::star::drawing::Alignment_TOP;
+                            break;
+                        case Alignment_Maximum:
+                            aRetval.PositionAlignment = com::sun::star::drawing::Alignment_BOTTOM;
+                            break;
+                        default:
+                        case Alignment_Center:
+                            aRetval.PositionAlignment = com::sun::star::drawing::Alignment_CENTER;
+                            break;
+                    }
+                    break;
+            }
+
+            // copy escape directions
+            switch( getEscapeDirections() )
+            {
+                case ESCAPE_DIRECTION_LEFT:
+                    aRetval.Escape = com::sun::star::drawing::EscapeDirection_LEFT;
+                    break;
+                case ESCAPE_DIRECTION_RIGHT:
+                    aRetval.Escape = com::sun::star::drawing::EscapeDirection_RIGHT;
+                    break;
+                case ESCAPE_DIRECTION_TOP:
+                    aRetval.Escape = com::sun::star::drawing::EscapeDirection_UP;
+                    break;
+                case ESCAPE_DIRECTION_BOTTOM:
+                    aRetval.Escape = com::sun::star::drawing::EscapeDirection_DOWN;
+                    break;
+                case ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_RIGHT:
+                    aRetval.Escape = com::sun::star::drawing::EscapeDirection_HORIZONTAL;
+                    break;
+                case ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_BOTTOM:
+                    aRetval.Escape = com::sun::star::drawing::EscapeDirection_VERTICAL;
+                    break;
+
+                // Unfortunately the enum EscapeDirection in the EscapeDirection.idl definition
+                // is wrong in the sense that it does not reflect the possibility to define a free
+                // combination of the directions left/right/up/down from which the router may choose
+                // the best. Below (and in the idl file) are suggestions how this could be expanded,
+                // but it would be incompatible
+                //
+                //case ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_TOP:
+                //    aRetval.Escape = com::sun::star::drawing::EscapeDirection_LEFTUP;
+                //    break;
+                //case ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_RIGHT:
+                //    aRetval.Escape = com::sun::star::drawing::EscapeDirection_UPRIGHT;
+                //    break;
+                //case ESCAPE_DIRECTION_RIGHT|ESCAPE_DIRECTION_BOTTOM:
+                //    aRetval.Escape = com::sun::star::drawing::EscapeDirection_RIGHTDOWN;
+                //    break;
+                //case ESCAPE_DIRECTION_BOTTOM|ESCAPE_DIRECTION_LEFT:
+                //    aRetval.Escape = com::sun::star::drawing::EscapeDirection_DOWNLEFT;
+                //    break;
+                //case ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_RIGHT:
+                //    aRetval.Escape = com::sun::star::drawing::EscapeDirection_UPWARD;
+                //    break;
+                //case ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_RIGHT|ESCAPE_DIRECTION_DOWN:
+                //    aRetval.Escape = com::sun::star::drawing::EscapeDirection_RIGHTWARD;
+                //    break;
+                //case ESCAPE_DIRECTION_RIGHT|ESCAPE_DIRECTION_DOWN|ESCAPE_DIRECTION_LEFT:
+                //    aRetval.Escape = com::sun::star::drawing::EscapeDirection_DOWNWARD;
+                //    break;
+                //case ESCAPE_DIRECTION_DOWN|ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_UP:
+                //    aRetval.Escape = com::sun::star::drawing::EscapeDirection_LEFTWARD;
+                //    break;
+                default:
+                case ESCAPE_DIRECTION_SMART:
+                    aRetval.Escape = com::sun::star::drawing::EscapeDirection_SMART;
+                    break;
+            }
+
+            return aRetval;
+        }
+
+        GluePoint::GluePoint(
+            const com::sun::star::drawing::GluePoint2& rGluePoint2, 
+            const basegfx::B2DVector& rAbsoluteScale)
+        :   maUnitPosition(0.5, 0.5),
+            meEscapeDirections(ESCAPE_DIRECTION_SMART),
+            meHorizontalAlignment(Alignment_Center),
+            meVerticalAlignment(Alignment_Center),
+            maID(0),
+            mbRelative(rGluePoint2.IsRelative),            // copy relative
+            mbUserDefined(rGluePoint2.IsUserDefined)       // copy UserDefined
+        {
+            // copy alignment
+            switch( rGluePoint2.PositionAlignment )
+            {
+                case com::sun::star::drawing::Alignment_TOP_LEFT:
+                    meHorizontalAlignment = Alignment_Minimum;
+                    meVerticalAlignment = Alignment_Minimum;
+                    break;
+                case com::sun::star::drawing::Alignment_TOP:
+                    meHorizontalAlignment = Alignment_Center;
+                    meVerticalAlignment = Alignment_Minimum;
+                    break;
+                case com::sun::star::drawing::Alignment_TOP_RIGHT:
+                    meHorizontalAlignment = Alignment_Maximum;
+                    meVerticalAlignment = Alignment_Minimum;
+                    break;
+                case com::sun::star::drawing::Alignment_RIGHT:
+                    meHorizontalAlignment = Alignment_Maximum;
+                    meVerticalAlignment = Alignment_Center;
+                    break;
+                case com::sun::star::drawing::Alignment_BOTTOM_LEFT:
+                    meHorizontalAlignment = Alignment_Minimum;
+                    meVerticalAlignment = Alignment_Maximum;
+                    break;
+                case com::sun::star::drawing::Alignment_BOTTOM:
+                    meHorizontalAlignment = Alignment_Center;
+                    meVerticalAlignment = Alignment_Maximum;
+                    break;
+                case com::sun::star::drawing::Alignment_BOTTOM_RIGHT:
+                    meHorizontalAlignment = Alignment_Maximum;
+                    meVerticalAlignment = Alignment_Maximum;
+                    break;
+                case com::sun::star::drawing::Alignment_LEFT:
+                    meHorizontalAlignment = Alignment_Minimum;
+                    meVerticalAlignment = Alignment_Center;
+                    break;
+                default:
+                case com::sun::star::drawing::Alignment_CENTER:
+                    meHorizontalAlignment = Alignment_Center;
+                    meVerticalAlignment = Alignment_Center;
+                    break;
+            }
+
+            // copy position (after alignment is computed)
+            double fX(rGluePoint2.Position.X);
+            double fY(rGluePoint2.Position.Y);
+
+            if(mbRelative)
+            {
+                fX /= 10000.0;
+                fY /= 10000.0;
+            }
+            else
+            {
+                // avoid values below 1.0 to not lose relative values outside object scale
+                fX /= std::max(1.0, rAbsoluteScale.getX());
+                fY /= std::max(1.0, rAbsoluteScale.getY());
+            }
+
+            switch(meHorizontalAlignment)
+            {
+                case Alignment_Minimum: break;
+                case Alignment_Center: fX = fX + 0.5; break;
+                case Alignment_Maximum: fX = fX + 1.0; break;
+            }
+
+            switch(meVerticalAlignment)
+            {
+                case Alignment_Minimum: break;
+                case Alignment_Center: fY = fY + 0.5; break;
+                case Alignment_Maximum: fY = fY + 1.0; break;
+            }
+
+            maUnitPosition = basegfx::B2DPoint(fX, fY);
+
+            // copy escape directions
+            switch( rGluePoint2.Escape )
+            {
+                case com::sun::star::drawing::EscapeDirection_LEFT:
+                    meEscapeDirections = ESCAPE_DIRECTION_LEFT;
+                    break;
+                case com::sun::star::drawing::EscapeDirection_RIGHT:
+                    meEscapeDirections = ESCAPE_DIRECTION_RIGHT;
+                    break;
+                case com::sun::star::drawing::EscapeDirection_UP:
+                    meEscapeDirections = ESCAPE_DIRECTION_TOP;
+                    break;
+                case com::sun::star::drawing::EscapeDirection_DOWN:
+                    meEscapeDirections = ESCAPE_DIRECTION_BOTTOM;
+                    break;
+                case com::sun::star::drawing::EscapeDirection_HORIZONTAL:
+                    meEscapeDirections = ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_RIGHT;
+                    break;
+                case com::sun::star::drawing::EscapeDirection_VERTICAL:
+                    meEscapeDirections = ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_BOTTOM;
+                    break;
+
+                // Unfortunately the enum EscapeDirection in the EscapeDirection.idl definition
+                // is wrong in the sense that it does not reflect the possibility to define a free
+                // combination of the directions left/right/up/down from which the router may choose
+                // the best. Below (and in the idl file) are suggestions how this could be expanded,
+                // but it would be incompatible
+                //
+                //case com::sun::star::drawing::EscapeDirection_LEFTUP:
+                //    meEscapeDirections = ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_TOP;
+                //    break;
+                //case com::sun::star::drawing::EscapeDirection_UPRIGHT:
+                //    meEscapeDirections = ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_RIGHT;
+                //    break;
+                //case com::sun::star::drawing::EscapeDirection_RIGHTDOWN:
+                //    meEscapeDirections = ESCAPE_DIRECTION_RIGHT|ESCAPE_DIRECTION_BOTTOM;
+                //    break;
+                //case com::sun::star::drawing::EscapeDirection_DOWNLEFT:
+                //    meEscapeDirections = ESCAPE_DIRECTION_BOTTOM|ESCAPE_DIRECTION_LEFT;
+                //    break;
+                //case com::sun::star::drawing::EscapeDirection_UPWARD:
+                //    meEscapeDirections = ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_RIGHT;
+                //    break;
+                //case com::sun::star::drawing::EscapeDirection_RIGHTWARD:
+                //    meEscapeDirections = ESCAPE_DIRECTION_TOP|ESCAPE_DIRECTION_RIGHT|ESCAPE_DIRECTION_BOTTOM;
+                //    break;
+                //case com::sun::star::drawing::EscapeDirection_DOWNWARD:
+                //    meEscapeDirections = ESCAPE_DIRECTION_RIGHT|ESCAPE_DIRECTION_BOTTOM|ESCAPE_DIRECTION_LEFT;
+                //    break;
+                //case com::sun::star::drawing::EscapeDirection_LEFTWARD:
+                //    meEscapeDirections = ESCAPE_DIRECTION_BOTTOM|ESCAPE_DIRECTION_LEFT|ESCAPE_DIRECTION_TOP;
+                //    break;
+                case com::sun::star::drawing::EscapeDirection_SMART:
+                default:
+                    meEscapeDirections = ESCAPE_DIRECTION_SMART;
+                    break;
+            }
+        }
+    } // end of namespace glue
+} // end of namespace sdr
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
 namespace sdr
 {
-	namespace gluepoint
-	{
+    namespace glue
+    {
         GluePointProvider::GluePointProvider()
         {
         }
@@ -46,9 +480,9 @@ namespace sdr
             return *this;
         }
 
-		GluePointProvider& GluePointProvider::Clone() const
+        GluePointProvider* GluePointProvider::Clone() const
         {
-			return *(new GluePointProvider(*this));
+            return new GluePointProvider(*this);
         }
 
         sal_uInt32 GluePointProvider::getAutoGluePointCount() const
@@ -58,117 +492,232 @@ namespace sdr
 
         GluePoint GluePointProvider::getAutoGluePointByIndex(sal_uInt32 nIndex) const
         {
+            // no error with indices, just repeatedly return last GluePoint as fallback
+            basegfx::B2DPoint aGluePosition(0.5, 0.5);
+
             switch(nIndex)
             {
-                case 0:
+                case 0: // TopCenter
                 {
-                    return GluePoint(
-                        basegfx::B2DPoint(0.5, 0.0), 
-                        nIndex,
-                        GLUEPOINTTYPE_AUTO);
-                }
-                case 1:
-                {
-                    return GluePoint(
-                        basegfx::B2DPoint(1.0, 0.5), 
-                        nIndex,
-                        GLUEPOINTTYPE_AUTO);
-                }
-                case 2:
-                {
-                    return GluePoint(
-                        basegfx::B2DPoint(0.5, 1.0), 
-                        nIndex,
-                        GLUEPOINTTYPE_AUTO);
+                    aGluePosition.setY(0.0);
+                    break;
                 }
-                default:
+                case 1: // RightCenter
+                {
+                    aGluePosition.setX(1.0);
+                    break;
+                }
+                case 2: // BottomCenter
+                {
+                    aGluePosition.setY(1.0);
+                    break;
+                }
+                default: // case 3: // LeftCenter
                 {
-                    return GluePoint(
-                        basegfx::B2DPoint(0.0, 0.5), 
-                        nIndex,
-                        GLUEPOINTTYPE_AUTO);
+                    aGluePosition.setX(0.0);
+                    break;
                 }
             }
+
+            // create GluePoint, need to set UserDefined to false for these default GluePoints
+            return GluePoint(
+                aGluePosition,
+                GluePoint::ESCAPE_DIRECTION_SMART,
+                GluePoint::Alignment_Center,
+                GluePoint::Alignment_Center,
+                true,   // mbRelative
+                false); // mbUserDefined
         }
 
-        sal_uInt32 GluePointProvider::getEdgeGluePointCount() const
+        bool GluePointProvider::allowsUserGluePoints() const
         {
-            return 0;
+            return false;
+        }
+
+        GluePoint& GluePointProvider::addUserGluePoint(GluePoint& rNew)
+        {
+            OSL_ENSURE(false, "Default GluePointProvider does not support UserGluePoints (!)");
+            return rNew;
         }
 
-        GluePoint GluePointProvider::getEdgeGluePointByIndex(sal_uInt32 /*nIndex*/) const
+        void GluePointProvider::removeUserGluePoint(const GluePoint& /*rNew*/)
         {
-            OSL_ENSURE(false, "access out of range (!)");
-            return GluePoint();
+            OSL_ENSURE(false, "Default GluePointProvider does not support UserGluePoints (!)");
         }
 
-        sal_uInt32 GluePointProvider::getUserGluePointCount() const
+        bool GluePointProvider::hasUserGluePoints() const 
+        { 
+            return false; 
+        }
+
+        GluePoint* GluePointProvider::findUserGluePointByID(sal_uInt32 /*nID*/) const
         {
+            OSL_ENSURE(false, "Default GluePointProvider does not support UserGluePoints (!)");
             return 0;
         }
 
-        GluePoint GluePointProvider::getUserGluePointByIndex(sal_uInt32 /*nIndex*/) const
+        const GluePointVector GluePointProvider::getUserGluePointVector() const
+        {
+            // return empty vector; no need to assert, this may by default be used to check
+            // sizes; it is better to use hasUserGluePoints first, but not required
+            return GluePointVector();
+        }
+
+        void GluePointProvider::adaptUserGluePointsToChangedScale(const basegfx::B2DVector& /*rOldScale*/, const basegfx::B2DVector& /*rNewScale*/)
+        {
+            OSL_ENSURE(false, "Default GluePointProvider does not support UserGluePoints (!)");
+        }
+
+    } // end of namespace glue
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+    namespace glue
+    {
+        bool GluePointComparator::operator()(const GluePoint& rA, const GluePoint& rB) const
+        {
+            // sort by ID
+            return rA.getID() < rB.getID();
+        }
+
+        StandardGluePointProvider::StandardGluePointProvider()
+        :   GluePointProvider(),
+            maGluePointSet()
         {
-            OSL_ENSURE(false, "access out of range (!)");
-            return GluePoint();
         }
 
-        sal_uInt32 GluePointProvider::getGluePointCount() const
+        StandardGluePointProvider::~StandardGluePointProvider()
         {
-            return getAutoGluePointCount() + getEdgeGluePointCount() + getUserGluePointCount();
         }
 
-        GluePoint GluePointProvider::getGluePointByIndex(sal_uInt32 nIndex) const
+        StandardGluePointProvider::StandardGluePointProvider(const StandardGluePointProvider& rCandidate)
+        :   GluePointProvider(),
+            maGluePointSet(rCandidate.maGluePointSet)
         {
-            if(nIndex < getAutoGluePointCount())
+        }
+
+        GluePointProvider& StandardGluePointProvider::operator=(const GluePointProvider& rCandidate)
+        {
+            // call parent to copy UserGluePoints
+            GluePointProvider::operator=(rCandidate);
+
+            const StandardGluePointProvider* pSource = dynamic_cast< const StandardGluePointProvider* >(&rCandidate);
+
+            if(pSource)
             {
-                return getAutoGluePointByIndex(nIndex);
+                maGluePointSet = pSource->maGluePointSet;
             }
 
-            nIndex -= getAutoGluePointCount();
+            return *this;
+        }
+
+        GluePointProvider* StandardGluePointProvider::Clone() const
+        {
+            return new StandardGluePointProvider(*this);
+        }
 
-            if(nIndex < getEdgeGluePointCount())
+        bool StandardGluePointProvider::allowsUserGluePoints() const
+        {
+            return true;
+        }
+
+        GluePoint& StandardGluePointProvider::addUserGluePoint(GluePoint& rNew)
+        {
+            OSL_ENSURE(0 == rNew.getID(), "Someone is adding a new GluePoint which already has an ID");
+
+            if(!maGluePointSet.size())
             {
-                return getEdgeGluePointByIndex(nIndex);
+                // first GluePoint ever, add at start position with ID null
+                setIdAtGluePoint(rNew, 0);
+                maGluePointSet.insert(rNew);
+                return *maGluePointSet.begin();
             }
 
-            nIndex -= getEdgeGluePointCount();
+            // get last GluePoint; take it's ID as current maximum ID (since it's a
+            // set sorted by ID) as base for the new ID
+            GluePointSet::iterator aFound(maGluePointSet.end());
+            aFound--;
+
+            // set ID and insert
+            setIdAtGluePoint(rNew, aFound->getID() + 1);
+            maGluePointSet.insert(rNew);
+
+            // get from end (no find needed, we know we just added it with lastID + 1)
+            aFound = maGluePointSet.end();
+            aFound--;
+
+            return *aFound;
+        }
 
-            if(nIndex < getUserGluePointCount())
+        void StandardGluePointProvider::removeUserGluePoint(const GluePoint& rNew)
+        {
+            const GluePointSet::const_iterator aFound(maGluePointSet.find(rNew));
+
+            if(aFound == maGluePointSet.end())
             {
-                return getUserGluePointByIndex(nIndex);
+                // not a member
+                OSL_ENSURE(false, "GluePoint for removal not found (!)");
+                return;
             }
 
-            OSL_ENSURE(false, "access out of range (!)");
-            return GluePoint();
+            maGluePointSet.erase(aFound);
         }
 
-        bool GluePointProvider::areUserGluePointsAllowed() const
-        {
-            return false;
+        bool StandardGluePointProvider::hasUserGluePoints() const 
+        { 
+            return !maGluePointSet.empty(); 
         }
 
-        GluePoint GluePointProvider::addUserGluePoint(
-            const basegfx::B2DPoint& /*rPosition*/,
-            GluePointType /*eType*/,
-            com::sun::star::drawing::Alignment /*eAlignment*/,
-            com::sun::star::drawing::EscapeDirection /*eEscapeDirection*/)
+        GluePoint* StandardGluePointProvider::findUserGluePointByID(sal_uInt32 nID) const
         {
-            OSL_ENSURE(false, "No UserGluePoints allowed at this object (!)");
-            return GluePoint();
+            // prepare GluePoint to search for
+            GluePoint aGluePoint;
+            const_cast< StandardGluePointProvider* >(this)->setIdAtGluePoint(aGluePoint, nID);
+
+            const GluePointSet::const_iterator aFound(maGluePointSet.find(aGluePoint));
+
+            if(aFound == maGluePointSet.end())
+            {
+                return 0;
+            }
+
+            const GluePoint& rResult = *aFound;
+            
+            return &const_cast< GluePoint& >(rResult);
         }
 
-        void GluePointProvider::removeUserGluePoint(const GluePoint& /*rCandidate*/)
+        const GluePointVector StandardGluePointProvider::getUserGluePointVector() const
         {
-            OSL_ENSURE(false, "No UserGluePoints allowed at this object (!)");
+            // prepare retval; we know the number of entries
+            GluePointVector aRetval;
+            aRetval.reserve(maGluePointSet.size());
+
+            // need to loop here; the vector contains pointers to real instances, not the
+            // instances themselves
+            for(GluePointSet::const_iterator aFound(maGluePointSet.begin()); aFound != maGluePointSet.end(); aFound++)
+            {
+                aRetval.push_back(&const_cast< GluePoint& >(*aFound));
+            }
+
+            return aRetval;
         }
 
-        bool GluePointProvider::existsUserGluePoint(const GluePoint& /*rCandidate*/) const
+        void StandardGluePointProvider::adaptUserGluePointsToChangedScale(const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale)
         {
-            return false;
+            // if scale changed, adapt all registered GluePoints
+            if(!rOldScale.equal(rNewScale))
+            {
+                for(GluePointSet::iterator aFound(maGluePointSet.begin()); aFound != maGluePointSet.end(); aFound++)
+                {
+                    adaptGluePointToChangedScale(*aFound, rOldScale, rNewScale);
+                }
+            }
         }
 
-    } // end of namespace gluepoint
+    } // end of namespace glue
 } // end of namespace sdr
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////

Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/sdrselection.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/sdrselection.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/sdrselection.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/sdrselection.cxx Thu Oct 17 18:36:03 2013
@@ -110,12 +110,12 @@ namespace sdr
                 OSL_ENSURE(pCandidate, "Missing SdrObject pointer in glue selection(!)");
                 bool bErase(false);
                 IndicesMap::iterator aNext(aIndices);
-                const sdr::glue::List* pGPL = pCandidate->GetGluePointList(false);
+                const sdr::glue::GluePointProvider& rProvider = pCandidate->GetGluePointProvider();
 
                 aNext++;
 
                 // for each SdrObject check if it has GluePoints at all
-                if(pGPL)
+                if(rProvider.hasUserGluePoints())
                 {
                     Indices aCurrent = aIndices->second;
                     Indices aNewList;
@@ -124,7 +124,7 @@ namespace sdr
                     // it over to a new list. Thus, all no longer existing GluePoints will be erased
                     for(Indices::const_iterator aIter(aCurrent.begin()); aIter != aCurrent.end(); aIter++)
                     {
-                        if(pGPL->findByID(*aIter))
+                        if(rProvider.findUserGluePointByID(*aIter))
                         {
                             aNewList.insert(aNewList.end(), *aIter);
                         }

Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svdcrtv.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svdcrtv.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdcrtv.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdcrtv.cxx Thu Oct 17 18:36:03 2013
@@ -88,11 +88,12 @@ ImplConnectMarkerOverlay::ImplConnectMar
             pTargetOverlay->add(*pNew);
             maObjects.append(*pNew);
 
-            // TTTT:GLUE
             // gluepoints
-            for(sal_uInt32 i(0); i < 4; i++) 
+            const sdr::glue::GluePointProvider& rProvider = rObject.GetGluePointProvider();
+
+            for(sal_uInt32 i(0); i < rProvider.getAutoGluePointCount(); i++) 
             {
-                const sdr::glue::Point aGluePoint(rObject.GetVertexGluePoint(i));
+                const sdr::glue::GluePoint aGluePoint(rProvider.getAutoGluePointByIndex(i));
                 const basegfx::B2DPoint aPosition(rObject.getSdrObjectTransformation() * aGluePoint.getUnitPosition());
                 const basegfx::B2DRange aBigRange(aPosition - aHalfLogicSize, aPosition + aHalfLogicSize);
                 const basegfx::B2DPolygon aTempPoly(basegfx::tools::createPolygonFromRect(aBigRange));

Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svddrgmt.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svddrgmt.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/svddrgmt.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svddrgmt.cxx Thu Oct 17 18:36:03 2013
@@ -539,16 +539,15 @@ void SdrDragMethod::createSdrDragEntries
 
                 if(aMarkedGluePoints.size()) 
                 {
-                    // TTTT:GLUE
-                    const sdr::glue::List* pGPL = pSdrObjCandidate->GetGluePointList(false);
+                    const sdr::glue::GluePointProvider& rProvider = pSdrObjCandidate->GetGluePointProvider();
 
-                    if(pGPL) 
+                    if(rProvider.hasUserGluePoints()) 
                     {
                         for(sdr::selection::Indices::const_iterator aCurrent(aMarkedGluePoints.begin());
                             aCurrent != aMarkedGluePoints.end(); aCurrent++)
                         {
                             const sal_uInt32 nObjPt(*aCurrent);
-                            const sdr::glue::Point* pCandidate = pGPL->findByID(nObjPt);
+                            const sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nObjPt);
 
                             if(pCandidate)
                             {
@@ -1700,9 +1699,9 @@ void SdrDragMove::MoveSdrDrag(const base
 
                     if(rMarkedGluePoints.size()) 
                     {
-                        const sdr::glue::List* pGPL = pObj->GetGluePointList(false);
+                        const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
 
-                        if(pGPL)
+                        if(rProvider.hasUserGluePoints())
                         {
                             // the SdrObject candidate with potentially moved GluePoints is identified. GetObjectMatrix, 
                             // but take care for objects with zero width/height. Also prepare inverse transformation
@@ -1714,7 +1713,7 @@ void SdrDragMove::MoveSdrDrag(const base
                             for(sdr::selection::Indices::const_iterator aCurrent(rMarkedGluePoints.begin()); aCurrent != rMarkedGluePoints.end(); aCurrent++)
                             {
                                 const sal_uInt32 nId(*aCurrent);
-                                const sdr::glue::Point* pGlueCandidate = pGPL->findByID(nId);
+                                const sdr::glue::GluePoint* pGlueCandidate = rProvider.findUserGluePointByID(nId);
 
                                 if(pGlueCandidate)
                                 {
@@ -1793,7 +1792,6 @@ bool SdrDragMove::EndSdrDrag(bool bCopy)
             basegfx::tools::createTranslateB2DHomMatrix(DragStat().GetNow() - DragStat().GetPrev()),
             SDRREPFUNC_OBJ_MOVE,
             bCopy);
-        // TTTT:GLUE getSdrView().MoveMarkedGluePoints(DragStat().GetNow() - DragStat().GetPrev(), bCopy);
     } 
     else 
     {
@@ -2098,7 +2096,6 @@ bool SdrDragResize::EndSdrDrag(bool bCop
             aTransform,
             SDRREPFUNC_OBJ_MOVE,
             bCopy);
-        // TTTT:GLUE getSdrView().ResizeMarkedGluePoints(DragStat().GetRef1(), maScale, bCopy);
     } 
     else 
     {
@@ -2228,7 +2225,6 @@ bool SdrDragRotate::EndSdrDrag(bool bCop
                 basegfx::tools::createRotateAroundPoint(DragStat().GetRef1(), mfDeltaRotation), 
                 SDRREPFUNC_OBJ_ROTATE,
                 bCopy);
-            // TTTT:GLUE getSdrView().RotateMarkedGluePoints(DragStat().GetRef1(), mfDeltaRotation, bCopy);
         } 
         else 
         {

Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svddrgv.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svddrgv.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/svddrgv.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svddrgv.cxx Thu Oct 17 18:36:03 2013
@@ -852,26 +852,20 @@ bool SdrDragView::BegInsGluePoint(const 
         pObj->TakeObjNameSingul(aName);
         aStr.SearchAndReplaceAscii("%1", aName);
         maInsPointUndoStr = aStr;
-        sdr::glue::List* pGPL=pObj->GetGluePointList(true);
+        sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
 
-        if(pGPL) 
+        if(rProvider.allowsUserGluePoints()) 
         {
-            sdr::glue::Point& rNew = pGPL->add(sdr::glue::Point());
+            sdr::glue::GluePoint& rNew = rProvider.addUserGluePoint(sdr::glue::GluePoint());
             const sal_uInt32 nGlueId(rNew.getID());
             SdrHdl* pHdl = 0;
 
-            // TTTT:GLUE
-            //const sal_uInt32 nGlueIdx(pGPL->Insert(sdr::glue::Point()));
-            //sdr::glue::Point& rGP=(*pGPL)[nGlueIdx];
-            //const sal_uInt32 nGlueId(rGP.GetId());
-
             // the moved candidate is identified. GetObjectMatrix, but take care for objects
             // with zero width/height
             basegfx::B2DHomMatrix aCorrectedObjectTransformation(basegfx::tools::guaranteeMinimalScaling(pObj->getSdrObjectTransformation()));
 
             aCorrectedObjectTransformation.invert();
             rNew.setUnitPosition(aCorrectedObjectTransformation * rPnt);
-            // rGP.SetAbsolutePos(rPnt, sdr::legacy::GetSnapRange(*pObj));
 
             if(MarkGluePoint(pObj, nGlueId)) 
             {

Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svdglev.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svdglev.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdglev.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdglev.cxx Thu Oct 17 18:36:03 2013
@@ -30,7 +30,6 @@
 #include "svx/svdstr.hrc"   // Namen aus der Resource
 #include "svx/svdglob.hxx"  // StringCache
 #include <svx/svdpagv.hxx>
-#include <svx/sdrglue.hxx>
 #include <svx/svdtrans.hxx>
 #include <svx/svdobj.hxx>
 #include <svx/svdlegacy.hxx>
@@ -61,18 +60,9 @@ void SdrGlueEditView::ImpDoMarkedGluePoi
 
             if(aMarkedGluePoints.size()) 
             {
-                sdr::glue::List* pGPL = pObj->GetGluePointList(!bConst); // 0;
+                sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
 
-                //if(bConst) 
-                //{
-                //    pGPL = const_cast< sdr::glue::List* >(pObj->GetGluePointList());
-                //} 
-                //else 
-                //{
-                //    pGPL = pObj->GetGluePointList(true);
-                //}
-
-                if(pGPL)
+                if(rProvider.hasUserGluePoints())
                 {
                     const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*pObj);
 
@@ -85,15 +75,10 @@ void SdrGlueEditView::ImpDoMarkedGluePoi
                         aCurrent != aMarkedGluePoints.end(); aCurrent++)
                     {
                         const sal_uInt32 nPtId(*aCurrent);
-                        sdr::glue::Point* pCandidate = pGPL->findByID(nPtId);
-                        // TTTT:GLUE
-                        //const sal_uInt32 nGlueIdx(pGPL->FindGluePoint(nPtId));
+                        sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nPtId);
 
                         if(pCandidate)
-                        //if(SDRGLUEPOINT_NOTFOUND != nGlueIdx)
                         {
-                            //sdr::glue::Point& rGP=(*pGPL)[nGlueIdx];
-
                             (*pDoFunc)(*pCandidate, pObj, p1, p2, p3, p4, p5);
                         }
                     }
@@ -115,7 +100,7 @@ void SdrGlueEditView::ImpDoMarkedGluePoi
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
-static void ImpGetEscDir(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnThisEsc, const void* pnRet, const void*, const void*)
+static void ImpGetEscDir(sdr::glue::GluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnThisEsc, const void* pnRet, const void*, const void*)
 {
 	sal_uInt16& nRet=*(sal_uInt16*)pnRet;
 	bool& bFirst = *(bool*)pbFirst;
@@ -145,7 +130,7 @@ TRISTATE SdrGlueEditView::IsMarkedGluePo
 	return (TRISTATE)nRet;
 }
 
-static void ImpSetEscDir(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const void* pnThisEsc, const void* pbOn, const void*, const void*, const void*)
+static void ImpSetEscDir(sdr::glue::GluePoint& rGP, const SdrObject* /*pObj*/, const void* pnThisEsc, const void* pbOn, const void*, const void*, const void*)
 {
 	sal_uInt16 nEsc=rGP.getEscapeDirections();
 	
@@ -170,7 +155,7 @@ void SdrGlueEditView::SetMarkedGluePoint
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
-static void ImpGetPercent(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnRet, const void*, const void*, const void*)
+static void ImpGetPercent(sdr::glue::GluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnRet, const void*, const void*, const void*)
 {
     sal_uInt16& nRet=*(sal_uInt16*)pnRet;
     bool& bFirst = *(bool*)pbFirst;
@@ -199,15 +184,9 @@ TRISTATE SdrGlueEditView::IsMarkedGluePo
     return (TRISTATE)nRet;
 }
 
-static void ImpSetPercent(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const void* pbOn, const void*, const void*, const void*, const void*)
+static void ImpSetPercent(sdr::glue::GluePoint& rGP, const SdrObject* /*pObj*/, const void* pbOn, const void*, const void*, const void*, const void*)
 {
-    //const basegfx::B2DRange aObjectRange(sdr::legacy::GetSnapRange(*pObj));
-    //const basegfx::B2DPoint aPos(rGP.GetAbsolutePos(aObjectRange));
-
-    // TTTT:GLUE
     rGP.setRelative(*(bool*)pbOn);
-    //rGP.SetPercent(*(bool*)pbOn);
-    //rGP.SetAbsolutePos(aPos, aObjectRange);
 }
 
 void SdrGlueEditView::SetMarkedGluePointsPercent(bool bOn)
@@ -219,16 +198,16 @@ void SdrGlueEditView::SetMarkedGluePoint
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
-static void ImpGetAlign(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pbDontCare, const void* pbVert, const void* pnRet, const void*)
+static void ImpGetAlign(sdr::glue::GluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pbDontCare, const void* pbVert, const void* pnRet, const void*)
 {
-    sdr::glue::Point::Alignment& nRet=*(sdr::glue::Point::Alignment*)pnRet;
+    sdr::glue::GluePoint::Alignment& nRet=*(sdr::glue::GluePoint::Alignment*)pnRet;
     bool& bFirst = *(bool*)pbFirst;
     bool& bDontCare = *(bool*)pbDontCare;
     bool bVert = *(bool*)pbVert;
 
     if(!bDontCare) 
     {
-        sdr::glue::Point::Alignment nAlg(sdr::glue::Point::Alignment_Center);
+        sdr::glue::GluePoint::Alignment nAlg(sdr::glue::GluePoint::Alignment_Center);
 
         if(bVert) 
         {
@@ -251,33 +230,33 @@ static void ImpGetAlign(sdr::glue::Point
     }
 }
 
-sdr::glue::Point::Alignment SdrGlueEditView::GetMarkedGluePointsAlign(bool bVert) const
+sdr::glue::GluePoint::Alignment SdrGlueEditView::GetMarkedGluePointsAlign(bool bVert) const
 {
     bool bFirst(true);
     bool bDontCare(false);
-    sdr::glue::Point::Alignment nRet(sdr::glue::Point::Alignment_Center);
+    sdr::glue::GluePoint::Alignment nRet(sdr::glue::GluePoint::Alignment_Center);
     const_cast< SdrGlueEditView* >(this)->ImpDoMarkedGluePoints(ImpGetAlign, true, &bFirst, &bDontCare, &bVert, &nRet);
     return nRet;
 }
 
-static void ImpSetAlign(sdr::glue::Point& rGP, const SdrObject* /*pObj*/, const void* pbVert, const void* pnAlign, const void*, const void*, const void*)
+static void ImpSetAlign(sdr::glue::GluePoint& rGP, const SdrObject* /*pObj*/, const void* pbVert, const void* pnAlign, const void*, const void*, const void*)
 {
     //const basegfx::B2DRange aObjectRange(sdr::legacy::GetSnapRange(*pObj));
     //const basegfx::B2DPoint aPos(rGP.GetAbsolutePos(aObjectRange));
 
     if(*(bool*)pbVert) 
     { 
-        rGP.setVerticalAlignment(*(sdr::glue::Point::Alignment *)pnAlign);
+        rGP.setVerticalAlignment(*(sdr::glue::GluePoint::Alignment *)pnAlign);
     } 
     else 
     {
-        rGP.setHorizontalAlignment(*(sdr::glue::Point::Alignment *)pnAlign);
+        rGP.setHorizontalAlignment(*(sdr::glue::GluePoint::Alignment *)pnAlign);
     }
 
     //rGP.SetAbsolutePos(aPos, aObjectRange);
 }
 
-void SdrGlueEditView::SetMarkedGluePointsAlign(bool bVert, sdr::glue::Point::Alignment nAlign)
+void SdrGlueEditView::SetMarkedGluePointsAlign(bool bVert, sdr::glue::GluePoint::Alignment nAlign)
 {
     BegUndo(ImpGetResStr(STR_EditSetGlueAlign), getSelectedGluesDescription());
     ImpDoMarkedGluePoints(ImpSetAlign, false, &bVert, &nAlign);
@@ -307,9 +286,9 @@ void SdrGlueEditView::DeleteMarkedGluePo
 
             if(!aMarkedGluePoints.empty())
             {
-                sdr::glue::List* pGPL = pObj->GetGluePointList(false);
+                sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
 
-                if(pGPL)
+                if(rProvider.hasUserGluePoints())
                 {
                     const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*pObj);
 
@@ -322,20 +301,12 @@ void SdrGlueEditView::DeleteMarkedGluePo
                         aCurrent != aMarkedGluePoints.end(); aCurrent++)
                     {
                         const sal_uInt32 nPtId(*aCurrent);
-                        sdr::glue::Point* pCandidate = pGPL->findByID(nPtId);
+                        sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nPtId);
 
                         if(pCandidate)
                         {
-                            pGPL->remove(*pCandidate);
+                            rProvider.removeUserGluePoint(*pCandidate);
                         }
-
-                        // TTTT:GLUE
-                        //const sal_uInt32 nGlueIdx(pGPL->FindGluePoint(nPtId));
-                        //
-                        //if(SDRGLUEPOINT_NOTFOUND != nGlueIdx)
-                        //{
-                        //    pGPL->Delete(nGlueIdx);
-                        //}
                     }
 
                     pObj->SetChanged();
@@ -376,9 +347,9 @@ void SdrGlueEditView::ImpCopyMarkedGlueP
             SdrObject* pObj = aSelection[nm];
             sdr::selection::Indices aMarkedGluePoints(getSelectedGluesForSelectedSdrObject(*pObj));
             bool bMarkedGluePointsChanged(false);
-            sdr::glue::List* pGPL = pObj->GetGluePointList(false);
+            sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
 
-            if(!aMarkedGluePoints.empty() && pGPL)
+            if(!aMarkedGluePoints.empty() && rProvider.hasUserGluePoints())
             {
                 if( bUndo )
                 {
@@ -389,11 +360,11 @@ void SdrGlueEditView::ImpCopyMarkedGlueP
                     aCurrent != aMarkedGluePoints.end(); aCurrent++)
                 {
                     const sal_uInt32 nPtId(*aCurrent);
-                    sdr::glue::Point* pCandidate = pGPL->findByID(nPtId);
+                    sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nPtId);
 
                     if(pCandidate)
                     {
-                        const sdr::glue::Point& rNew = pGPL->add(*pCandidate);
+                        const sdr::glue::GluePoint& rNew = rProvider.addUserGluePoint(*pCandidate);
                         sdr::selection::Indices::iterator aNext(aCurrent);
 
                         aNext++;
@@ -402,23 +373,6 @@ void SdrGlueEditView::ImpCopyMarkedGlueP
                         bMarkedGluePointsChanged = true;
                         aCurrent = aNext;
                     }
-
-                    // TTTT:GLUE
-                    //const sal_uInt32 nGlueIdx(pGPL->FindGluePoint(nPtId));
-                    //
-                    //if(SDRGLUEPOINT_NOTFOUND != nGlueIdx)
-                    //{
-                    //    sdr::glue::Point aNewGP((*pGPL)[nGlueIdx]);
-                    //    const sal_uInt32 nNewIdx(pGPL->Insert(aNewGP));
-                    //    const sal_uInt32 nNewId((*pGPL)[nNewIdx].GetId());
-                    //
-                    //    sdr::selection::Indices::iterator aNext(aCurrent);
-                    //    aNext++;
-                    //    aMarkedGluePoints.erase(aCurrent);
-                    //    aMarkedGluePoints.insert(nNewId);
-                    //    bMarkedGluePointsChanged = true;
-                    //    aCurrent = aNext;
-                    //}
                 }
             }
 
@@ -455,9 +409,9 @@ void SdrGlueEditView::ImpTransformMarked
 
             if(!aMarkedGluePoints.empty()) 
             {
-                sdr::glue::List* pGPL = pObj->GetGluePointList(false);
+                sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
 
-                if(pGPL)
+                if(rProvider.hasUserGluePoints())
                 {
                     const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*pObj);
 
@@ -478,7 +432,7 @@ void SdrGlueEditView::ImpTransformMarked
                         aCurrent != aMarkedGluePoints.end(); aCurrent++)
                     {
                         const sal_uInt32 nPtId(*aCurrent);
-                        sdr::glue::Point* pCandidate = pGPL->findByID(nPtId);
+                        sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nPtId);
 
                         if(pCandidate)
                         {
@@ -487,18 +441,6 @@ void SdrGlueEditView::ImpTransformMarked
 
                             pCandidate->setUnitPosition(aInverseCorrectedObjectTransformation * aTransformedPos);
                         }
-
-                        // TTTT:GLUE
-                        //const sal_uInt32 nGlueIdx(pGPL->FindGluePoint(nPtId));
-                        //
-                        //if(sdr::glue::Pointz_NOTFOUND != nGlueIdx) 
-                        //{
-                        //    sdr::glue::Point& rGP=(*pGPL)[nGlueIdx];
-                        //    const basegfx::B2DRange aObjectRange(sdr::legacy::GetSnapRange(*pObj));
-                        //    basegfx::B2DPoint aPos(rGP.GetAbsolutePos(aObjectRange));
-                        //    (*pTrFunc)(aPos,p1,p2,p3,p4,p5);
-                        //    rGP.SetAbsolutePos(aPos, aObjectRange);
-                        //}
                     }
 
                     pObj->SetChanged();
@@ -552,102 +494,4 @@ void SdrGlueEditView::TransformMarkedGlu
 }
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
-// TTTT:GLUE
-
-//static void ImpMove(basegfx::B2DPoint& rPt, const void* p1, const void* /*p2*/, const void* /*p3*/, const void* /*p4*/, const void* /*p5*/)
-//{
-//	rPt += *(static_cast< const basegfx::B2DVector* >(p1));
-//}
-
-//void SdrGlueEditView::MoveMarkedGluePoints(const basegfx::B2DVector& rDelta, bool bCopy)
-//{
-//    XubString aStr(ImpGetResStr(STR_EditMove));
-//
-//    if(bCopy) 
-//    {
-//        aStr += ImpGetResStr(STR_EditWithCopy);
-//    }
-//
-//    BegUndo(aStr, getSelectedGluesDescription(), SDRREPFUNC_OBJ_MOVE);
-//
-//    if(bCopy) 
-//    {
-//        ImpCopyMarkedGluePoints();
-//    }
-//
-//    ImpTransformMarkedGluePoints(ImpMove, &rDelta);
-//    EndUndo();
-//    RecreateAllMarkHandles();
-//}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-//static void ImpResize(basegfx::B2DPoint& rPt, const void* p1, const void* p2, const void* /*p3*/, const void* /*p4*/, const void* /*p5*/)
-//{
-//	const basegfx::B2DPoint* pRef = static_cast< const basegfx::B2DPoint* >(p1);
-//	const basegfx::B2DVector* pScale = static_cast< const basegfx::B2DVector* >(p2);
-//	
-//	rPt = ((rPt - (*pRef)) * (*pScale)) + (*pRef);
-//}
-
-//void SdrGlueEditView::ResizeMarkedGluePoints(const basegfx::B2DPoint& rRef, const basegfx::B2DVector& rScale, bool bCopy)
-//{
-//	XubString aStr(ImpGetResStr(STR_EditResize));
-//
-//	if(bCopy) 
-//	{
-//		aStr += ImpGetResStr(STR_EditWithCopy);
-//	}
-//
-//	BegUndo(aStr, getSelectedGluesDescription(), SDRREPFUNC_OBJ_RESIZE);
-//	
-//	if(bCopy) 
-//	{
-//		ImpCopyMarkedGluePoints();
-//	}
-//
-//	ImpTransformMarkedGluePoints(ImpResize, &rRef, &rScale);
-//	EndUndo();
-//	RecreateAllMarkHandles();
-//}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-//static void ImpRotate(basegfx::B2DPoint& rPt, const void* p1, const void* /*p2*/, const void* p3, const void* p4, const void* /*p5*/)
-//{
-//	const basegfx::B2DPoint* pRef = static_cast< const basegfx::B2DPoint* >(p1);
-//	const double* pSin = static_cast< const double* >(p3);
-//	const double* pCos = static_cast< const double* >(p4);
-//	const double fDx(rPt.getX() - pRef->getX());
-//	const double fDy(rPt.getX() - pRef->getX());
-//
-//	rPt.setX(pRef->getX() + fDx * (*pCos) + fDy * (*pSin));
-//	rPt.setY(pRef->getY() + fDy * (*pCos) - fDx * (*pSin));
-//}
-
-//void SdrGlueEditView::RotateMarkedGluePoints(const basegfx::B2DPoint& rRef, double fAngle, bool bCopy)
-//{
-//	XubString aStr(ImpGetResStr(STR_EditRotate));
-//
-//	if(bCopy) 
-//	{
-//		aStr += ImpGetResStr(STR_EditWithCopy);
-//	}
-//
-//	BegUndo(aStr, getSelectedGluesDescription(), SDRREPFUNC_OBJ_ROTATE);
-//
-//	if(bCopy) 
-//	{
-//		ImpCopyMarkedGluePoints();
-//	}
-//
-//	const double fSin(sin(fAngle));
-//	const double fCos(cos(fAngle));
-//
-//	ImpTransformMarkedGluePoints(ImpRotate, &rRef, &fAngle, &fSin, &fCos);
-//	EndUndo();
-//	RecreateAllMarkHandles();
-//}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
 // eof

Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svdmrkv.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svdmrkv.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdmrkv.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdmrkv.cxx Thu Oct 17 18:36:03 2013
@@ -1069,17 +1069,15 @@ void SdrMarkView::CreateMarkHandles(SdrH
 
         if(!aMarkedGluePoints.empty()) 
         {
-            const sdr::glue::List* pGPL=pObj->GetGluePointList(false);
+            const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
 
-            if(pGPL) 
+            if(rProvider.hasUserGluePoints()) 
             {
-                // TTTT:GLUE const basegfx::B2DRange aObjSnapRange(sdr::legacy::GetSnapRange(*pObj));
-
                 for(sdr::selection::Indices::const_iterator aCurrent(aMarkedGluePoints.begin());
                     aCurrent != aMarkedGluePoints.end(); aCurrent++)
                 {
                     const sal_uInt32 nId(*aCurrent);
-                    const sdr::glue::Point* pCandidate = pGPL->findByID(nId);
+                    const sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nId);
 
                     if(pCandidate)
                     {
@@ -1088,17 +1086,6 @@ void SdrMarkView::CreateMarkHandles(SdrH
 
                         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);
-                    //}
                 }
             }
         }

Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svdmrkv1.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svdmrkv1.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdmrkv1.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdmrkv1.cxx Thu Oct 17 18:36:03 2013
@@ -319,29 +319,37 @@ bool SdrMarkView::HasMarkableGluePoints(
         for(sal_uInt32 nMarkNum(0); nMarkNum < aSelection.size(); nMarkNum++) 
         {
             const SdrObject* pObj = aSelection[nMarkNum];
-            const sdr::glue::List* pGPL = pObj ? pObj->GetGluePointList(false) : 0;
 
-            if(pGPL)
+            if(pObj)
             {
-                const sdr::glue::PointVector aCandidates(pGPL->getVector());
+                const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
 
-                for(sal_uInt32 a(0); a < aCandidates.size(); a++)
+                if(rProvider.hasUserGluePoints())
                 {
-                    const sdr::glue::Point* pCandidate = aCandidates[a];
+                    const sdr::glue::GluePointVector aCandidates(rProvider.getUserGluePointVector());
 
-                    if(pCandidate)
+                    for(sal_uInt32 a(0); a < aCandidates.size(); a++)
                     {
-                        if(aCandidates[a]->getUserDefined())
+                        const sdr::glue::GluePoint* pCandidate = aCandidates[a];
+
+                        if(pCandidate)
                         {
-                            return true;
+                            if(aCandidates[a]->getUserDefined())
+                            {
+                                return true;
+                            }
+                        }
+                        else
+                        {
+                            OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
                         }
-                    }
-                    else
-                    {
-                        OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
                     }
                 }
             }
+            else
+            {
+                OSL_ENSURE(false, "Got empty entry in selection list (!)");
+            }
         }
     }
 
@@ -359,37 +367,36 @@ sal_uInt32 SdrMarkView::GetMarkableGlueP
         for(sal_uInt32 nMarkNum(0); nMarkNum < aSelection.size(); nMarkNum++) 
         {
             const SdrObject* pObj = aSelection[nMarkNum];
-            const sdr::glue::List* pGPL = pObj ? pObj->GetGluePointList(false) : 0;
 
-            if(pGPL)
+            if(pObj)
             {
-                const sdr::glue::PointVector aCandidates(pGPL->getVector());
+                const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
 
-                for(sal_uInt32 a(0); a < aCandidates.size(); a++)
+                if(rProvider.hasUserGluePoints())
                 {
-                    const sdr::glue::Point* pCandidate = aCandidates[a];
+                    const sdr::glue::GluePointVector aCandidates(rProvider.getUserGluePointVector());
 
-                    if(pCandidate)
+                    for(sal_uInt32 a(0); a < aCandidates.size(); a++)
                     {
-                        if(aCandidates[a]->getUserDefined())
+                        const sdr::glue::GluePoint* pCandidate = aCandidates[a];
+
+                        if(pCandidate)
                         {
-                            nAnz++;
+                            if(aCandidates[a]->getUserDefined())
+                            {
+                                nAnz++;
+                            }
+                        }
+                        else
+                        {
+                            OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
                         }
-                    }
-                    else
-                    {
-                        OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
                     }
                 }
-
-                // TTTT:GLUE
-                //for(sal_uInt32 a(0); a < pGPL->GetCount(); a++)
-                //{
-                //    if((*pGPL)[a].IsUserDefined())
-                //    {
-                //        nAnz++;
-                //    }
-                //}
+            }
+            else
+            {
+                OSL_ENSURE(false, "Got object selection with empty slots (!)");
             }
         }
     }
@@ -449,15 +456,15 @@ void SdrMarkView::MarkGluePoints(const b
             } 
             else 
             {
-                const sdr::glue::List* pGPL = pObj->GetGluePointList(false);
+                const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
 
-                if(pGPL && (!aMarkedGluePoints.empty() || !bUnmark)) 
+                if(rProvider.hasUserGluePoints() && (!aMarkedGluePoints.empty() || !bUnmark)) 
                 {
-                    const sdr::glue::PointVector aCandidates(pGPL->getVector());
+                    const sdr::glue::GluePointVector aCandidates(rProvider.getUserGluePointVector());
 
                     for(sal_uInt32 a(0); a < aCandidates.size(); a++)
                     {
-                        const sdr::glue::Point* pCandidate = aCandidates[a];
+                        const sdr::glue::GluePoint* pCandidate = aCandidates[a];
 
                         if(pCandidate)
                         {
@@ -491,40 +498,6 @@ void SdrMarkView::MarkGluePoints(const b
                             OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
                         }
                     }
-
-                    // TTTT:GLUE
-                    //const sal_uInt32 nGPAnz(pGPL->GetCount());
-                    //const basegfx::B2DRange aObjSnapRange(nGPAnz ? sdr::legacy::GetSnapRange(*pObj) : basegfx::B2DRange());
-                    //
-                    //for(sal_uInt32 nGPNum(0); nGPNum < nGPAnz; nGPNum++) 
-                    //{
-                    //    const sdr::glue::Point& rGP=(*pGPL)[nGPNum];
-                    //
-                    //    if(rGP.IsUserDefined())
-                    //    {
-                    //        if(!pRange || pRange->isInside(rGP.GetAbsolutePos(aObjSnapRange))) 
-                    //        {
-                    //            sdr::selection::Indices::iterator aFound(aMarkedGluePoints.find(rGP.GetId()));
-                    //
-                    //            if(bUnmark)
-                    //            {
-                    //                if(aFound != aMarkedGluePoints.end())
-                    //                {
-                    //                    aMarkedGluePoints.erase(aFound);
-                    //                    bGluePointsChanged = true;
-                    //                }
-                    //            }
-                    //            else
-                    //            {
-                    //                if(aFound == aMarkedGluePoints.end())
-                    //                {
-                    //                    aMarkedGluePoints.insert(rGP.GetId());
-                    //                    bGluePointsChanged = true;
-                    //                }
-                    //            }
-                    //        }
-                    //    }
-                    //}
                 }
             }
 
@@ -546,7 +519,6 @@ bool SdrMarkView::PickGluePoint(const ba
         return false;
     }
 
-    // SdrObject* pObj0 = rpObj;
     const SdrObjectVector aSelection(getSelectedSdrObjectVectorFromSdrMarkView());
     sal_uInt32 nMarkNum(aSelection.size());
 
@@ -554,56 +526,46 @@ bool SdrMarkView::PickGluePoint(const ba
     {
         nMarkNum--;
         SdrObject* pObj = aSelection[nMarkNum];
-        const sdr::glue::List* pGPL = pObj ? pObj->GetGluePointList(false) : 0;
 
-        if(pGPL) 
+        if(pObj)
         {
-            const sdr::glue::PointVector aCandidates(pGPL->getVector());
+            const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider();
 
-            for(sal_uInt32 a(0); a < aCandidates.size(); a++)
+            if(rProvider.hasUserGluePoints()) 
             {
-                const sdr::glue::Point* pCandidate = aCandidates[a];
+                const sdr::glue::GluePointVector aCandidates(rProvider.getUserGluePointVector());
 
-                if(pCandidate)
+                for(sal_uInt32 a(0); a < aCandidates.size(); a++)
                 {
-                    if(pCandidate->getUserDefined())
-                    {
-                        const basegfx::B2DPoint aAbsolutePos(pObj->getSdrObjectTransformation() * pCandidate->getUnitPosition());
-                        const double fDist(basegfx::B2DVector(aAbsolutePos - rPnt).getLength());
+                    const sdr::glue::GluePoint* pCandidate = aCandidates[a];
 
-                        if(basegfx::fTools::lessOrEqual(fDist, getHitTolLog()))
+                    if(pCandidate)
+                    {
+                        if(pCandidate->getUserDefined())
                         {
-                            rpObj = pObj;
-                            rnId = pCandidate->getID();
+                            const basegfx::B2DPoint aAbsolutePos(pObj->getSdrObjectTransformation() * pCandidate->getUnitPosition());
+                            const double fDist(basegfx::B2DVector(aAbsolutePos - rPnt).getLength());
 
-                            return true;
+                            if(basegfx::fTools::lessOrEqual(fDist, getHitTolLog()))
+                            {
+                                rpObj = pObj;
+                                rnId = pCandidate->getID();
+
+                                return true;
+                            }
                         }
                     }
-                }
-                else
-                {
-                    OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
+                    else
+                    {
+                        OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty spots (!)");
+                    }
                 }
             }
         }
-
-        // TTTT:GLUE
-        //    const sal_uInt32 nNum(pGPL->GPLHitTest(rPnt, getHitTolLog(), pObj->getSdrObjectTransformation(), false));
-        //
-        //    if(SDRGLUEPOINT_NOTFOUND != nNum) 
-        //    {
-        //        // #i38892#
-        //        const sdr::glue::Point& rCandidate = (*pGPL)[nNum];
-        //
-        //        if(rCandidate.IsUserDefined())
-        //        {
-        //            rpObj=pObj;
-        //            rnId=(*pGPL)[nNum].GetId();
-        //            
-        //            return true;
-        //        }
-        //    }
-        //}
+        else
+        {
+            OSL_ENSURE(false, "Got a selection with empty slots (!)");
+        }
     }
 
     return false;

Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svdoashp.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svdoashp.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdoashp.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdoashp.cxx Thu Oct 17 18:36:03 2013
@@ -1812,148 +1812,6 @@ void SdrObjCustomShape::setSdrObjectTran
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
-// TTTT:GLUE
-//void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded()
-//{
-//	const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
-//
-//	if(pSdrObject)
-//	{
-//		const sdr::glue::List* pSource = pSdrObject->GetGluePointList(false);
-//
-//		if(pSource && pSource->GetCount())
-//		{
-//			//if(!SdrTextObj::GetGluePointList())
-//			//{
-//			//	SdrTextObj::ForceGluePointList();
-//			//}
-//
-//			const sdr::glue::List* pList = SdrTextObj::GetGluePointList(true);
-//
-//			if(pList)
-//			{
-//				sdr::glue::List aNewList;
-//				sal_uInt16 a;
-//
-//				// build transform matrix from helper object to local
-//				basegfx::B2DHomMatrix aTransFromHelperToLocal(pSdrObject->getSdrObjectTransformation());
-//				aTransFromHelperToLocal.invert();
-//				aTransFromHelperToLocal = getSdrObjectTransformation() * aTransFromHelperToLocal;
-//
-//				for(a = 0; a < pSource->GetCount(); a++)
-//				{
-//					sdr::glue::Point aCopy((*pSource)[a]);
-//					aCopy.SetUserDefined(false);
-//
-//					basegfx::B2DPoint aGluePos(aCopy.GetPos());
-//					aGluePos *= aTransFromHelperToLocal;
-//					aCopy.SetPos(aGluePos);
-//
-//					aNewList.Insert(aCopy);
-//				}
-//
-//				for(a = 0; a < pList->GetCount(); a++)
-//				{
-//					const sdr::glue::Point& rCandidate = (*pList)[a];
-//
-//					if(rCandidate.IsUserDefined())
-//					{
-//						aNewList.Insert(rCandidate);
-//					}
-//				}
-//
-//				// copy new list to local. This is NOT very convenient behaviour, the local
-//				// GluePointList should not be set, but be delivered by using GetGluePointList(),
-//				// maybe on demand. Since the local object is changed here, this is assumed to
-//				// be a result of GetGluePointList and thus the list is copied
-//				if(mpPlusData)
-//				{
-//					*mpPlusData->mpGluePoints = aNewList;
-//				}
-//			}
-//		}
-//	}
-//}
-
-sdr::glue::List* SdrObjCustomShape::GetGluePointList(bool bForce) const
-{
-    sdr::glue::List* pOld = GetGluePointList(false);
-    sdr::glue::List* pNew = GetGluePointList(bForce);
-
-    if(bForce && !pOld && pNew)
-    {
-        // new list was created, add GluePoints from created visualization as non-user-defined GluePoints
-        const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
-
-        if(pSdrObject)
-        {
-            const sdr::glue::List* pSource = pSdrObject->GetGluePointList(false);
-
-            if(pSource)
-            {
-                // build transform from helper object unit coordinates to target object unit coordinates;
-                // we need the inverse of the target object transform. temporarily correct zero sizes for invert
-                basegfx::B2DHomMatrix aInvLocal(basegfx::tools::guaranteeMinimalScaling(getSdrObjectTransformation()));
-                aInvLocal.invert();
-
-                // build full transform
-                basegfx::B2DHomMatrix aFullHelperUnitToTargetUnit(aInvLocal * pSdrObject->getSdrObjectTransformation());
-
-                // get vector, change and copy points
-                const sdr::glue::PointVector aCandidates(pSource->getVector());
-
-                for(sal_uInt32 a(0); a < aCandidates.size(); a++)
-                {
-                    const sdr::glue::Point* pCandidate(aCandidates[a]);
-
-                    if(pCandidate)
-                    {
-                        const basegfx::B2DPoint aNewPos(aFullHelperUnitToTargetUnit * pCandidate->getUnitPosition());
-                        const sdr::glue::Point aNewPoint(
-                            aNewPos,
-                            pCandidate->getEscapeDirections(),
-                            pCandidate->getHorizontalAlignment(),
-                            pCandidate->getVerticalAlignment(),
-                            pCandidate->getRelative(),
-                            false);
-
-                        pNew->add(aNewPoint);
-                    }
-                    else
-                    {
-                        OSL_ENSURE(false, "Got empty slot in sdr::glue::PointVector (!)");
-                    }
-                }
-            }
-        }
-
-        // TTTT:GLUE check here (!)
-        // Add custom glues here (!)
-        // ((SdrObjCustomShape*)this)->ImpCheckCustomGluePointsAreAdded();
-    }
-
-    return mpPlusData ? mpPlusData->mpGluePoints : 0;
-
-    //((SdrObjCustomShape*)this)->ImpCheckCustomGluePointsAreAdded();
-    //return SdrTextObj::GetGluePointList();
-}
-
-//// #i38892# TTTT:GLUE
-//sdr::glue::List* SdrObjCustomShape::ForceGluePointList()
-//{
-//	if(SdrTextObj::ForceGluePointList())
-//	{
-//		ImpCheckCustomGluePointsAreAdded();
-//		return SdrTextObj::ForceGluePointList();
-//	}
-//	else
-//	{
-//		return 0L;
-//	}
-//}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
 void SdrObjCustomShape::AddToHdlList(SdrHdlList& rHdlList) const
 {
 	// add handles from parent object
@@ -2894,7 +2752,270 @@ sdr::contact::ViewContact* SdrObjCustomS
 	return new sdr::contact::ViewContactOfSdrObjCustomShape(*this);
 }
 
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+    namespace glue
+    {
+        // SdrEdgeObj implements it's own GluePointProvider since
+        // - it supports standard AutoGluePoints -> StandardGluePointProvider
+        // - it needs to add some non-user-defined UserGluePoints -> replace
+        //   UserGluePoint methods
+        //
+        // This is a little bit tricky since this implementation has to 'mix' two
+        // sources of UserGluePoints:
+        // - custom-defined ones from the CustomShape visualization geometry (these
+        //   will have the UserDefined-flag on 'false', see 
+        //   EnhancedCustomShape2d::ApplyGluePoints)
+        // - the 'real', user-defined local ones
+        //
+        // This 'mix' still has to keep the unique ID paradigm at inserting new
+        // GluePoints. Assuming that the visualization geometry
+        // - will always create the same numer and list of GluePoints
+        // - is able to create these on demand before user-defined ones are added
+        // this mix is done on the fly in the implementatin below
+
+        class SdrObjCustomShapeGluePointProvider : public StandardGluePointProvider
+        {
+        private:
+            // access to the owner object; always valid due to the
+            // lifetime being less or the same as the owner object
+            const SdrObjCustomShape*            mpSource;
+
+        protected:
+            SdrObjCustomShapeGluePointProvider(const SdrObjCustomShapeGluePointProvider& rCandidate);
+            virtual GluePointProvider& operator=(const GluePointProvider& rCandidate);
+
+            // helper: get access to the custom-defined UserGluePoints' GluePointProvider. This
+            // may/should create the CustomShape visualization geometry and the custom-defined
+            // UserGluePoints with them
+            GluePointProvider* getUserDefinedGluePointProvider() const;
+
+        public:
+            // construction, destruction, copying
+            SdrObjCustomShapeGluePointProvider(const SdrObjCustomShape& rSource);
+            virtual ~SdrObjCustomShapeGluePointProvider();
+
+            // copying
+            virtual GluePointProvider* Clone() const;
+
+            // add new GluePoint, it gets a new ID assigned and a reference to the 
+            // new instance (copied to list) is returned. It will assert when 
+            // already added
+            virtual GluePoint& addUserGluePoint(GluePoint& rNew);
+
+            // remove GluePoint (will assert if it was not added)
+            virtual void removeUserGluePoint(const GluePoint& rNew);
+
+            // check on content
+            virtual bool hasUserGluePoints() const;
+
+            // find UserGluePoint by ID
+            virtual GluePoint* findUserGluePointByID(sal_uInt32 nID) const;
+
+            // get vector of UserGluePoints (pointers to the real points)
+            virtual const GluePointVector getUserGluePointVector() const;
+
+            // adapt UserGluePoints to changed absolute scale, e.g. when not relative and alignments have to be addressed
+            virtual void adaptUserGluePointsToChangedScale(const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale);
+        };
+
+        SdrObjCustomShapeGluePointProvider::SdrObjCustomShapeGluePointProvider(const SdrObjCustomShape& rSource)
+        :   StandardGluePointProvider(),
+            mpSource(&rSource)
+        {
+        }
+
+        SdrObjCustomShapeGluePointProvider::~SdrObjCustomShapeGluePointProvider()
+        {
+        }
+
+        SdrObjCustomShapeGluePointProvider::SdrObjCustomShapeGluePointProvider(const SdrObjCustomShapeGluePointProvider& rCandidate)
+        :   StandardGluePointProvider(),
+            mpSource(rCandidate.mpSource)
+        {
+        }
+
+        GluePointProvider& SdrObjCustomShapeGluePointProvider::operator=(const GluePointProvider& rCandidate)
+        {
+            // call parent to copy UserGluePoints
+            StandardGluePointProvider::operator=(rCandidate);
+
+            const SdrObjCustomShapeGluePointProvider* pSource = dynamic_cast< const SdrObjCustomShapeGluePointProvider* >(&rCandidate);
+
+            if(pSource)
+            {
+                // copy source SdrObject
+                mpSource = pSource->mpSource;
+            }
+
+            return *this;
+        }
+
+        GluePointProvider* SdrObjCustomShapeGluePointProvider::Clone() const
+        {
+            return new SdrObjCustomShapeGluePointProvider(*this);
+        }
+
+        GluePointProvider* SdrObjCustomShapeGluePointProvider::getUserDefinedGluePointProvider() const
+        {
+            const SdrObject* pGeometryVisualization = mpSource->GetSdrObjectFromCustomShape();
+
+            if(pGeometryVisualization)
+            {
+                return &pGeometryVisualization->GetGluePointProvider();
+            }
+
+            return 0;
+        }
+
+        GluePoint& SdrObjCustomShapeGluePointProvider::addUserGluePoint(GluePoint& rNew)
+        {
+            if(StandardGluePointProvider::hasUserGluePoints())
+            {
+                // there are already user-defined UserGluePoints, thus the biggest ID
+                // is already set and a newly added one will be based on it, increasing 
+                // it; call parent
+                return StandardGluePointProvider::addUserGluePoint(rNew);
+            }
+
+            // no user-defined UserGluePoints yet; check if we have custom-defined oones
+            GluePointProvider* pSource = getUserDefinedGluePointProvider();
+
+            if(!pSource || !pSource->hasUserGluePoints())
+            {
+                // no custom-defined UserGluePoints; call parent
+                return StandardGluePointProvider::addUserGluePoint(rNew);
+            }
+
+            // we have to add the first user-defined UserGluePoint and there are 
+            // custom-defined ones. Call parent to get the needed instance
+            GluePoint& rRetval = StandardGluePointProvider::addUserGluePoint(rNew);
+
+            // test if add did work; if yes, a changed entry will be returned
+            if(&rRetval != &rNew)
+            {
+                // get new highest ID
+                const GluePointVector aCustomGluePoints(pSource->getUserGluePointVector());
+
+                if(aCustomGluePoints.empty())
+                {
+                    // error: pSource->hasUserGluePoints() had answered true before
+                    OSL_ENSURE(false, "no custom-defined UserGluePoints, but was stated so before (!)");
+                }
+                else
+                {
+                    const GluePoint* pLastCustomGluePoint = aCustomGluePoints.back();
+
+                    if(pLastCustomGluePoint)
+                    {
+                        // correct ID at new, first user-defined UserGluePoint
+                        setIdAtGluePoint(rRetval, pLastCustomGluePoint->getID() + 1);
+                    }
+                    else
+                    {
+                        // error: not empty, but no last
+                        OSL_ENSURE(false, "custom-defined UserGluePoints, but empty last entry (!)");
+                    }
+                }
+            }
+
+            return rRetval;
+        }
+
+        void SdrObjCustomShapeGluePointProvider::removeUserGluePoint(const GluePoint& rNew)
+        {
+            // non-user-defined GluePoints cannot be removed, thus just call parent and 
+            // try to remove locally. This method does not need to be overloaded, but it
+            // is better for documentation purposes
+            StandardGluePointProvider::removeUserGluePoint(rNew);
+        }
+
+        bool SdrObjCustomShapeGluePointProvider::hasUserGluePoints() const
+        {
+            if(StandardGluePointProvider::hasUserGluePoints())
+            {
+                // if we alraedy have own user-defined GluePoints we are done
+                return true;
+            }
+
+            GluePointProvider* pSource = getUserDefinedGluePointProvider();
+
+            if(pSource)
+            {
+                // return state of custom shape defining geometry
+                return pSource->hasUserGluePoints();
+            }
+
+            return false;
+        }
+
+        GluePoint* SdrObjCustomShapeGluePointProvider::findUserGluePointByID(sal_uInt32 nID) const
+        {
+            // call parent
+            GluePoint* pRetval = StandardGluePointProvider::findUserGluePointByID(nID);
+
+            if(pRetval)
+            {
+                // done if found locally
+                return pRetval;
+            }
+
+            GluePointProvider* pSource = getUserDefinedGluePointProvider();
+
+            if(pSource)
+            {
+                // try to get from custom shape defining geometry
+                pRetval = pSource->findUserGluePointByID(nID);
+            }
+
+            return pRetval;
+        }
+
+        const GluePointVector SdrObjCustomShapeGluePointProvider::getUserGluePointVector() const
+        {
+            GluePointProvider* pSource = getUserDefinedGluePointProvider();
+
+            if(!pSource)
+            {
+                // no CustomShape GluePoints, return local state by calling parent
+                return StandardGluePointProvider::getUserGluePointVector();
+            }
+
+            if(!StandardGluePointProvider::hasUserGluePoints())
+            {
+                // no local GluePoints, return from custom
+                return pSource->getUserGluePointVector();
+            }
+
+            // need to mix both; add custom first
+            GluePointVector aRetval(pSource->getUserGluePointVector());
+            const GluePointVector aLocal(StandardGluePointProvider::getUserGluePointVector());
+
+            aRetval.insert(aRetval.end(), aLocal.begin(), aLocal.end());
+            return aRetval;
+        }
+
+        void SdrObjCustomShapeGluePointProvider::adaptUserGluePointsToChangedScale(const basegfx::B2DVector& rOldScale, const basegfx::B2DVector& rNewScale)
+        {
+            // non-user-defined GluePoints cannot be adapted/changed, thus just 
+            // call parent. This method does not need to be overloaded, but it
+            // is better for documentation purposes
+            StandardGluePointProvider::adaptUserGluePointsToChangedScale(rOldScale, rNewScale);
+        }
+
+    } // end of namespace glue
+} // end of namespace sdr
+
+sdr::glue::GluePointProvider* SdrObjCustomShape::CreateObjectSpecificGluePointProvider()
+{
+    return new sdr::glue::SdrObjCustomShapeGluePointProvider(*this);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
 // #i33136#
+
 bool SdrObjCustomShape::doConstructOrthogonal(const ::rtl::OUString& rName)
 {
 	bool bRetval(false);



Mime
View raw message