Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svdobj.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svdobj.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdobj.cxx (original) +++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdobj.cxx Thu Oct 17 18:36:03 2013 @@ -327,7 +327,7 @@ SdrObjUserData* SdrObjUserDataList::Remo SdrObjGeoData::SdrObjGeoData() : maSdrObjectTransformation(), maObjectAnchor(0.0, 0.0), - mpGPL(0), + mpGluePointProvider(0), mnLayerID(0), mbMoveProtect(false), mbSizeProtect(false), @@ -338,14 +338,16 @@ SdrObjGeoData::SdrObjGeoData() SdrObjGeoData::~SdrObjGeoData() { - delete mpGPL; + if(mpGluePointProvider) + { + delete mpGluePointProvider; + } } //////////////////////////////////////////////////////////////////////////////////////////////////// SdrObjPlusData::SdrObjPlusData() : mpUserDataList(0), - mpGluePoints(0), maObjName(), maObjTitle(), maObjDescription(), @@ -361,11 +363,6 @@ SdrObjPlusData::~SdrObjPlusData() { delete mpUserDataList; } - - if(mpGluePoints) - { - delete mpGluePoints; - } } SdrObjPlusData* SdrObjPlusData::Clone(SdrObject* pObj1) const @@ -394,12 +391,6 @@ SdrObjPlusData* SdrObjPlusData::Clone(Sd } } - // copy GluePoints - if(mpGluePoints) - { - pNeuPlusData->mpGluePoints = new sdr::glue::List(*mpGluePoints); - } - // copy object name, title and description pNeuPlusData->maObjName = maObjName; pNeuPlusData->maObjTitle = maObjTitle; @@ -485,12 +476,12 @@ sdr::contact::ViewContact& SdrObject::Ge return *mpViewContact; } -sdr::gluepoint::GluePointProvider* SdrObject::CreateObjectSpecificGluePointProvider() +sdr::glue::GluePointProvider* SdrObject::CreateObjectSpecificGluePointProvider() { - return new sdr::gluepoint::GluePointProvider(); + return new sdr::glue::StandardGluePointProvider(); } -sdr::gluepoint::GluePointProvider& SdrObject::GetGluePointProvider() const +sdr::glue::GluePointProvider& SdrObject::GetGluePointProvider() const { if(!mpGluePointProvider) { @@ -975,7 +966,7 @@ void SdrObject::copyDataFromSdrObject(co if(rSource.mpGluePointProvider) { - mpGluePointProvider = &rSource.GetGluePointProvider().Clone(); + mpGluePointProvider = rSource.mpGluePointProvider->Clone(); } maSdrObjectTransformation = rSource.maSdrObjectTransformation.getB2DHomMatrix(); @@ -1576,26 +1567,17 @@ void SdrObject::SaveGeoData(SdrObjGeoDat rGeo.mbVisible = mbVisible; rGeo.mnLayerID = mnLayerID; - // Benutzerdefinierte Klebepunkte - if(mpPlusData && mpPlusData->mpGluePoints) - { - if(rGeo.mpGPL) - { - *rGeo.mpGPL = *mpPlusData->mpGluePoints; - } - else - { - rGeo.mpGPL = new sdr::glue::List(*mpPlusData->mpGluePoints); - } - } - else + // gluepoints + if(mpGluePointProvider) { - if(rGeo.mpGPL) + if(rGeo.mpGluePointProvider) { - delete rGeo.mpGPL; - rGeo.mpGPL = 0; - } - } + delete rGeo.mpGluePointProvider; + rGeo.mpGluePointProvider = 0; + } + + rGeo.mpGluePointProvider = mpGluePointProvider->Clone(); + } } void SdrObject::RestGeoData(const SdrObjGeoData& rGeo) @@ -1620,28 +1602,17 @@ void SdrObject::RestGeoData(const SdrObj mbVisible = rGeo.mbVisible; mnLayerID = rGeo.mnLayerID; - // Benutzerdefinierte Klebepunkte - if(rGeo.mpGPL) + // gluepoints + if(rGeo.mpGluePointProvider) { - ImpForcePlusData(); - - if(mpPlusData->mpGluePoints) - { - *mpPlusData->mpGluePoints = *rGeo.mpGPL; - } - else - { - mpPlusData->mpGluePoints = new sdr::glue::List(*rGeo.mpGPL); - } - } - else - { - if(mpPlusData && mpPlusData->mpGluePoints) + if(mpGluePointProvider) { - delete mpPlusData->mpGluePoints; - mpPlusData->mpGluePoints = 0; - } - } + delete mpGluePointProvider; + mpGluePointProvider = 0; + } + + mpGluePointProvider = rGeo.mpGluePointProvider->Clone(); + } } SdrObjGeoData* SdrObject::GetGeoData() const @@ -2063,80 +2034,6 @@ void SdrObject::SetStyleSheet(SfxStyleSh } } -sdr::glue::Point SdrObject::GetVertexGluePoint(sal_uInt32 nPosNum) const -{ - basegfx::B2DPoint aGluePosition(0.5, 0.5); - - switch(nPosNum) - { - default: //case 0: TopCenter - { - aGluePosition.setY(0.0); - break; - } - case 1: // RightCenter - { - aGluePosition.setX(1.0); - break; - } - case 2: // BottomCenter - { - aGluePosition.setY(1.0); - break; - } - case 3: // LeftCenter - { - aGluePosition.setX(0.0); - break; - } - } - - // create GluePoint, need to set UserDefined to false for these default GluePoints - return sdr::glue::Point( - aGluePosition, - sdr::glue::Point::ESCAPE_DIRECTION_SMART, - sdr::glue::Point::Alignment_Center, - sdr::glue::Point::Alignment_Center, - true, // mbRelative - false); // mbUserDefined - - // TTTT:GLUE - //aGluePosition = getSdrObjectTransformation() * aGluePosition; - //sdr::glue::Point aGP(aGluePosition - sdr::legacy::GetSnapRange(*this).getCenter()); - //aGP.SetPercent(false); - // - //return aGP; -} - -// TTTT:GLUE -//const sdr::glue::List* SdrObject::GetGluePointList() const -//{ -// if(mpPlusData) -// { -// return mpPlusData->mpGluePoints; -// } -// -// return 0; -//} - -sdr::glue::List* SdrObject::GetGluePointList(bool bForce) const -{ - if(bForce) - { - if(!mpPlusData) - { - const_cast< SdrObject* >(this)->ImpForcePlusData(); - } - - if(!mpPlusData->mpGluePoints) - { - const_cast< SdrObject* >(this)->mpPlusData->mpGluePoints = new sdr::glue::List; - } - } - - return mpPlusData ? mpPlusData->mpGluePoints : 0; -} - void extractLineContourFromPrimitive2DSequence( const drawinglayer::primitive2d::Primitive2DSequence& rxSequence, basegfx::B2DPolygonVector& rExtractedHairlines, @@ -2628,9 +2525,9 @@ void SdrObject::setSdrObjectTransformati if(rTransformation != getSdrObjectTransformation()) { basegfx::B2DVector aOldAbsoluteScale; - sdr::glue::List* pGPL = GetGluePointList(false); + const bool bTransformGluePoints(mpGluePointProvider && mpGluePointProvider->hasUserGluePoints()); - if(pGPL) + if(bTransformGluePoints) { // remember old absolute size aOldAbsoluteScale = basegfx::absolute(getSdrObjectScale()); @@ -2641,7 +2538,7 @@ void SdrObject::setSdrObjectTransformati maSdrObjectTransformation.setB2DHomMatrix(rTransformation); SetChanged(); - if(pGPL) + if(bTransformGluePoints) { // get new absolute size const basegfx::B2DVector aNewAbsoluteScale(basegfx::absolute(getSdrObjectScale())); @@ -2649,7 +2546,7 @@ void SdrObject::setSdrObjectTransformati if(!aOldAbsoluteScale.equal(aNewAbsoluteScale)) { // adapt the non-relative gluepoints according to their alignments - pGPL->adaptToChangedScale(aOldAbsoluteScale, aNewAbsoluteScale); + mpGluePointProvider->adaptUserGluePointsToChangedScale(aOldAbsoluteScale, aNewAbsoluteScale); } } }
Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svdoedge.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svdoedge.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdoedge.cxx (original) +++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdoedge.cxx Thu Oct 17 18:36:03 2013 @@ -55,8 +55,8 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// -#define SDRESC_VERT (sdr::glue::Point::ESCAPE_DIRECTION_TOP|sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM) -#define SDRESC_HORZ (sdr::glue::Point::ESCAPE_DIRECTION_LEFT|sdr::glue::Point::ESCAPE_DIRECTION_RIGHT) +#define SDRESC_VERT (sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP|sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM) +#define SDRESC_HORZ (sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT|sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT) #define SDRESC_ALL (SDRESC_HORZ|SDRESC_VERT) SdrObjConnection::~SdrObjConnection() @@ -72,53 +72,36 @@ void SdrObjConnection::ResetVars() mbAutoVertex = false; } -bool SdrObjConnection::TakeGluePoint(sdr::glue::Point& rGP/* TTTT:GLUE, bool bSetAbsPos*/) const +bool SdrObjConnection::TakeGluePoint(sdr::glue::GluePoint& rGP) const { bool bRet(false); if(mpConnectedSdrObject) { // Ein Obj muss schon angedockt sein! + const sdr::glue::GluePointProvider& rProvider = mpConnectedSdrObject->GetGluePointProvider(); + if(mbAutoVertex) { - rGP = mpConnectedSdrObject->GetVertexGluePoint(mnConnectorId); + rGP = rProvider.getAutoGluePointByIndex(mnConnectorId); bRet = true; } else { - const sdr::glue::List* pGPL = mpConnectedSdrObject->GetGluePointList(false); - if(pGPL) + if(rProvider.hasUserGluePoints()) { - sdr::glue::Point* pCandidate = pGPL->findByID(mnConnectorId); + const sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(mnConnectorId); if(pCandidate) { rGP = *pCandidate; bRet = true; } - - // TTTT:GLUE - //const sal_uInt32 nNum(pGPL->FindGluePoint(mnConnectorId)); - // - //if(SDRGLUEPOINT_NOTFOUND != nNum) - //{ - // rGP=(*pGPL)[nNum]; - // bRet = true; - //} } } } - //if(bRet && bSetAbsPos) - //{ - // - // - // const basegfx::B2DPoint aPt(rGP.GetAbsolutePos(sdr::legacy::GetSnapRange(*mpConnectedSdrObject))); - // - // rGP.SetPos(aPt + maObjOfs); - //} - return bRet; } @@ -212,6 +195,149 @@ sdr::contact::ViewContact* SdrEdgeObj::C } ////////////////////////////////////////////////////////////////////////////// +// GluePoint section + +namespace sdr +{ + namespace glue + { + // SdrEdgeObj implements it's own GluePointProvider since + // - it does not support UserGluePoints -> use GluePointProvider + // - it supports AutoGluePoints, but different from standard -> replace + // AutoGluePoint methods + + class SdrEdgeObjGluePointProvider : public GluePointProvider + { + private: + // we need a reference to the owner object, given as reference in + // the constructor to express that it will always be set + const SdrEdgeObj* mpSource; + + protected: + SdrEdgeObjGluePointProvider(const SdrEdgeObjGluePointProvider& rCandidate); + virtual GluePointProvider& operator=(const GluePointProvider& rCandidate); + + public: + // construction, destruction, copying + SdrEdgeObjGluePointProvider(const SdrEdgeObj& rSource); + virtual ~SdrEdgeObjGluePointProvider(); + + // copying + virtual GluePointProvider* Clone() const; + + // AutoGluePoint read access (read only) + virtual sal_uInt32 getAutoGluePointCount() const; + virtual GluePoint getAutoGluePointByIndex(sal_uInt32 nIndex) const; + }; + + SdrEdgeObjGluePointProvider::SdrEdgeObjGluePointProvider(const SdrEdgeObj& rSource) + : GluePointProvider(), + mpSource(&rSource) + { + } + + SdrEdgeObjGluePointProvider::~SdrEdgeObjGluePointProvider() + { + } + + SdrEdgeObjGluePointProvider::SdrEdgeObjGluePointProvider(const SdrEdgeObjGluePointProvider& rCandidate) + : GluePointProvider(), + mpSource(rCandidate.mpSource) + { + } + + GluePointProvider& SdrEdgeObjGluePointProvider::operator=(const GluePointProvider& rCandidate) + { + // call parent to copy UserGluePoints + GluePointProvider::operator=(rCandidate); + + const SdrEdgeObjGluePointProvider* pSource = dynamic_cast< const SdrEdgeObjGluePointProvider* >(&rCandidate); + + if(pSource) + { + mpSource = pSource->mpSource; + } + + return *this; + } + + GluePointProvider* SdrEdgeObjGluePointProvider::Clone() const + { + return new SdrEdgeObjGluePointProvider(*this); + } + + sal_uInt32 SdrEdgeObjGluePointProvider::getAutoGluePointCount() const + { + // to stay compatible, also use four points (anyways UNO API uses a fixed count of four + // currently). Seel below, 0,1 create the same point, 2 the start, 3, the end + return 4; + } + + GluePoint SdrEdgeObjGluePointProvider::getAutoGluePointByIndex(sal_uInt32 nIndex) const + { + // no error with indices, just repeatedly return last GluePoint as fallback + const basegfx::B2DPolygon aEdgeTrack(mpSource->GetEdgeTrackPath()); + const sal_uInt32 nPntAnz(aEdgeTrack.count()); + basegfx::B2DPoint aOldPoint(0.0, 0.0); + + if(nPntAnz) + { + switch(nIndex) + { + case 2: + { + if(!mpSource->GetConnectedNode(true)) + { + aOldPoint = aEdgeTrack.getB2DPoint(0); + } + break; + } + case 3: + { + if(!mpSource->GetConnectedNode(false)) + { + aOldPoint = aEdgeTrack.getB2DPoint(nPntAnz - 1); + } + break; + } + default: + { + if(1 == (nPntAnz & 1)) + { + aOldPoint = aEdgeTrack.getB2DPoint(nPntAnz / 2); + } + else + { + aOldPoint = (aEdgeTrack.getB2DPoint((nPntAnz/2) - 1) + aEdgeTrack.getB2DPoint(nPntAnz/2)) * 0.5; + } + break; + } + } + } + + // need to make absolute position relative. temporarily correct zero sizes for invert + basegfx::B2DHomMatrix aTransform(basegfx::tools::guaranteeMinimalScaling(mpSource->getSdrObjectTransformation())); + + aTransform.invert(); + aOldPoint = aTransform * aOldPoint; + + return sdr::glue::GluePoint( + aOldPoint, + sdr::glue::GluePoint::ESCAPE_DIRECTION_SMART, + sdr::glue::GluePoint::Alignment_Center, + sdr::glue::GluePoint::Alignment_Center, + true, // mbRelative + false); // mbUserDefined + } + } // end of namespace glue +} // end of namespace sdr + +sdr::glue::GluePointProvider* SdrEdgeObj::CreateObjectSpecificGluePointProvider() +{ + return new sdr::glue::SdrEdgeObjGluePointProvider(*this); +} + +////////////////////////////////////////////////////////////////////////////// SdrEdgeObj::SdrEdgeObj(SdrModel& rSdrModel) : SdrTextObj(rSdrModel), @@ -468,64 +594,6 @@ sal_uInt16 SdrEdgeObj::GetObjIdentifier( return sal_uInt16(OBJ_EDGE); } -sdr::glue::Point SdrEdgeObj::GetVertexGluePoint(sal_uInt32 nNum) const -{ - //basegfx::B2DPoint aPoint(0.0, 0.0); - const sal_uInt32 nPntAnz(maEdgeTrack.count()); - basegfx::B2DPoint aOldPoint; - - if(nPntAnz) - { - if(2 == nNum && !GetConnectedNode(true)) - { - aOldPoint = maEdgeTrack.getB2DPoint(0); - } - else if(3 == nNum && !GetConnectedNode(false)) - { - aOldPoint = maEdgeTrack.getB2DPoint(nPntAnz - 1); - } - else - { - if(1 == (nPntAnz & 1)) - { - aOldPoint = maEdgeTrack.getB2DPoint(nPntAnz / 2); - } - else - { - aOldPoint = (maEdgeTrack.getB2DPoint((nPntAnz/2) - 1) + maEdgeTrack.getB2DPoint(nPntAnz/2)) * 0.5; - } - } - } - - // TTTT:GLUE - //sdr::glue::Point aGP(aOldPoint); - //aGP.SetPercent(false); - - // need to make absolute position relative. temporarily correct zero sizes for invert - basegfx::B2DHomMatrix aTransform(basegfx::tools::guaranteeMinimalScaling(getSdrObjectTransformation())); - - aTransform.invert(); - aOldPoint = aTransform * aOldPoint; - - return sdr::glue::Point( - aOldPoint, - sdr::glue::Point::ESCAPE_DIRECTION_SMART, - sdr::glue::Point::Alignment_Center, - sdr::glue::Point::Alignment_Center, - true, // mbRelative - false); // mbUserDefined -} - -sdr::glue::List* SdrEdgeObj::GetGluePointList(bool /*bForce*/) const -{ - return NULL; // Keine benutzerdefinierten Klebepunkte fuer Verbinder #31671# -} - -//sdr::glue::List* SdrEdgeObj::ForceGluePointList() -//{ -// return NULL; // Keine benutzerdefinierten Klebepunkte fuer Verbinder #31671# -//} - void SdrEdgeObj::ConnectToNode(bool bTail1, SdrObject* pObj) { SdrObjConnection& rCon=GetConnection(bTail1); @@ -574,37 +642,41 @@ bool SdrEdgeObj::CheckNodeConnection(boo if(rCon.mpConnectedSdrObject && rCon.mpConnectedSdrObject->getSdrPageFromSdrObject() == getSdrPageFromSdrObject() && nPtAnz) { - const sdr::glue::List* pGPL = rCon.mpConnectedSdrObject->GetGluePointList(false); - const sdr::glue::PointVector aGluePointVector(pGPL ? pGPL->getVector() : sdr::glue::PointVector()); - const sal_uInt32 nConAnz(aGluePointVector.size()); - const sal_uInt32 nGesAnz(nConAnz + 4); - const basegfx::B2DPoint aTail(bTail1 ? maEdgeTrack.getB2DPoint(0) : maEdgeTrack.getB2DPoint(nPtAnz - 1)); - - for(sal_uInt32 i(0); i < nGesAnz && !bRet; i++) - { - if(i < nConAnz) - { - // UserDefined or CustomShape - const sdr::glue::Point* pCandidate = aGluePointVector[i]; + const sdr::glue::GluePointProvider& rProvider = rCon.mpConnectedSdrObject->GetGluePointProvider(); - if(pCandidate) - { - const basegfx::B2DPoint aGluePos(rCon.mpConnectedSdrObject->getSdrObjectTransformation() * pCandidate->getUnitPosition()); + if(rProvider.hasUserGluePoints()) + { + const sdr::glue::GluePointVector aGluePointVector(rProvider.getUserGluePointVector()); + const sal_uInt32 nConAnz(aGluePointVector.size()); + const sal_uInt32 nGesAnz(nConAnz + rProvider.getAutoGluePointCount()); + const basegfx::B2DPoint aTail(bTail1 ? maEdgeTrack.getB2DPoint(0) : maEdgeTrack.getB2DPoint(nPtAnz - 1)); + + for(sal_uInt32 i(0); i < nGesAnz && !bRet; i++) + { + if(i < nConAnz) + { + // UserDefined or CustomShape + const sdr::glue::GluePoint* pCandidate = aGluePointVector[i]; + + 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 sdr::glue::GluePoint aPt(rProvider.getAutoGluePointByIndex(i - nConAnz)); + const basegfx::B2DPoint aGluePos(rCon.mpConnectedSdrObject->getSdrObjectTransformation() * aPt.getUnitPosition()); bRet = (aTail == aGluePos); } - else - { - OSL_ENSURE(false, "Got sdr::glue::PointVector with emty entries (!)"); - } - } - else //if (i<nConAnz+4) - { - // Vertex - const sdr::glue::Point aPt(rCon.mpConnectedSdrObject->GetVertexGluePoint(i - nConAnz)); - const basegfx::B2DPoint aGluePos(rCon.mpConnectedSdrObject->getSdrObjectTransformation() * aPt.getUnitPosition()); - - bRet = (aTail == aGluePos); } } } @@ -726,22 +798,22 @@ sal_uInt16 SdrEdgeObj::ImpCalcEscAngle(S if (byMitt) nRet|=SDRESC_VERT; if (bxMitt) nRet|=SDRESC_HORZ; if (dxl<dxr) { // Links - if (dyo<dyu) nRet|=sdr::glue::Point::ESCAPE_DIRECTION_LEFT | sdr::glue::Point::ESCAPE_DIRECTION_TOP; - else nRet|=sdr::glue::Point::ESCAPE_DIRECTION_LEFT | sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM; + if (dyo<dyu) nRet|=sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT | sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP; + else nRet|=sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT | sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM; } else { // Rechts - if (dyo<dyu) nRet|=sdr::glue::Point::ESCAPE_DIRECTION_RIGHT | sdr::glue::Point::ESCAPE_DIRECTION_TOP; - else nRet|=sdr::glue::Point::ESCAPE_DIRECTION_RIGHT | sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM; + if (dyo<dyu) nRet|=sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT | sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP; + else nRet|=sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT | sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM; } return nRet; } if (dx<dy) { // waagerecht if (bxMitt) return SDRESC_HORZ; - if (dxl<dxr) return sdr::glue::Point::ESCAPE_DIRECTION_LEFT; - else return sdr::glue::Point::ESCAPE_DIRECTION_RIGHT; + if (dxl<dxr) return sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT; + else return sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT; } else { // senkrecht if (byMitt) return SDRESC_VERT; - if (dyo<dyu) return sdr::glue::Point::ESCAPE_DIRECTION_TOP; - else return sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM; + if (dyo<dyu) return sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP; + else return sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM; } } @@ -828,7 +900,7 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcE basegfx::B2DPoint aPt1(maEdgeTrack.getB2DPoint(0)); basegfx::B2DPoint aPt2(maEdgeTrack.getB2DPoint(nCount - 1)); const basegfx::B2DRange aBaseRange(aPt1, aPt2); - sdr::glue::Point aGP1,aGP2; + sdr::glue::GluePoint aGP1,aGP2; sal_uInt16 nEsc1(SDRESC_ALL); sal_uInt16 nEsc2(SDRESC_ALL); basegfx::B2DRange aBoundRange1; @@ -851,8 +923,6 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcE aBoundRange1 = rCon1.mpConnectedSdrObject->getObjectRange(0); } - // TTTT:GLUE aBoundRange1.transform(basegfx::tools::createTranslateB2DHomMatrix(rCon1.maObjOfs)); - const sal_Int32 nH(((SdrEdgeNode1HorzDistItem&)rSet.Get(SDRATTR_EDGENODE1HORZDIST)).GetValue()); const sal_Int32 nV(((SdrEdgeNode1VertDistItem&)rSet.Get(SDRATTR_EDGENODE1VERTDIST)).GetValue()); @@ -862,7 +932,7 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcE } else { - aBewareRange1 = aBoundRange1 = basegfx::B2DRange(aPt1); // TTTT:GLUE + rCon1.maObjOfs); + aBewareRange1 = aBoundRange1 = basegfx::B2DRange(aPt1); } if(bCon2) @@ -876,8 +946,6 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcE aBoundRange2 = rCon2.mpConnectedSdrObject->getObjectRange(0); } - // TTTT:GLUE aBoundRange2.transform(basegfx::tools::createTranslateB2DHomMatrix(rCon2.maObjOfs)); - const sal_Int32 nH(((SdrEdgeNode2HorzDistItem&)rSet.Get(SDRATTR_EDGENODE2HORZDIST)).GetValue()); const sal_Int32 nV(((SdrEdgeNode2VertDistItem&)rSet.Get(SDRATTR_EDGENODE2VERTDIST)).GetValue()); @@ -887,7 +955,7 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcE } else { - aBewareRange2 = aBoundRange2 = basegfx::B2DRange(aPt2); // TTTT:GLUE + rCon2.maObjOfs); + aBewareRange2 = aBoundRange2 = basegfx::B2DRange(aPt2); } sal_uInt32 nBestQual=0xFFFFFFFF; @@ -933,14 +1001,14 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcE rCon1.mnConnectorId = nNum1; } - if(bCon1 && rCon1.TakeGluePoint(aGP1/*TTTT:GLUE, true*/)) + if(bCon1 && rCon1.TakeGluePoint(aGP1)) { aPt1 = rCon1.mpConnectedSdrObject->getSdrObjectTransformation() * aGP1.getUnitPosition(); nEsc1 = aGP1.getEscapeDirections(); - if(sdr::glue::Point::ESCAPE_DIRECTION_SMART == nEsc1) + if(sdr::glue::GluePoint::ESCAPE_DIRECTION_SMART == nEsc1) { - nEsc1 = ImpCalcEscAngle(rCon1.mpConnectedSdrObject, aPt1); // TTTT:GLUE - rCon1.maObjOfs); + nEsc1 = ImpCalcEscAngle(rCon1.mpConnectedSdrObject, aPt1); } } @@ -951,24 +1019,24 @@ basegfx::B2DPolygon SdrEdgeObj::ImpCalcE rCon2.mnConnectorId = nNum2; } - if(bCon2 && rCon2.TakeGluePoint(aGP2/*TTTT:GLUE, true*/)) + if(bCon2 && rCon2.TakeGluePoint(aGP2)) { aPt2 = rCon2.mpConnectedSdrObject->getSdrObjectTransformation() * aGP2.getUnitPosition(); nEsc2 = aGP2.getEscapeDirections(); - if(sdr::glue::Point::ESCAPE_DIRECTION_SMART == nEsc2) + if(sdr::glue::GluePoint::ESCAPE_DIRECTION_SMART == nEsc2) { - nEsc2 = ImpCalcEscAngle(rCon2.mpConnectedSdrObject, aPt2); // TTTT:GLUE - rCon2.maObjOfs); + nEsc2 = ImpCalcEscAngle(rCon2.mpConnectedSdrObject, aPt2); } } for(long nA1(0); nA1 < 36000; nA1 += 9000) { - const sal_uInt16 nE1(!nA1 ? sdr::glue::Point::ESCAPE_DIRECTION_RIGHT : 9000 == nA1 ? sdr::glue::Point::ESCAPE_DIRECTION_TOP : 18000 == nA1 ? sdr::glue::Point::ESCAPE_DIRECTION_LEFT : 27000 == nA1 ? sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM : 0); + const sal_uInt16 nE1(!nA1 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT : 9000 == nA1 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP : 18000 == nA1 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT : 27000 == nA1 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM : 0); for(long nA2(0); nA2 < 36000; nA2 += 9000) { - const sal_uInt16 nE2(!nA2 ? sdr::glue::Point::ESCAPE_DIRECTION_RIGHT : 9000 == nA2 ? sdr::glue::Point::ESCAPE_DIRECTION_TOP : 18000 == nA2 ? sdr::glue::Point::ESCAPE_DIRECTION_LEFT : 27000 == nA2 ? sdr::glue::Point::ESCAPE_DIRECTION_BOTTOM : 0); + const sal_uInt16 nE2(!nA2 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_RIGHT : 9000 == nA2 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_TOP : 18000 == nA2 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_LEFT : 27000 == nA2 ? sdr::glue::GluePoint::ESCAPE_DIRECTION_BOTTOM : 0); if((nEsc1 & nE1) && (nEsc2 & nE2)) { @@ -2192,17 +2260,6 @@ basegfx::B2DPolygon SdrEdgeObj::ImplAddC SdrObjConnection aMyCon1(maCon1); SdrObjConnection aMyCon2(maCon2); - // TTTT:GLUE - //if (bTail1) - //{ - // aMyCon1.maObjOfs *= rDragMethod.getCurrentTransformation(); - //} - // - //if (bTail2) - //{ - // aMyCon2.maObjOfs *= rDragMethod.getCurrentTransformation(); - //} - SdrEdgeInfoRec aInfo(maEdgeInfo); aResult = ImpCalcEdgeTrack(aMyCon1, aMyCon2, &aInfo); } @@ -2368,24 +2425,26 @@ void SdrEdgeObj::FindConnector( // Die Userdefined Konnektoren haben absolute Prioritaet. // Danach kommt Vertex, Corner und Mitte(Best) gleich priorisiert. // Zum Schluss kommt noch ein HitTest aufs Obj. - const sdr::glue::List* pGPL = pObj->GetGluePointList(false); - const sdr::glue::PointVector aGluePointVector(pGPL ? pGPL->getVector() : sdr::glue::PointVector()); - const sal_uInt32 nConAnz(aGluePointVector.size()); - sal_uInt32 nGesAnz=nConAnz+9; + const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider(); + const sdr::glue::GluePointVector aUserGluePointVector(rProvider.getUserGluePointVector()); + const sal_uInt32 nUserGluePointCount(aUserGluePointVector.size()); + const sal_uInt32 nAutoGluePointCount(rProvider.getAutoGluePointCount()); + const sal_uInt32 nAllGluePointCount(nUserGluePointCount + nAutoGluePointCount + 1); bool bUserFnd=false; sal_uInt32 nBestDist=0xFFFFFFFF; - for (sal_uInt32 i=0; i<nGesAnz; i++) + + for (sal_uInt32 i=0; i<nAllGluePointCount; i++) { - bool bUser=i<nConAnz; - bool bVertex=i>=nConAnz+0 && i<nConAnz+4; - bool bCenter=i==nConAnz+4; + const bool bUser(i < nUserGluePointCount); + const bool bVertex(i >= nUserGluePointCount && i < nUserGluePointCount + nAutoGluePointCount); + const bool bCenter(i + 1 == nAllGluePointCount); bool bOk=false; Point aConPos; sal_uInt32 nConNum=i; if(bUser) { - const sdr::glue::Point* pCandidate = aGluePointVector[nConNum]; + const sdr::glue::GluePoint* pCandidate = aUserGluePointVector[nConNum]; if(pCandidate) { @@ -2402,9 +2461,9 @@ void SdrEdgeObj::FindConnector( } else if (bVertex && !bUserFnd) { - nConNum = nConNum - nConAnz; + nConNum = nConNum - nUserGluePointCount; - const sdr::glue::Point aLocalPt(pObj->GetVertexGluePoint(nConNum)); + const sdr::glue::GluePoint aLocalPt(rProvider.getAutoGluePointByIndex(nConNum)); const basegfx::B2DPoint aPoint(pObj->getSdrObjectTransformation() * aLocalPt.getUnitPosition()); aConPos = Point(basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY())); @@ -2749,17 +2808,20 @@ void SdrEdgeObj::setGluePointIndex(bool if( nIndex > 3 ) { - // TTTT:GLUE no more; check if this works - // nIndex -= 3; // SJ: the start api index is 0, whereas the implementation in svx starts from 1 - nIndex -= 4; // SJ: the start api index is 0, whereas the implementation in svx starts from 1 + nIndex -= 4; // The start api index and the implementation index is now both 0 // for user defined glue points we have // to get the id for this index first - const sdr::glue::List* pList = rConn1.GetObject() ? rConn1.GetObject()->GetGluePointList(false) : NULL; + const SdrObject* pCandidate = rConn1.GetObject(); - if(!pList || !pList->findByID(nIndex)) + if(pCandidate) { - return; + const sdr::glue::GluePointProvider& rProvider = pCandidate->GetGluePointProvider(); + + if(!rProvider.hasUserGluePoints() || !rProvider.findUserGluePointByID(nIndex)) + { + return; + } } } else if( nIndex < 0 ) Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svdpntv.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svdpntv.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdpntv.cxx (original) +++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdpntv.cxx Thu Oct 17 18:36:03 2013 @@ -45,7 +45,6 @@ #include <svx/svdmodel.hxx> #include <svx/svdundo.hxx> #include <svx/svdview.hxx> -#include <svx/sdrglue.hxx> #include <svx/svdobj.hxx> #include <svx/svdograf.hxx> #include <svx/svdattrx.hxx> @@ -55,7 +54,6 @@ #include <svx/sdr/overlay/overlayobjectlist.hxx> #include <svx/sdr/overlay/overlayrollingrectangle.hxx> #include <svx/sdr/overlay/overlaymanager.hxx> -#include <svx/sdrglue.hxx> #include <svx/svdobj.hxx> #include <svx/svdview.hxx> #include <svl/itemiter.hxx> @@ -75,6 +73,7 @@ #include <basegfx/numeric/ftools.hxx> #include <drawinglayer/primitive2d/metafileprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <svx/sdr/contact/viewobjectcontact.hxx> using namespace ::rtl; using namespace ::com::sun::star; @@ -947,50 +946,38 @@ bool SdrPaintView::KeyInput(const KeyEve void SdrPaintView::GlueInvalidate() const { - const sal_uInt32 nWindowCount(PaintWindowCount()); - - for(sal_uInt32 nWinNum(0); nWinNum < nWindowCount; nWinNum++) + if(mpPageView) { - SdrPaintWindow* pPaintWindow = GetPaintWindow(nWinNum); - - if(pPaintWindow->OutputToWindow()) + // start at current ObjectList (evtl. entered groups) + const SdrObjList* pOL = mpPageView->GetCurrentObjectList(); + const sal_uInt32 nObjAnz(pOL->GetObjCount()); + + for(sal_uInt32 nObjNum(0); nObjNum < nObjAnz; nObjNum++) { - OutputDevice& rOutDev = pPaintWindow->GetOutputDevice(); - const basegfx::B2DVector aLogicHalfSevenPix(rOutDev.GetInverseViewTransformation() * basegfx::B2DVector(3.5, 3.5)); + const SdrObject* pObj = pOL->GetObj(nObjNum); - if(mpPageView) + if(pObj) { - const SdrObjList* pOL = mpPageView->GetCurrentObjectList(); - const sal_uInt32 nObjAnz(pOL->GetObjCount()); - - for(sal_uInt32 nObjNum(0); nObjNum < nObjAnz; nObjNum++) - { - const SdrObject* pObj = pOL->GetObj(nObjNum); - const sdr::glue::List* pGPL = pObj ? pObj->GetGluePointList(false) : 0; + const sdr::glue::GluePointProvider& rProvider = pObj->GetGluePointProvider(); - if(pGPL) + if(rProvider.hasUserGluePoints()) + { + // SdrObject has GluePoints, thus invalidate VOC to force recreation. Do this in + // just the VOC belonging to this PageWindow's ObjectContacts, not in all views + for(sal_uInt32 b(0); b < mpPageView->PageWindowCount(); b++) { - const sdr::glue::PointVector aGluePointVecor(pGPL->getVector()); - - for(sal_uInt32 a(0); a < aGluePointVecor.size(); a++) - { - const sdr::glue::Point* pCandidate = aGluePointVecor[a]; + const SdrPageWindow& rPageWindow = *(mpPageView->GetPageWindow(b)); + sdr::contact::ObjectContact& rObjectContact = rPageWindow.GetObjectContact(); + sdr::contact::ViewObjectContact& rVOC = pObj->GetViewContact().GetViewObjectContact(rObjectContact); - if(pCandidate) - { - const basegfx::B2DPoint aPos(pObj->getSdrObjectTransformation() * pCandidate->getUnitPosition()); - const basegfx::B2DRange aRange(aPos - aLogicHalfSevenPix, aPos + aLogicHalfSevenPix); - - InvalidateOneWin((Window&)rOutDev, aRange); - } - else - { - OSL_ENSURE(false, "Got sdr::glue::PointVector with empty entries (!)"); - } - } + rVOC.ActionChanged(); } } } + else + { + OSL_ENSURE(false, "Got selection with empty slots (!)"); + } } } } Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svdview.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svdview.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdview.cxx (original) +++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdview.cxx Thu Oct 17 18:36:03 2013 @@ -2179,7 +2179,6 @@ void SdrView::SetMasterPagePaintCaching( } } -// TTTT:HANDLE void SdrView::MoveHandleByVector(const SdrHdl& rHdl, const basegfx::B2DVector& rDistance, Window* pMakeVisibleWindow, SdrDragMethod* pOwnDragMethod) { if(!rDistance.equalZero()) Modified: openoffice/branches/alg/aw080/main/svx/source/unodraw/gluepts.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/unodraw/gluepts.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/svx/source/unodraw/gluepts.cxx (original) +++ openoffice/branches/alg/aw080/main/svx/source/unodraw/gluepts.cxx Thu Oct 17 18:36:03 2013 @@ -28,7 +28,6 @@ #include <cppuhelper/implbase2.hxx> #include <svx/svdmodel.hxx> #include <svx/svdobj.hxx> -#include <svx/sdrglue.hxx> #include <svx/svdpage.hxx> using namespace ::com::sun::star; @@ -90,17 +89,17 @@ sal_Int32 SAL_CALL SvxUnoGluePointAccess { if( mpObject.is() ) { - sdr::glue::List* pList = mpObject->GetGluePointList(true); + sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider(); - if( pList ) + if(rProvider.allowsUserGluePoints()) { drawing::GluePoint2 aUnoGlue; if( aElement >>= aUnoGlue ) { const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale())); - const sdr::glue::Point aSdrGlue(aUnoGlue, aAbsoluteScale); - const sdr::glue::Point& rAdded = pList->add(aSdrGlue); + sdr::glue::GluePoint aSdrGlue(aUnoGlue, aAbsoluteScale); + const sdr::glue::GluePoint& rAdded = rProvider.addUserGluePoint(aSdrGlue); // only repaint, no objectchange mpObject->ActionChanged(); @@ -120,15 +119,15 @@ void SAL_CALL SvxUnoGluePointAccess::rem if( mpObject.is() && ( Identifier >= NON_USER_DEFINED_GLUE_POINTS )) { const sal_uInt32 nId(Identifier - NON_USER_DEFINED_GLUE_POINTS); - sdr::glue::List* pList = mpObject->GetGluePointList(false); + sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider(); - if(pList) + if(rProvider.hasUserGluePoints()) { - const sdr::glue::Point* pCandidate = pList->findByID(nId); + const sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nId); if(pCandidate) { - pList->remove(*pCandidate); + rProvider.removeUserGluePoint(*pCandidate); // only repaint, no objectchange mpObject->ActionChanged(); @@ -136,23 +135,6 @@ void SAL_CALL SvxUnoGluePointAccess::rem return; } } - - // TTTT:GLUE - //const sal_uInt32 nCount = pList ? pList->GetCount() : 0; - //sal_uInt32 i; - // - //for( i = 0; i < nCount; i++ ) - //{ - // if( (*pList)[i].GetId() == nId ) - // { - // pList->Delete( i ); - // - // // only repaint, no objectchange - // mpObject->ActionChanged(); - // - // return; - // } - //} } throw container::NoSuchElementException(); @@ -169,17 +151,17 @@ void SAL_CALL SvxUnoGluePointAccess::rep throw lang::IllegalArgumentException(); const sal_uInt32 nId(Identifier - NON_USER_DEFINED_GLUE_POINTS); - sdr::glue::List* pList = mpObject->GetGluePointList(false); + sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider(); - if(pList) + if(rProvider.hasUserGluePoints()) { - sdr::glue::Point* pCandidate = pList->findByID(nId); + sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nId); if(pCandidate) { // change the glue point (but start with a new GluePoint) const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale())); - const sdr::glue::Point aSdrGlue(aGluePoint, aAbsoluteScale); + const sdr::glue::GluePoint aSdrGlue(aGluePoint, aAbsoluteScale); *pCandidate = aSdrGlue; @@ -190,24 +172,6 @@ void SAL_CALL SvxUnoGluePointAccess::rep } } - // TTTT:GLUE - //const sal_uInt32 nCount = pList ? pList->GetCount() : 0; - //sal_uInt32 i; - //for( i = 0; i < nCount; i++ ) - //{ - // if( (*pList)[i].GetId() == nId ) - // { - // // change the glue point - // sdr::glue::Point& rTempPoint = (*pList)[i]; - // convert( aGluePoint, rTempPoint ); - // - // // only repaint, no objectchange - // mpObject->ActionChanged(); - // - // return; - // } - //} - throw container::NoSuchElementException(); } } @@ -217,9 +181,11 @@ uno::Any SAL_CALL SvxUnoGluePointAccess: { if(mpObject.is()) { + const sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider(); + if( Identifier < NON_USER_DEFINED_GLUE_POINTS ) // default glue point? { - const sdr::glue::Point aTempPoint(mpObject->GetVertexGluePoint(Identifier)); + const sdr::glue::GluePoint aTempPoint(rProvider.getAutoGluePointByIndex(Identifier)); const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale())); const drawing::GluePoint2 aGluePoint(aTempPoint.convertToGluePoint2(aAbsoluteScale)); @@ -228,11 +194,10 @@ uno::Any SAL_CALL SvxUnoGluePointAccess: else { const sal_uInt32 nId(Identifier - NON_USER_DEFINED_GLUE_POINTS); - const sdr::glue::List* pList = mpObject->GetGluePointList(false); - if(pList) + if(rProvider.hasUserGluePoints()) { - const sdr::glue::Point* pCandidate = pList->findByID(nId); + const sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(nId); if(pCandidate) { @@ -242,25 +207,6 @@ uno::Any SAL_CALL SvxUnoGluePointAccess: return uno::makeAny( aGluePoint ); } } - - // TTTT:GLUE - //const sal_uInt32 nCount = pList ? pList->GetCount() : 0; - // - //for( sal_uInt32 i = 0; i < nCount; i++ ) - //{ - // const sdr::glue::Point& rTempPoint = (*pList)[i]; - // if( rTempPoint.GetId() == nId ) - // { - // // #i38892# - // if(rTempPoint.IsUserDefined()) - // { - // aGluePoint.IsUserDefined = sal_True; - // } - // - // convert( rTempPoint, aGluePoint ); - // return uno::makeAny( aGluePoint ); - // } - //} } } @@ -271,8 +217,8 @@ uno::Sequence< sal_Int32 > SAL_CALL SvxU { if( mpObject.is() ) { - const sdr::glue::List* pList = mpObject->GetGluePointList(false); - const sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector()); + const sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider(); + const sdr::glue::GluePointVector aGluePointVector(rProvider.getUserGluePointVector()); uno::Sequence< sal_Int32 > aIdSequence(aGluePointVector.size() + NON_USER_DEFINED_GLUE_POINTS); sal_Int32 *pIdentifier = aIdSequence.getArray(); sal_uInt32 i(0); @@ -284,7 +230,7 @@ uno::Sequence< sal_Int32 > SAL_CALL SvxU for(i = 0; i < aGluePointVector.size(); i++) { - const sdr::glue::Point* pCandidate = aGluePointVector[i]; + const sdr::glue::GluePoint* pCandidate = aGluePointVector[i]; if(pCandidate) { @@ -296,19 +242,6 @@ uno::Sequence< sal_Int32 > SAL_CALL SvxU } } - // TTTT:GLUE - //const sal_uInt32 nCount = pList ? pList->GetCount() : 0; - //sal_uInt32 i; - // - //uno::Sequence< sal_Int32 > aIdSequence( nCount + NON_USER_DEFINED_GLUE_POINTS ); - //sal_Int32 *pIdentifier = aIdSequence.getArray(); - // - //for( i = 0; i < NON_USER_DEFINED_GLUE_POINTS; i++ ) - // *pIdentifier++ = i; - // - //for( i = 0; i < nCount; i++ ) - // *pIdentifier++ = ( (*pList)[i].GetId() + NON_USER_DEFINED_GLUE_POINTS ) - 1; - return aIdSequence; } else @@ -325,18 +258,18 @@ void SAL_CALL SvxUnoGluePointAccess::ins { if( mpObject.is() ) { - sdr::glue::List* pList = mpObject->GetGluePointList(true); + sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider(); - if( pList ) + if(rProvider.allowsUserGluePoints()) { drawing::GluePoint2 aUnoGlue; if( Element >>= aUnoGlue ) { const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale())); - const sdr::glue::Point aSdrGlue(aUnoGlue, aAbsoluteScale); + sdr::glue::GluePoint aSdrGlue(aUnoGlue, aAbsoluteScale); - pList->add(aSdrGlue); + rProvider.addUserGluePoint(aSdrGlue); // only repaint, no objectchange mpObject->ActionChanged(); @@ -355,39 +288,25 @@ void SAL_CALL SvxUnoGluePointAccess::rem { if( mpObject.is() ) { - sdr::glue::List* pList = mpObject->GetGluePointList(true); + sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider(); - if( pList ) + if(rProvider.hasUserGluePoints()) { Index -= 4; if(Index >= 0) { - const sdr::glue::Point* pCandidate = pList->findByID(Index); + const sdr::glue::GluePoint* pCandidate = rProvider.findUserGluePointByID(Index); if(pCandidate) { - pList->remove(*pCandidate); + rProvider.removeUserGluePoint(*pCandidate); // only repaint, no objectchange mpObject->ActionChanged(); return; } - - // TTTT:GLUE - //{ - // const sdr::glue::Point* pCandidate = pList->findByID(sal_uInt32 nID) const; - // - // - // - // pList->Delete( (sal_uInt32)Index ); - // - // // only repaint, no objectchange - // mpObject->ActionChanged(); - // - // return; - //} } } } @@ -407,17 +326,17 @@ void SAL_CALL SvxUnoGluePointAccess::rep if( mpObject.is() && Index >= 0 ) { - const sdr::glue::List* pList = mpObject->GetGluePointList(false); - const sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector()); + const sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider(); + const sdr::glue::GluePointVector aGluePointVector(rProvider.getUserGluePointVector()); if(Index < (sal_Int32)aGluePointVector.size()) { - sdr::glue::Point* pCandidate = aGluePointVector[Index]; + sdr::glue::GluePoint* pCandidate = aGluePointVector[Index]; if(pCandidate) { const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale())); - const sdr::glue::Point aSdrGlue(aUnoGlue, aAbsoluteScale); + const sdr::glue::GluePoint aSdrGlue(aUnoGlue, aAbsoluteScale); *pCandidate = aSdrGlue; @@ -428,13 +347,6 @@ void SAL_CALL SvxUnoGluePointAccess::rep { OSL_ENSURE(false, "Got a sdr::glue::PointVector with empty entries (!)"); } - - // TTTT:GLUE - //rGlue = (*pList)[(sal_uInt32)Index]; - //convert( aUnoGlue, rGlue ); - // - //// only repaint, no objectchange - //mpObject->ActionChanged(); } } @@ -452,8 +364,8 @@ sal_Int32 SAL_CALL SvxUnoGluePointAccess // and any number of user defined glue points nCount += 4; - const sdr::glue::List* pList = mpObject->GetGluePointList(false); - const sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector()); + const sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider(); + const sdr::glue::GluePointVector aGluePointVector(rProvider.getUserGluePointVector()); nCount += aGluePointVector.size(); } @@ -465,9 +377,11 @@ uno::Any SAL_CALL SvxUnoGluePointAccess: { if(Index >= 0 && mpObject.is()) { - if( Index < 4 ) // default glue point? + const sdr::glue::GluePointProvider& rProvider = mpObject->GetGluePointProvider(); + + if(Index < 4) // default glue point? { - const sdr::glue::Point aTempPoint(mpObject->GetVertexGluePoint(Index)); + const sdr::glue::GluePoint aTempPoint(rProvider.getAutoGluePointByIndex(Index)); const basegfx::B2DVector aAbsoluteScale(basegfx::absolute(mpObject->getSdrObjectScale())); const drawing::GluePoint2 aGluePoint(aTempPoint.convertToGluePoint2(aAbsoluteScale)); uno::Any aAny; @@ -478,12 +392,11 @@ uno::Any SAL_CALL SvxUnoGluePointAccess: else { Index -= 4; - const sdr::glue::List* pList = mpObject->GetGluePointList(false); - const sdr::glue::PointVector aGluePointVector(pList ? pList->getVector() : sdr::glue::PointVector()); + const sdr::glue::GluePointVector aGluePointVector(rProvider.getUserGluePointVector()); - if(pList && Index < (sal_Int32)aGluePointVector.size()) + if(Index < (sal_Int32)aGluePointVector.size()) { - const sdr::glue::Point* pCandidate = aGluePointVector[Index]; + const sdr::glue::GluePoint* pCandidate = aGluePointVector[Index]; if(pCandidate) { @@ -498,14 +411,6 @@ uno::Any SAL_CALL SvxUnoGluePointAccess: { 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; } } } Modified: openoffice/branches/alg/aw080/main/sw/source/ui/docvw/edtwin.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/ui/docvw/edtwin.cxx?rev=1533203&r1=1533202&r2=1533203&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/ui/docvw/edtwin.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/ui/docvw/edtwin.cxx Thu Oct 17 18:36:03 2013 @@ -1262,37 +1262,7 @@ void SwEditWin::ChangeDrawing( sal_uInt8 { // move handle with index nHandleIndex pSdrView->MoveHandleByVector(*pHdl, basegfx::B2DVector(nX, nY), 0, 0); - - // TTTT:HANDLE - //// now move the Handle (nX, nY) - //const basegfx::B2DPoint aStartPoint(pHdl->getPosition()); - //const basegfx::B2DPoint aEndPoint(aStartPoint + basegfx::B2DPoint(nX, nY)); - //const SdrDragStat& rDragStat = pSdrView->GetDragStat(); - // - //// start dragging - //pSdrView->BegDragObj(aStartPoint, pHdl, 0.0); - // - //if(pSdrView->IsDragObj()) - //{ - // const bool bWasNoSnap(rDragStat.IsNoSnap()); - // const bool bWasSnapEnabled(pSdrView->IsSnapEnabled()); - // - // // switch snapping off - // if(!bWasNoSnap) - // ((SdrDragStat&)rDragStat).SetNoSnap(true); - // if(bWasSnapEnabled) - // pSdrView->SetSnapEnabled(false); - // - // pSdrView->MovAction(aEndPoint); - // pSdrView->EndDragObj(); - rSh.SetModified(); - - // // restore snap - // if(!bWasNoSnap) - // ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap); - // if(bWasSnapEnabled) - // pSdrView->SetSnapEnabled(bWasSnapEnabled); - //} + rSh.SetModified(); } } }
