diff options
Diffstat (limited to 'svx/source/sdr')
13 files changed, 111 insertions, 32 deletions
diff --git a/svx/source/sdr/contact/viewcontactofe3dscene.cxx b/svx/source/sdr/contact/viewcontactofe3dscene.cxx index 7f262e3efd61..4e3c60410774 100644 --- a/svx/source/sdr/contact/viewcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dscene.cxx @@ -252,12 +252,15 @@ namespace sdr void ViewContactOfE3dScene::createObjectTransformation() { // create 2d Object Transformation from relative point in 2d scene to world - const Rectangle& rRectangle = GetE3dScene().GetSnapRect(); - - maObjectTransformation.set(0, 0, rRectangle.getWidth()); - maObjectTransformation.set(1, 1, rRectangle.getHeight()); - maObjectTransformation.set(0, 2, rRectangle.Left()); - maObjectTransformation.set(1, 2, rRectangle.Top()); + Rectangle aRectangle = GetE3dScene().GetSnapRect(); + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + aRectangle += GetE3dScene().GetGridOffset(); + maObjectTransformation.set(0, 0, aRectangle.getWidth()); + maObjectTransformation.set(1, 1, aRectangle.getHeight()); + maObjectTransformation.set(0, 2, aRectangle.Left()); + maObjectTransformation.set(1, 2, aRectangle.Top()); } void ViewContactOfE3dScene::createSdrSceneAttribute() diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index 144f9919810a..6897df78b92a 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -340,10 +340,13 @@ namespace sdr aAttribute.getText()); } } - // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect() // which will use the primitive data we just create in the near future - const Rectangle& rRectangle = GetGrafObject().GetGeoRect(); + Rectangle rRectangle = GetGrafObject().GetGeoRect(); + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + rRectangle += GetGrafObject().GetGridOffset(); const ::basegfx::B2DRange aObjectRange( rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); diff --git a/svx/source/sdr/contact/viewcontactofgroup.cxx b/svx/source/sdr/contact/viewcontactofgroup.cxx index 1c8cead901bd..ce1e92373064 100644 --- a/svx/source/sdr/contact/viewcontactofgroup.cxx +++ b/svx/source/sdr/contact/viewcontactofgroup.cxx @@ -72,7 +72,11 @@ namespace sdr else { // append an invisible outline for the cases where no visible content exists - const Rectangle aCurrentBoundRect(GetSdrObjGroup().GetLastBoundRect()); + Rectangle aCurrentBoundRect(GetSdrObjGroup().GetLastBoundRect()); + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + aCurrentBoundRect += GetSdrObjGroup().GetGridOffset(); const basegfx::B2DRange aCurrentRange( aCurrentBoundRect.Left(), aCurrentBoundRect.Top(), aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom()); diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx index 8c12c10e37d7..a9903849059d 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx @@ -61,7 +61,13 @@ namespace sdr rCaptionObj.getText(0))); // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = rCaptionObj.GetGeoRect(); + Rectangle rRectangle = rCaptionObj.GetGeoRect(); + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + Point aGridOff = rCaptionObj.GetGridOffset(); + rRectangle += aGridOff; + const ::basegfx::B2DRange aObjectRange( rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); @@ -79,14 +85,18 @@ namespace sdr double fCornerRadiusY; drawinglayer::primitive2d::calculateRelativeCornerRadius( rCaptionObj.GetEckenradius(), aObjectRange, fCornerRadiusX, fCornerRadiusY); - + ::basegfx::B2DPolygon aTail = rCaptionObj.getTailPolygon(); + // Hack for calc, transform position of tail according + // to current zoom so as objects relative position to grid + // appears stable + aTail.transform( basegfx::tools::createTranslateB2DHomMatrix( aGridOff.X(), aGridOff.Y() ) ); // create primitive. Always create one (even if invisible) to let the decomposition // of SdrCaptionPrimitive2D create needed invisible elements for HitTest and BoundRect const drawinglayer::primitive2d::Primitive2DReference xReference( new drawinglayer::primitive2d::SdrCaptionPrimitive2D( aObjectMatrix, aAttribute, - rCaptionObj.getTailPolygon(), + aTail, fCornerRadiusX, fCornerRadiusY)); diff --git a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx index 709287eefc01..2b1f58c75d34 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx @@ -50,10 +50,14 @@ namespace sdr GetCircObj().getText(0))); // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetCircObj().GetGeoRect(); + Rectangle aRectangle = GetCircObj().GetGeoRect(); + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + aRectangle += GetRectObj().GetGridOffset(); const basegfx::B2DRange aObjectRange( - rRectangle.Left(), rRectangle.Top(), - rRectangle.Right(), rRectangle.Bottom()); + aRectangle.Left(), aRectangle.Top(), + aRectangle.Right(), aRectangle.Bottom() ); const GeoStat& rGeoStat(GetCircObj().GetGeoStat()); // fill object matrix diff --git a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx index 708cb9446dcd..8385fb05a07d 100644 --- a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx @@ -22,6 +22,7 @@ #include <svx/svdoedge.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> #include <svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -40,10 +41,15 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrEdgeObj::createViewIndependentPrimitive2DSequence() const { - const basegfx::B2DPolygon& rEdgeTrack = GetEdgeObj().getEdgeTrack(); + basegfx::B2DPolygon aEdgeTrack = GetEdgeObj().getEdgeTrack(); + Point aGridOff = GetEdgeObj().GetGridOffset(); + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + aEdgeTrack.transform( basegfx::tools::createTranslateB2DHomMatrix( aGridOff.X(), aGridOff.Y() ) ); // what to do when no EdgeTrack is provided (HitTest and selectability) ? - OSL_ENSURE(0 != rEdgeTrack.count(), "Connectors with no geometry are not allowed (!)"); + OSL_ENSURE(0 != aEdgeTrack.count(), "Connectors with no geometry are not allowed (!)"); // ckeck attributes const SfxItemSet& rItemSet = GetEdgeObj().GetMergedItemSet(); @@ -58,7 +64,7 @@ namespace sdr const drawinglayer::primitive2d::Primitive2DReference xReference( new drawinglayer::primitive2d::SdrConnectorPrimitive2D( aAttribute, - rEdgeTrack)); + aEdgeTrack)); return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx index 62dec8517881..4d1dcfdb2fe2 100644 --- a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx @@ -122,10 +122,14 @@ namespace sdr { // create range using the model data directly. This is in SdrTextObj::aRect which i will access using // GetGeoRect() to not trigger any calculations. It's the unrotated geometry which is okay for MediaObjects ATM. - const Rectangle& rRectangle(GetSdrMediaObj().GetGeoRect()); + Rectangle aRectangle(GetSdrMediaObj().GetGeoRect()); + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + aRectangle += GetSdrMediaObj().GetGridOffset(); const basegfx::B2DRange aRange( - rRectangle.Left(), rRectangle.Top(), - rRectangle.Right(), rRectangle.Bottom()); + aRectangle.Left(), aRectangle.Top(), + aRectangle.Right(), aRectangle.Bottom()); // create object transform basegfx::B2DHomMatrix aTransform; diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 7fe688bf3350..654ed86cbaca 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -117,14 +117,21 @@ namespace sdr const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape(); bool b3DShape(false); + Point aGridOff = GetCustomShapeObj().GetGridOffset(); + if(pSdrObjRepresentation) { + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + const_cast< SdrObject* >( pSdrObjRepresentation )->SetGridOffset( aGridOff ); SdrObjListIter aIterator(*pSdrObjRepresentation); while(aIterator.IsMore()) { SdrObject& rCandidate = *aIterator.Next(); - + // apply offset to each part + rCandidate.SetGridOffset( aGridOff ); if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate)) { b3DShape = true; @@ -145,7 +152,9 @@ namespace sdr { // take unrotated snap rect as default, then get the // unrotated text box. Rotation needs to be done centered - const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); + Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); + // hack for calc grid sync + aObjectBound += GetCustomShapeObj().GetGridOffset(); const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom()); // #i101684# get the text range unrotated and absolute to the object range diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index 4dd6e207a07e..358eda0b6dae 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -62,7 +62,11 @@ namespace sdr basegfx::B2DHomMatrix ViewContactOfSdrOle2Obj::createObjectTransform() const { // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetOle2Obj().GetGeoRect(); + Rectangle rRectangle = GetOle2Obj().GetGeoRect(); + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + rRectangle += GetOle2Obj().GetGridOffset(); const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); // create object matrix diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx index f07d3ce6dad7..a6c130b08337 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx @@ -48,6 +48,11 @@ namespace sdr rItemSet, GetPathObj().getText(0))); basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); + Point aGridOff = GetPathObj().GetGridOffset(); + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + aUnitPolyPolygon.transform( basegfx::tools::createTranslateB2DHomMatrix( aGridOff.X(), aGridOff.Y() ) ); sal_uInt32 nPolyCount(aUnitPolyPolygon.count()); sal_uInt32 nPointCount(0); diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index 739b64a167ba..166c3d52e95b 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -51,10 +51,15 @@ namespace sdr GetRectObj().getText(0))); // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetRectObj().GetGeoRect(); + Rectangle rRectangle = GetRectObj().GetGeoRect(); + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + rRectangle += GetRectObj().GetGridOffset(); const ::basegfx::B2DRange aObjectRange( rRectangle.Left(), rRectangle.Top(), - rRectangle.Right(), rRectangle.Bottom()); + rRectangle.Right(), rRectangle.Bottom() ); + const GeoStat& rGeoStat(GetRectObj().GetGeoStat()); // fill object matrix diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx index 6d6d41589460..94cb79058e84 100644 --- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx @@ -126,10 +126,15 @@ namespace sdr { namespace contact { // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj) // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything - const Rectangle& rRectangle(GetSdrUnoObj().GetGeoRect()); + Rectangle aRectangle(GetSdrUnoObj().GetGeoRect()); + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + Point aGridOffset = GetSdrUnoObj().GetGridOffset(); + aRectangle += aGridOffset; const basegfx::B2DRange aRange( - rRectangle.Left(), rRectangle.Top(), - rRectangle.Right(), rRectangle.Bottom()); + aRectangle.Left(), aRectangle.Top(), + aRectangle.Right(), aRectangle.Bottom()); // create object transform basegfx::B2DHomMatrix aTransform; diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 96d71423dc26..138453108055 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -1029,7 +1029,13 @@ namespace sdr { namespace contact { SdrUnoObj* pUnoObject( NULL ); if ( getUnoObject( pUnoObject ) ) { - UnoControlContactHelper::adjustControlGeometry_throw( m_aControl, pUnoObject->GetLogicRect(), _rViewTransformation, m_aZoomLevelNormalization ); + Point aGridOffset = pUnoObject->GetGridOffset(); + Rectangle aRect( pUnoObject->GetLogicRect() ); + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + aRect += aGridOffset; + UnoControlContactHelper::adjustControlGeometry_throw( m_aControl, aRect, _rViewTransformation, m_aZoomLevelNormalization ); } else OSL_FAIL( "ViewObjectContactOfUnoControl_Impl::positionAndZoomControl: no SdrUnoObj!" ); @@ -1207,11 +1213,17 @@ namespace sdr { namespace contact { // knit the model and the control _out_rControl.setModel( xControlModel ); + Point aGridOffset = _rUnoObject.GetGridOffset(); + Rectangle aRect( _rUnoObject.GetLogicRect() ); + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + aRect += aGridOffset; // proper geometry UnoControlContactHelper::adjustControlGeometry_throw( _out_rControl, - _rUnoObject.GetLogicRect(), + aRect, _rInitialViewTransformation, _rInitialZoomNormalization ); @@ -1606,7 +1618,12 @@ namespace sdr { namespace contact { // Do use model data directly to create the correct geometry. Do NOT // use getBoundRect()/getSnapRect() here; tese will use the sequence of // primitives themselves in the long run. - const Rectangle aSdrGeoData( _rVOC.GetSdrUnoObj().GetGeoRect() ); + Rectangle aSdrGeoData( _rVOC.GetSdrUnoObj().GetGeoRect() ); + Point aGridOffset = _rVOC.GetSdrUnoObj().GetGridOffset(); + // Hack for calc, transform position of object according + // to current zoom so as objects relative position to grid + // appears stable + aSdrGeoData += aGridOffset; const basegfx::B2DRange aRange( aSdrGeoData.Left(), aSdrGeoData.Top(), |