diff options
author | Armin Le Grand <alg@apache.org> | 2012-08-06 08:32:18 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-18 20:05:01 +0100 |
commit | eb8971e5fe52bcb80eff56846182ac30c261e111 (patch) | |
tree | 170f5efa7d5cc1525fa108f9cfdb61ef6c327346 | |
parent | 7d2c9ac5c12232c15d21ee83387c31847553de80 (diff) |
Resolves: #i120437# Connector corrections in groups and PPT imports
(cherry picked from commit b26e298d31cad25c326041287acb6544efac21c6)
Conflicts:
svx/source/svdraw/svdoedge.cxx
Change-Id: Id4bed1c85bccdae878872557fd3e625d772228ff
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 10 | ||||
-rw-r--r-- | svx/source/svdraw/svdmodel.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdoedge.cxx | 123 | ||||
-rw-r--r-- | svx/source/svdraw/svdpage.cxx | 19 |
4 files changed, 104 insertions, 52 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 549643b07d14..922dec334bba 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -4508,6 +4508,9 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r RotatePoint(aPoint1, aCenter, ss, cc); RotatePoint(aPoint2, aCenter, ss, cc); + + // #i120437# reset rotation, it is part of the path and shall not be applied again + nObjectRotation = 0; } // rotate/mirror line within the area as we need it @@ -4516,14 +4519,19 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r sal_Int32 n = aPoint1.X(); aPoint1.X() = aPoint2.X(); aPoint2.X() = n; + + // #i120437# reset hor filp + nSpFlags &= ~SP_FFLIPH; } if ( nSpFlags & SP_FFLIPV ) { sal_Int32 n = aPoint1.Y(); aPoint1.Y() = aPoint2.Y(); aPoint2.Y() = n; + + // #i120437# reset ver filp + nSpFlags &= ~SP_FFLIPV; } - nSpFlags &= ~( SP_FFLIPV | SP_FFLIPH ); pRet->NbcSetPoint(aPoint1, 0L); // start point pRet->NbcSetPoint(aPoint2, 1L); // endpoint diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 312c9c605fe7..a184de70556b 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -1843,11 +1843,13 @@ void SdrModel::setLock( bool bLock ) { if( mbModelLocked != bLock ) { + // #i120437# need to set first, else ImpReformatAllEdgeObjects will do nothing + mbModelLocked = bLock; + if( sal_False == bLock ) { ImpReformatAllEdgeObjects(); } - mbModelLocked = bLock; } } diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index c4a176314367..d30350b89bdc 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -462,6 +462,10 @@ void SdrEdgeObj::ConnectToNode(bool bTail1, SdrObject* pObj) if (pObj!=NULL) { pObj->AddListener(*this); rCon.pObj=pObj; + + // #i120437# If connection is set, reset bEdgeTrackUserDefined + bEdgeTrackUserDefined = false; + ImpDirtyEdgeTrack(); } } @@ -539,8 +543,11 @@ void SdrEdgeObj::ImpUndirtyEdgeTrack() void SdrEdgeObj::ImpRecalcEdgeTrack() { - if ( bEdgeTrackUserDefined && (GetModel() && GetModel()->isLocked()) ) + // #i120437# if bEdgeTrackUserDefined, do not recalculate. Also not when model locked + if(bEdgeTrackUserDefined || !GetModel() || GetModel()->isLocked()) + { return; + } if(IsBoundRectCalculationRunning()) { @@ -554,17 +561,17 @@ void SdrEdgeObj::ImpRecalcEdgeTrack() { // avoid re-layout during imports/API call sequences // #i45294# but calculate EdgeTrack and secure properties there - ((SdrEdgeObj*)this)->mbBoundRectCalculationRunning = sal_True; + mbBoundRectCalculationRunning = sal_True; *pEdgeTrack=ImpCalcEdgeTrack(*pEdgeTrack,aCon1,aCon2,&aEdgeInfo); ImpSetAttrToEdgeInfo(); bEdgeTrackDirty=sal_False; - ((SdrEdgeObj*)this)->mbBoundRectCalculationRunning = sal_False; + mbBoundRectCalculationRunning = sal_False; } else { // To not run in a depth loop, use a coloring algorithm on // SdrEdgeObj BoundRect calculations - ((SdrEdgeObj*)this)->mbBoundRectCalculationRunning = sal_True; + mbBoundRectCalculationRunning = sal_True; Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetCurrentBoundRect(); SetRectsDirty(); @@ -577,7 +584,7 @@ void SdrEdgeObj::ImpRecalcEdgeTrack() SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); - ((SdrEdgeObj*)this)->mbBoundRectCalculationRunning = sal_False; + mbBoundRectCalculationRunning = sal_False; } } @@ -2256,65 +2263,95 @@ void SdrEdgeObj::NbcResize(const Point& rRefPnt, const Fraction& aXFact, const F } // #i54102# added rotation support -void SdrEdgeObj::NbcRotate(const Point& rRef, long /*nWink*/, double sn, double cs) +void SdrEdgeObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs) { - // handle start and end point if not connected - bool bCon1=aCon1.pObj!=NULL && aCon1.pObj->GetPage()==pPage; - bool bCon2=aCon2.pObj!=NULL && aCon2.pObj->GetPage()==pPage; - - if(!bCon1 && pEdgeTrack) + if(bEdgeTrackUserDefined) { - RotatePoint((*pEdgeTrack)[0],rRef,sn,cs); - ImpDirtyEdgeTrack(); + // #i120437# special handling when track is imported, apply + // transformation directly to imported track. + SdrTextObj::NbcRotate(rRef, nWink, sn, cs); + RotateXPoly(*pEdgeTrack, rRef, sn, cs); } - - if(!bCon2 && pEdgeTrack) + else { - sal_uInt16 nPntAnz = pEdgeTrack->GetPointCount(); - RotatePoint((*pEdgeTrack)[sal_uInt16(nPntAnz-1)],rRef,sn,cs); - ImpDirtyEdgeTrack(); + // handle start and end point if not connected + bool bCon1=aCon1.pObj!=NULL && aCon1.pObj->GetPage()==pPage; + bool bCon2=aCon2.pObj!=NULL && aCon2.pObj->GetPage()==pPage; + + if(!bCon1 && pEdgeTrack) + { + RotatePoint((*pEdgeTrack)[0],rRef,sn,cs); + ImpDirtyEdgeTrack(); + } + + if(!bCon2 && pEdgeTrack) + { + sal_uInt16 nPntAnz = pEdgeTrack->GetPointCount(); + RotatePoint((*pEdgeTrack)[sal_uInt16(nPntAnz-1)],rRef,sn,cs); + ImpDirtyEdgeTrack(); + } } } // #i54102# added mirror support void SdrEdgeObj::NbcMirror(const Point& rRef1, const Point& rRef2) { - // handle start and end point if not connected - bool bCon1=aCon1.pObj!=NULL && aCon1.pObj->GetPage()==pPage; - bool bCon2=aCon2.pObj!=NULL && aCon2.pObj->GetPage()==pPage; - - if(!bCon1 && pEdgeTrack) + if(bEdgeTrackUserDefined) { - MirrorPoint((*pEdgeTrack)[0],rRef1,rRef2); - ImpDirtyEdgeTrack(); + // #i120437# special handling when track is imported, apply + // transformation directly to imported track. + SdrTextObj::NbcMirror(rRef1, rRef2); + MirrorXPoly(*pEdgeTrack, rRef1, rRef2); } - - if(!bCon2 && pEdgeTrack) + else { - sal_uInt16 nPntAnz = pEdgeTrack->GetPointCount(); - MirrorPoint((*pEdgeTrack)[sal_uInt16(nPntAnz-1)],rRef1,rRef2); - ImpDirtyEdgeTrack(); + // handle start and end point if not connected + bool bCon1=aCon1.pObj!=NULL && aCon1.pObj->GetPage()==pPage; + bool bCon2=aCon2.pObj!=NULL && aCon2.pObj->GetPage()==pPage; + + if(!bCon1 && pEdgeTrack) + { + MirrorPoint((*pEdgeTrack)[0],rRef1,rRef2); + ImpDirtyEdgeTrack(); + } + + if(!bCon2 && pEdgeTrack) + { + sal_uInt16 nPntAnz = pEdgeTrack->GetPointCount(); + MirrorPoint((*pEdgeTrack)[sal_uInt16(nPntAnz-1)],rRef1,rRef2); + ImpDirtyEdgeTrack(); + } } } // #i54102# added shear support -void SdrEdgeObj::NbcShear(const Point& rRef, long /*nWink*/, double tn, bool bVShear) +void SdrEdgeObj::NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) { - // handle start and end point if not connected - bool bCon1=aCon1.pObj!=NULL && aCon1.pObj->GetPage()==pPage; - bool bCon2=aCon2.pObj!=NULL && aCon2.pObj->GetPage()==pPage; - - if(!bCon1 && pEdgeTrack) + if(bEdgeTrackUserDefined) { - ShearPoint((*pEdgeTrack)[0],rRef,tn,bVShear); - ImpDirtyEdgeTrack(); + // #i120437# special handling when track is imported, apply + // transformation directly to imported track. + SdrTextObj::NbcShear(rRef, nWink, tn, bVShear); + ShearXPoly(*pEdgeTrack, rRef, tn, bVShear); } - - if(!bCon2 && pEdgeTrack) + else { - sal_uInt16 nPntAnz = pEdgeTrack->GetPointCount(); - ShearPoint((*pEdgeTrack)[sal_uInt16(nPntAnz-1)],rRef,tn,bVShear); - ImpDirtyEdgeTrack(); + // handle start and end point if not connected + bool bCon1=aCon1.pObj!=NULL && aCon1.pObj->GetPage()==pPage; + bool bCon2=aCon2.pObj!=NULL && aCon2.pObj->GetPage()==pPage; + + if(!bCon1 && pEdgeTrack) + { + ShearPoint((*pEdgeTrack)[0],rRef,tn,bVShear); + ImpDirtyEdgeTrack(); + } + + if(!bCon2 && pEdgeTrack) + { + sal_uInt16 nPntAnz = pEdgeTrack->GetPointCount(); + ShearPoint((*pEdgeTrack)[sal_uInt16(nPntAnz-1)],rRef,tn,bVShear); + ImpDirtyEdgeTrack(); + } } } diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 715653f0c55c..58943d2e30b7 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -679,14 +679,17 @@ void SdrObjList::ReformatAllTextObjects() */ void SdrObjList::ReformatAllEdgeObjects() { - const sal_uInt32 nCount=GetObjCount(); - sal_uInt32 nObj; + // #i120437# go over whole hierarchy, not only over object level null (seen from grouping) + SdrObjListIter aIter(*this, IM_DEEPNOGROUPS); - for( nObj = 0; nObj < nCount; nObj++ ) + while(aIter.IsMore()) { - SdrObject* pObj = GetObj(nObj); - if( pObj->ISA(SdrEdgeObj) ) - static_cast<SdrEdgeObj*>(pObj)->Reformat(); + SdrEdgeObj* pSdrEdgeObj = dynamic_cast< SdrEdgeObj* >(aIter.Next()); + + if(pSdrEdgeObj) + { + pSdrEdgeObj->Reformat(); + } } } @@ -1765,7 +1768,9 @@ void SdrPage::SetInserted( bool bIns ) { mbInserted = bIns; - SdrObjListIter aIter( *this, IM_FLAT ); + // #i120437# go over whole hierarchy, not only over object level null (seen from grouping) + SdrObjListIter aIter(*this, IM_DEEPNOGROUPS); + while ( aIter.IsMore() ) { SdrObject* pObj = aIter.Next(); |