You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ms...@apache.org on 2023/04/04 21:11:11 UTC
[openoffice] branch trunk updated: Fixed typos, cleaned up whitespace
This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push:
new 6d2f4e8a68 Fixed typos, cleaned up whitespace
6d2f4e8a68 is described below
commit 6d2f4e8a6897d05e7b43a31caf417b10be856469
Author: mseidel <ms...@apache.org>
AuthorDate: Tue Apr 4 22:43:55 2023 +0200
Fixed typos, cleaned up whitespace
---
main/svx/source/svdraw/svddrgmt.cxx | 2666 +++++++++++++++++------------------
1 file changed, 1332 insertions(+), 1334 deletions(-)
diff --git a/main/svx/source/svdraw/svddrgmt.cxx b/main/svx/source/svdraw/svddrgmt.cxx
index c12776edf1..ef1ff379e2 100644
--- a/main/svx/source/svdraw/svddrgmt.cxx
+++ b/main/svx/source/svdraw/svddrgmt.cxx
@@ -40,8 +40,8 @@
#include <svx/svdmark.hxx>
#include <svx/svdocapt.hxx>
#include <svx/svdpagv.hxx>
-#include "svx/svdstr.hrc" // Namen aus der Resource
-#include "svx/svdglob.hxx" // StringCache
+#include "svx/svdstr.hrc" // Namen aus der Resource
+#include "svx/svdglob.hxx" // StringCache
#include <svx/svddrgv.hxx>
#include <svx/svdundo.hxx>
#include <svx/svdograf.hxx>
@@ -96,8 +96,8 @@ SdrDragEntry::~SdrDragEntry()
////////////////////////////////////////////////////////////////////////////////////////////////////
SdrDragEntryPolyPolygon::SdrDragEntryPolyPolygon(const basegfx::B2DPolyPolygon& rOriginalPolyPolygon)
-: SdrDragEntry(),
- maOriginalPolyPolygon(rOriginalPolyPolygon)
+: SdrDragEntry(),
+ maOriginalPolyPolygon(rOriginalPolyPolygon)
{
}
@@ -111,7 +111,7 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPolyPolygon::createPr
if(maOriginalPolyPolygon.count())
{
- basegfx::B2DPolyPolygon aCopy(maOriginalPolyPolygon);
+ basegfx::B2DPolyPolygon aCopy(maOriginalPolyPolygon);
const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
rDragMethod.applyCurrentTransformationToPolyPolygon(aCopy);
@@ -125,22 +125,22 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPolyPolygon::createPr
aColB.invert();
}
- aRetval.realloc(2);
- aRetval[0] = new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(
- aCopy,
- aColA,
- aColB,
- fStripeLength);
+ aRetval.realloc(2);
+ aRetval[0] = new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(
+ aCopy,
+ aColA,
+ aColB,
+ fStripeLength);
- const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor());
- const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
+ const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor());
+ const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
- aRetval[1] = new drawinglayer::primitive2d::PolyPolygonSelectionPrimitive2D(
- aCopy,
- aHilightColor,
- fTransparence,
- 3.0,
- false);
+ aRetval[1] = new drawinglayer::primitive2d::PolyPolygonSelectionPrimitive2D(
+ aCopy,
+ aHilightColor,
+ fTransparence,
+ 3.0,
+ false);
}
return aRetval;
@@ -149,10 +149,10 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPolyPolygon::createPr
////////////////////////////////////////////////////////////////////////////////////////////////////
SdrDragEntrySdrObject::SdrDragEntrySdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify)
-: SdrDragEntry(),
- maOriginal(rOriginal),
- mpClone(0),
- mrObjectContact(rObjectContact),
+: SdrDragEntry(),
+ maOriginal(rOriginal),
+ mpClone(0),
+ mrObjectContact(rObjectContact),
mbModify(bModify)
{
// add SdrObject parts to transparent overlay stuff
@@ -161,29 +161,29 @@ SdrDragEntrySdrObject::SdrDragEntrySdrObject(const SdrObject& rOriginal, sdr::co
SdrDragEntrySdrObject::~SdrDragEntrySdrObject()
{
- if(mpClone)
- {
- SdrObject::Free(mpClone);
- }
+ if(mpClone)
+ {
+ SdrObject::Free(mpClone);
+ }
}
void SdrDragEntrySdrObject::prepareCurrentState(SdrDragMethod& rDragMethod)
{
- // for the moment, i need to re-create the clone in all cases. I need to figure
+ // for the moment, I need to re-create the clone in all cases. I need to figure
// out when clone and original have the same class, so that i can use operator=
// in those cases
- // // copy all other needed stuff
- // basegfx::B2DHomMatrix aMatrix;
- // basegfx::B2DPolyPolygon aPolyPolygon;
- // pOleObject->TRGetBaseGeometry(aMatrix, aPolyPolygon);
- // pClone->TRSetBaseGeometry(aMatrix, aPolyPolygon);
+ // // copy all other needed stuff
+ // basegfx::B2DHomMatrix aMatrix;
+ // basegfx::B2DPolyPolygon aPolyPolygon;
+ // pOleObject->TRGetBaseGeometry(aMatrix, aPolyPolygon);
+ // pClone->TRSetBaseGeometry(aMatrix, aPolyPolygon);
if(mpClone)
- {
- SdrObject::Free(mpClone);
+ {
+ SdrObject::Free(mpClone);
mpClone = 0;
- }
+ }
if(mbModify)
{
@@ -191,7 +191,7 @@ void SdrDragEntrySdrObject::prepareCurrentState(SdrDragMethod& rDragMethod)
{
mpClone = maOriginal.getFullDragClone();
}
-
+
// apply original transformation, implemented at the DragMethods
rDragMethod.applyCurrentTransformationToSdrObject(*mpClone);
}
@@ -207,25 +207,25 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragEntrySdrObject::createPrim
pSource = mpClone;
}
- // get VOC and Primitive2DSequence
- sdr::contact::ViewContact& rVC = pSource->GetViewContact();
- sdr::contact::ViewObjectContact& rVOC = rVC.GetViewObjectContact(mrObjectContact);
- sdr::contact::DisplayInfo aDisplayInfo;
+ // get VOC and Primitive2DSequence
+ sdr::contact::ViewContact& rVC = pSource->GetViewContact();
+ sdr::contact::ViewObjectContact& rVOC = rVC.GetViewObjectContact(mrObjectContact);
+ sdr::contact::DisplayInfo aDisplayInfo;
- // Do not use the last ViewPort set at the OC from the last ProcessDisplay(),
- // here we want the complete primitive sequence without visibility clippings
- mrObjectContact.resetViewPort();
+ // Do not use the last ViewPort set at the OC from the last ProcessDisplay(),
+ // here we want the complete primitive sequence without visibility clippings
+ mrObjectContact.resetViewPort();
- return rVOC.getPrimitive2DSequenceHierarchy(aDisplayInfo);
+ return rVOC.getPrimitive2DSequenceHierarchy(aDisplayInfo);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
SdrDragEntryPrimitive2DSequence::SdrDragEntryPrimitive2DSequence(
- const drawinglayer::primitive2d::Primitive2DSequence& rSequence,
- bool bAddToTransparent)
-: SdrDragEntry(),
- maPrimitive2DSequence(rSequence)
+ const drawinglayer::primitive2d::Primitive2DSequence& rSequence,
+ bool bAddToTransparent)
+: SdrDragEntry(),
+ maPrimitive2DSequence(rSequence)
{
// add parts to transparent overlay stuff eventually
setAddToTransparent(bAddToTransparent);
@@ -238,18 +238,18 @@ SdrDragEntryPrimitive2DSequence::~SdrDragEntryPrimitive2DSequence()
drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPrimitive2DSequence::createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod)
{
drawinglayer::primitive2d::Primitive2DReference aTransformPrimitive2D(
- new drawinglayer::primitive2d::TransformPrimitive2D(
- rDragMethod.getCurrentTransformation(),
- maPrimitive2DSequence));
+ new drawinglayer::primitive2d::TransformPrimitive2D(
+ rDragMethod.getCurrentTransformation(),
+ maPrimitive2DSequence));
- return drawinglayer::primitive2d::Primitive2DSequence(&aTransformPrimitive2D, 1);
+ return drawinglayer::primitive2d::Primitive2DSequence(&aTransformPrimitive2D, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
SdrDragEntryPointGlueDrag::SdrDragEntryPointGlueDrag(const std::vector< basegfx::B2DPoint >& rPositions, bool bIsPointDrag)
-: maPositions(rPositions),
- mbIsPointDrag(bIsPointDrag)
+: maPositions(rPositions),
+ mbIsPointDrag(bIsPointDrag)
{
// add SdrObject parts to transparent overlay stuff
setAddToTransparent(true);
@@ -263,59 +263,59 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPointGlueDrag::create
{
drawinglayer::primitive2d::Primitive2DSequence aRetval;
- if(!maPositions.empty())
- {
- basegfx::B2DPolygon aPolygon;
- sal_uInt32 a(0);
+ if(!maPositions.empty())
+ {
+ basegfx::B2DPolygon aPolygon;
+ sal_uInt32 a(0);
- for(a = 0; a < maPositions.size(); a++)
- {
- aPolygon.append(maPositions[a]);
- }
+ for(a = 0; a < maPositions.size(); a++)
+ {
+ aPolygon.append(maPositions[a]);
+ }
- basegfx::B2DPolyPolygon aPolyPolygon(aPolygon);
-
- rDragMethod.applyCurrentTransformationToPolyPolygon(aPolyPolygon);
+ basegfx::B2DPolyPolygon aPolyPolygon(aPolygon);
- const basegfx::B2DPolygon aTransformed(aPolyPolygon.getB2DPolygon(0));
- std::vector< basegfx::B2DPoint > aTransformedPositions;
+ rDragMethod.applyCurrentTransformationToPolyPolygon(aPolyPolygon);
- aTransformedPositions.reserve(aTransformed.count());
+ const basegfx::B2DPolygon aTransformed(aPolyPolygon.getB2DPolygon(0));
+ std::vector< basegfx::B2DPoint > aTransformedPositions;
- for(a = 0; a < aTransformed.count(); a++)
- {
- aTransformedPositions.push_back(aTransformed.getB2DPoint(a));
- }
+ aTransformedPositions.reserve(aTransformed.count());
+
+ for(a = 0; a < aTransformed.count(); a++)
+ {
+ aTransformedPositions.push_back(aTransformed.getB2DPoint(a));
+ }
- if(mbIsPointDrag)
- {
- const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
- basegfx::BColor aColor(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor());
+ if(mbIsPointDrag)
+ {
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ basegfx::BColor aColor(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor());
- if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
- {
- aColor = Application::GetSettings().GetStyleSettings().GetHighlightColor().getBColor();
- }
+ if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ aColor = Application::GetSettings().GetStyleSettings().GetHighlightColor().getBColor();
+ }
- drawinglayer::primitive2d::Primitive2DReference aMarkerArrayPrimitive2D(
- new drawinglayer::primitive2d::MarkerArrayPrimitive2D(aTransformedPositions,
+ drawinglayer::primitive2d::Primitive2DReference aMarkerArrayPrimitive2D(
+ new drawinglayer::primitive2d::MarkerArrayPrimitive2D(aTransformedPositions,
drawinglayer::primitive2d::createDefaultCross_3x3(aColor)));
- aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aMarkerArrayPrimitive2D, 1);
- }
- else
- {
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aMarkerArrayPrimitive2D, 1);
+ }
+ else
+ {
const basegfx::BColor aBackPen(1.0, 1.0, 1.0);
const basegfx::BColor aRGBFrontColor(0.0, 0.0, 1.0); // COL_LIGHTBLUE
- drawinglayer::primitive2d::Primitive2DReference aMarkerArrayPrimitive2D(
- new drawinglayer::primitive2d::MarkerArrayPrimitive2D(aTransformedPositions,
+ drawinglayer::primitive2d::Primitive2DReference aMarkerArrayPrimitive2D(
+ new drawinglayer::primitive2d::MarkerArrayPrimitive2D(aTransformedPositions,
drawinglayer::primitive2d::createDefaultGluepoint_9x9(aBackPen, aRGBFrontColor)));
- aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aMarkerArrayPrimitive2D, 1);
- }
- }
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aMarkerArrayPrimitive2D, 1);
+ }
+ }
- return aRetval;
+ return aRetval;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -324,263 +324,262 @@ TYPEINIT0(SdrDragMethod);
void SdrDragMethod::resetSdrDragEntries()
{
- // clear entries; creation is on demand
- clearSdrDragEntries();
+ // clear entries; creation is on demand
+ clearSdrDragEntries();
}
basegfx::B2DRange SdrDragMethod::getCurrentRange() const
{
- return getB2DRangeFromOverlayObjectList();
+ return getB2DRangeFromOverlayObjectList();
}
-void SdrDragMethod::clearSdrDragEntries()
-{
- for(sal_uInt32 a(0); a < maSdrDragEntries.size(); a++)
- {
- delete maSdrDragEntries[a];
- }
+void SdrDragMethod::clearSdrDragEntries()
+{
+ for(sal_uInt32 a(0); a < maSdrDragEntries.size(); a++)
+ {
+ delete maSdrDragEntries[a];
+ }
- maSdrDragEntries.clear();
+ maSdrDragEntries.clear();
}
-void SdrDragMethod::addSdrDragEntry(SdrDragEntry* pNew)
-{
- if(pNew)
- {
- maSdrDragEntries.push_back(pNew);
- }
+void SdrDragMethod::addSdrDragEntry(SdrDragEntry* pNew)
+{
+ if(pNew)
+ {
+ maSdrDragEntries.push_back(pNew);
+ }
}
void SdrDragMethod::createSdrDragEntries()
{
if(getSdrDragView().GetSdrPageView() && getSdrDragView().GetSdrPageView()->HasMarkedObjPageView())
{
- if(getSdrDragView().IsDraggingPoints())
- {
- createSdrDragEntries_PointDrag();
- }
- else if(getSdrDragView().IsDraggingGluePoints())
- {
- createSdrDragEntries_GlueDrag();
- }
- else
- {
- if(getSolidDraggingActive())
- {
- createSdrDragEntries_SolidDrag();
- }
- else
- {
- createSdrDragEntries_PolygonDrag();
- }
- }
- }
+ if(getSdrDragView().IsDraggingPoints())
+ {
+ createSdrDragEntries_PointDrag();
+ }
+ else if(getSdrDragView().IsDraggingGluePoints())
+ {
+ createSdrDragEntries_GlueDrag();
+ }
+ else
+ {
+ if(getSolidDraggingActive())
+ {
+ createSdrDragEntries_SolidDrag();
+ }
+ else
+ {
+ createSdrDragEntries_PolygonDrag();
+ }
+ }
+ }
}
void SdrDragMethod::createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify)
{
- // add full obejct drag; Clone() at the object has to work
- // for this
- addSdrDragEntry(new SdrDragEntrySdrObject(rOriginal, rObjectContact, bModify));
+ // add full object drag; Clone() at the object has to work
+ // for this
+ addSdrDragEntry(new SdrDragEntrySdrObject(rOriginal, rObjectContact, bModify));
}
void SdrDragMethod::createSdrDragEntries_SolidDrag()
{
- const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
- SdrPageView* pPV = getSdrDragView().GetSdrPageView();
-
- if(pPV)
- {
- for(sal_uInt32 a(0); a < nMarkAnz; a++)
- {
- SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(a);
-
- if(pM->GetPageView() == pPV)
- {
- const SdrObject* pObject = pM->GetMarkedSdrObj();
-
- if(pObject)
- {
- if(pPV->PageWindowCount())
- {
- sdr::contact::ObjectContact& rOC = pPV->GetPageWindow(0)->GetObjectContact();
- SdrObjListIter aIter(*pObject);
-
- while(aIter.IsMore())
- {
- SdrObject* pCandidate = aIter.Next();
-
- if(pCandidate)
- {
- const bool bSuppressFullDrag(!pCandidate->supportsFullDrag());
- bool bAddWireframe(bSuppressFullDrag);
-
- if(!bAddWireframe && !pCandidate->HasLineStyle())
- {
+ const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
+ SdrPageView* pPV = getSdrDragView().GetSdrPageView();
+
+ if(pPV)
+ {
+ for(sal_uInt32 a(0); a < nMarkAnz; a++)
+ {
+ SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(a);
+
+ if(pM->GetPageView() == pPV)
+ {
+ const SdrObject* pObject = pM->GetMarkedSdrObj();
+
+ if(pObject)
+ {
+ if(pPV->PageWindowCount())
+ {
+ sdr::contact::ObjectContact& rOC = pPV->GetPageWindow(0)->GetObjectContact();
+ SdrObjListIter aIter(*pObject);
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pCandidate = aIter.Next();
+
+ if(pCandidate)
+ {
+ const bool bSuppressFullDrag(!pCandidate->supportsFullDrag());
+ bool bAddWireframe(bSuppressFullDrag);
+
+ if(!bAddWireframe && !pCandidate->HasLineStyle())
+ {
// add wireframe for objects without outline
- bAddWireframe = true;
- }
-
- if(!bSuppressFullDrag)
- {
- // add full obejct drag; Clone() at the object has to work
- // for this
- createSdrDragEntryForSdrObject(*pCandidate, rOC, true);
- }
-
- if(bAddWireframe)
- {
- // when dragging a 50% transparent copy of a filled or not filled object without
- // outline, this is normally hard to see. Add extra wireframe in that case. This
- // works nice e.g. with thext frames etc.
- addSdrDragEntry(new SdrDragEntryPolyPolygon(pCandidate->TakeXorPoly()));
- }
- }
- }
- }
- }
- }
- }
- }
+ bAddWireframe = true;
+ }
+
+ if(!bSuppressFullDrag)
+ {
+ // add full object drag; Clone() at the object has to work for this
+ createSdrDragEntryForSdrObject(*pCandidate, rOC, true);
+ }
+
+ if(bAddWireframe)
+ {
+ // when dragging a 50% transparent copy of a filled or not filled object without
+ // outline, this is normally hard to see. Add extra wireframe in that case. This
+ // works nice e.g. with text frames etc.
+ addSdrDragEntry(new SdrDragEntryPolyPolygon(pCandidate->TakeXorPoly()));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
void SdrDragMethod::createSdrDragEntries_PolygonDrag()
{
- const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
- bool bNoPolygons(getSdrDragView().IsNoDragXorPolys() || nMarkAnz > getSdrDragView().GetDragXorPolyLimit());
- basegfx::B2DPolyPolygon aResult;
- sal_uInt32 nPointCount(0);
+ const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
+ bool bNoPolygons(getSdrDragView().IsNoDragXorPolys() || nMarkAnz > getSdrDragView().GetDragXorPolyLimit());
+ basegfx::B2DPolyPolygon aResult;
+ sal_uInt32 nPointCount(0);
- for(sal_uInt32 a(0); !bNoPolygons && a < nMarkAnz; a++)
- {
+ for(sal_uInt32 a(0); !bNoPolygons && a < nMarkAnz; a++)
+ {
SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(a);
-
- if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
+
+ if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
{
const basegfx::B2DPolyPolygon aNewPolyPolygon(pM->GetMarkedSdrObj()->TakeXorPoly());
- for(sal_uInt32 b(0); b < aNewPolyPolygon.count(); b++)
- {
- nPointCount += aNewPolyPolygon.getB2DPolygon(b).count();
- }
-
- if(nPointCount > getSdrDragView().GetDragXorPointLimit())
- {
- bNoPolygons = true;
- }
-
- if(!bNoPolygons)
- {
- aResult.append(aNewPolyPolygon);
- }
- }
- }
-
- if(bNoPolygons)
- {
- const Rectangle aR(getSdrDragView().GetSdrPageView()->MarkSnap());
- const basegfx::B2DRange aNewRectangle(aR.Left(), aR.Top(), aR.Right(), aR.Bottom());
- basegfx::B2DPolygon aNewPolygon(basegfx::tools::createPolygonFromRect(aNewRectangle));
-
- aResult = basegfx::B2DPolyPolygon(basegfx::tools::expandToCurve(aNewPolygon));
- }
-
- if(aResult.count())
- {
- addSdrDragEntry(new SdrDragEntryPolyPolygon(aResult));
- }
+ for(sal_uInt32 b(0); b < aNewPolyPolygon.count(); b++)
+ {
+ nPointCount += aNewPolyPolygon.getB2DPolygon(b).count();
+ }
+
+ if(nPointCount > getSdrDragView().GetDragXorPointLimit())
+ {
+ bNoPolygons = true;
+ }
+
+ if(!bNoPolygons)
+ {
+ aResult.append(aNewPolyPolygon);
+ }
+ }
+ }
+
+ if(bNoPolygons)
+ {
+ const Rectangle aR(getSdrDragView().GetSdrPageView()->MarkSnap());
+ const basegfx::B2DRange aNewRectangle(aR.Left(), aR.Top(), aR.Right(), aR.Bottom());
+ basegfx::B2DPolygon aNewPolygon(basegfx::tools::createPolygonFromRect(aNewRectangle));
+
+ aResult = basegfx::B2DPolyPolygon(basegfx::tools::expandToCurve(aNewPolygon));
+ }
+
+ if(aResult.count())
+ {
+ addSdrDragEntry(new SdrDragEntryPolyPolygon(aResult));
+ }
}
void SdrDragMethod::createSdrDragEntries_PointDrag()
{
- const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
- std::vector< basegfx::B2DPoint > aPositions;
-
- for(sal_uInt32 nm(0); nm < nMarkAnz; nm++)
+ const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
+ std::vector< basegfx::B2DPoint > aPositions;
+
+ for(sal_uInt32 nm(0); nm < nMarkAnz; nm++)
{
SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(nm);
- if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
+ if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
{
const SdrUShortCont* pPts = pM->GetMarkedPoints();
- if(pPts && pPts->GetCount())
+ if(pPts && pPts->GetCount())
{
const SdrObject* pObj = pM->GetMarkedSdrObj();
const SdrPathObj* pPath = dynamic_cast< const SdrPathObj* >(pObj);
- if(pPath)
- {
- const basegfx::B2DPolyPolygon aPathXPP = pPath->GetPathPoly();
-
- if(aPathXPP.count())
- {
- const sal_uInt32 nPtAnz(pPts->GetCount());
+ if(pPath)
+ {
+ const basegfx::B2DPolyPolygon aPathXPP = pPath->GetPathPoly();
- for(sal_uInt32 nPtNum(0); nPtNum < nPtAnz; nPtNum++)
- {
- sal_uInt32 nPolyNum, nPointNum;
- const sal_uInt16 nObjPt(pPts->GetObject(nPtNum));
+ if(aPathXPP.count())
+ {
+ const sal_uInt32 nPtAnz(pPts->GetCount());
+
+ for(sal_uInt32 nPtNum(0); nPtNum < nPtAnz; nPtNum++)
+ {
+ sal_uInt32 nPolyNum, nPointNum;
+ const sal_uInt16 nObjPt(pPts->GetObject(nPtNum));
- if(sdr::PolyPolygonEditor::GetRelativePolyPoint(aPathXPP, nObjPt, nPolyNum, nPointNum))
- {
- aPositions.push_back(aPathXPP.getB2DPolygon(nPolyNum).getB2DPoint(nPointNum));
- }
- }
- }
- }
+ if(sdr::PolyPolygonEditor::GetRelativePolyPoint(aPathXPP, nObjPt, nPolyNum, nPointNum))
+ {
+ aPositions.push_back(aPathXPP.getB2DPolygon(nPolyNum).getB2DPoint(nPointNum));
+ }
+ }
+ }
+ }
}
}
- }
+ }
- if(!aPositions.empty())
- {
- addSdrDragEntry(new SdrDragEntryPointGlueDrag(aPositions, true));
- }
+ if(!aPositions.empty())
+ {
+ addSdrDragEntry(new SdrDragEntryPointGlueDrag(aPositions, true));
+ }
}
void SdrDragMethod::createSdrDragEntries_GlueDrag()
{
- const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
- std::vector< basegfx::B2DPoint > aPositions;
-
- for(sal_uInt32 nm(0); nm < nMarkAnz; nm++)
+ const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
+ std::vector< basegfx::B2DPoint > aPositions;
+
+ for(sal_uInt32 nm(0); nm < nMarkAnz; nm++)
{
SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(nm);
- if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
+ if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
{
const SdrUShortCont* pPts = pM->GetMarkedGluePoints();
- if(pPts && pPts->GetCount())
+ if(pPts && pPts->GetCount())
{
const SdrObject* pObj = pM->GetMarkedSdrObj();
- const SdrGluePointList* pGPL = pObj->GetGluePointList();
-
- if(pGPL)
+ const SdrGluePointList* pGPL = pObj->GetGluePointList();
+
+ if(pGPL)
{
- const sal_uInt32 nPtAnz(pPts->GetCount());
+ const sal_uInt32 nPtAnz(pPts->GetCount());
- for(sal_uInt32 nPtNum(0); nPtNum < nPtAnz; nPtNum++)
- {
- const sal_uInt16 nObjPt(pPts->GetObject(nPtNum));
- const sal_uInt16 nGlueNum(pGPL->FindGluePoint(nObjPt));
+ for(sal_uInt32 nPtNum(0); nPtNum < nPtAnz; nPtNum++)
+ {
+ const sal_uInt16 nObjPt(pPts->GetObject(nPtNum));
+ const sal_uInt16 nGlueNum(pGPL->FindGluePoint(nObjPt));
- if(SDRGLUEPOINT_NOTFOUND != nGlueNum)
- {
- const Point aPoint((*pGPL)[nGlueNum].GetAbsolutePos(*pObj));
- aPositions.push_back(basegfx::B2DPoint(aPoint.X(), aPoint.Y()));
- }
- }
- }
+ if(SDRGLUEPOINT_NOTFOUND != nGlueNum)
+ {
+ const Point aPoint((*pGPL)[nGlueNum].GetAbsolutePos(*pObj));
+ aPositions.push_back(basegfx::B2DPoint(aPoint.X(), aPoint.Y()));
+ }
+ }
+ }
}
}
- }
+ }
- if(!aPositions.empty())
- {
- addSdrDragEntry(new SdrDragEntryPointGlueDrag(aPositions, false));
- }
+ if(!aPositions.empty())
+ {
+ addSdrDragEntry(new SdrDragEntryPointGlueDrag(aPositions, false));
+ }
}
void SdrDragMethod::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, XubString& rStr, sal_uInt16 nVal) const
@@ -612,9 +611,9 @@ SdrPageView* SdrDragMethod::GetDragPV() const
void SdrDragMethod::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
{
- // the original applies the transformation using TRGetBaseGeometry/TRSetBaseGeometry.
+ // the original applies the transformation using TRGetBaseGeometry/TRSetBaseGeometry.
// Later this should be the only needed one for linear transforms (not for SdrDragCrook and
- // SdrDragDistort, those are NOT linear). Currently, this can not yet be used since the
+ // SdrDragDistort, those are NOT linear). Currently, this can not yet be used since the
// special handling of rotate/mirror due to the not-being-able to handle it in the old
// drawinglayer stuff. Text would currently not correctly be mirrored in the preview.
basegfx::B2DHomMatrix aObjectTransform;
@@ -641,11 +640,11 @@ void SdrDragMethod::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
const double fScaleY(fabs(aScale.getY()) / (basegfx::fTools::equalZero(aPolyRange.getHeight()) ? 1.0 : aPolyRange.getHeight()));
// prepare transform matrix for polygon
- basegfx::B2DHomMatrix aPolyTransform(basegfx::tools::createTranslateB2DHomMatrix(
- -aPolyRange.getMinX(), -aPolyRange.getMinY()));
+ basegfx::B2DHomMatrix aPolyTransform(basegfx::tools::createTranslateB2DHomMatrix(
+ -aPolyRange.getMinX(), -aPolyRange.getMinY()));
aPolyTransform.scale(fScaleX, fScaleY);
- // normally the poly should be moved back, but the translation is in the object
+ // normally the poly should be moved back, but the translation is in the object
// transformation and thus does not need to be done
// aPolyTransform.translate(-aPolyRange.getMinX(), -aPolyRange.getMinY());
@@ -664,21 +663,21 @@ void SdrDragMethod::applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPoly
SdrDragMethod::SdrDragMethod(SdrDragView& rNewView)
: maSdrDragEntries(),
- maOverlayObjectList(),
- mrSdrDragView(rNewView),
+ maOverlayObjectList(),
+ mrSdrDragView(rNewView),
mbMoveOnly(false),
mbSolidDraggingActive(getSdrDragView().IsSolidDragging())
{
if(mbSolidDraggingActive && Application::GetSettings().GetStyleSettings().GetHighContrastMode())
- {
- // fallback to wireframe when high contrast is used
- mbSolidDraggingActive = false;
- }
+ {
+ // fallback to wireframe when high contrast is used
+ mbSolidDraggingActive = false;
+ }
}
SdrDragMethod::~SdrDragMethod()
{
- clearSdrDragEntries();
+ clearSdrDragEntries();
}
void SdrDragMethod::Show()
@@ -703,102 +702,102 @@ void SdrDragMethod::CancelSdrDrag()
struct compareConstSdrObjectRefs
{
- bool operator()(const SdrObject* p1, const SdrObject* p2) const
- {
- return (p1 < p2);
- }
+ bool operator()(const SdrObject* p1, const SdrObject* p2) const
+ {
+ return (p1 < p2);
+ }
};
typedef std::map< const SdrObject*, SdrObject*, compareConstSdrObjectRefs> SdrObjectAndCloneMap;
void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlayManager)
{
- // create SdrDragEntries on demand
- if(maSdrDragEntries.empty())
- {
- createSdrDragEntries();
- }
-
- // if there are entries, derive OverlayObjects from the entries, including
- // modification from current interactive state
- if(!maSdrDragEntries.empty())
- {
- // #54102# SdrDragEntrySdrObject creates clones of SdrObjects as base for creating the needed
- // primitives, holding the original and the clone. If connectors (Edges) are involved,
- // the cloned connectors need to be connected to the cloned SdrObjects (after cloning
- // they are connected to the original SdrObjects). To do so, trigger the preparation
- // steps for SdrDragEntrySdrObject, save an association of (orig, clone) in a helper
- // and evtl. remember if it was an edge
- SdrObjectAndCloneMap aOriginalAndClones;
- std::vector< SdrEdgeObj* > aEdges;
- sal_uInt32 a;
-
- // #54102# execute prepareCurrentState for all SdrDragEntrySdrObject, register pair of original and
- // clone, remember edges
+ // create SdrDragEntries on demand
+ if(maSdrDragEntries.empty())
+ {
+ createSdrDragEntries();
+ }
+
+ // if there are entries, derive OverlayObjects from the entries, including
+ // modification from current interactive state
+ if(!maSdrDragEntries.empty())
+ {
+ // #54102# SdrDragEntrySdrObject creates clones of SdrObjects as base for creating the needed
+ // primitives, holding the original and the clone. If connectors (Edges) are involved,
+ // the cloned connectors need to be connected to the cloned SdrObjects (after cloning
+ // they are connected to the original SdrObjects). To do so, trigger the preparation
+ // steps for SdrDragEntrySdrObject, save an association of (orig, clone) in a helper
+ // and evtl. remember if it was an edge
+ SdrObjectAndCloneMap aOriginalAndClones;
+ std::vector< SdrEdgeObj* > aEdges;
+ sal_uInt32 a;
+
+ // #54102# execute prepareCurrentState for all SdrDragEntrySdrObject, register pair of original and
+ // clone, remember edges
for(a = 0; a < maSdrDragEntries.size(); a++)
- {
- SdrDragEntrySdrObject* pSdrDragEntrySdrObject = dynamic_cast< SdrDragEntrySdrObject*>(maSdrDragEntries[a]);
-
- if(pSdrDragEntrySdrObject)
- {
- pSdrDragEntrySdrObject->prepareCurrentState(*this);
-
- SdrEdgeObj* pSdrEdgeObj = dynamic_cast< SdrEdgeObj* >(pSdrDragEntrySdrObject->getClone());
-
- if(pSdrEdgeObj)
- {
- aEdges.push_back(pSdrEdgeObj);
- }
-
- if(pSdrDragEntrySdrObject->getClone())
- {
- aOriginalAndClones[&pSdrDragEntrySdrObject->getOriginal()] = pSdrDragEntrySdrObject->getClone();
- }
- }
- }
-
- // #54102# if there are edges, reconnect their ends to the corresponding clones (if found)
- if(aEdges.size())
- {
- for(a = 0; a < aEdges.size(); a++)
- {
- SdrEdgeObj* pSdrEdgeObj = aEdges[a];
- SdrObject* pConnectedTo = pSdrEdgeObj->GetConnectedNode(true);
-
- if(pConnectedTo)
- {
- SdrObjectAndCloneMap::iterator aEntry = aOriginalAndClones.find(pConnectedTo);
-
- if(aEntry != aOriginalAndClones.end())
- {
- pSdrEdgeObj->ConnectToNode(true, aEntry->second);
- }
- }
-
- pConnectedTo = pSdrEdgeObj->GetConnectedNode(false);
-
- if(pConnectedTo)
- {
- SdrObjectAndCloneMap::iterator aEntry = aOriginalAndClones.find(pConnectedTo);
-
- if(aEntry != aOriginalAndClones.end())
- {
- pSdrEdgeObj->ConnectToNode(false, aEntry->second);
- }
- }
- }
- }
-
- // collect primitives for visualisation
+ {
+ SdrDragEntrySdrObject* pSdrDragEntrySdrObject = dynamic_cast< SdrDragEntrySdrObject*>(maSdrDragEntries[a]);
+
+ if(pSdrDragEntrySdrObject)
+ {
+ pSdrDragEntrySdrObject->prepareCurrentState(*this);
+
+ SdrEdgeObj* pSdrEdgeObj = dynamic_cast< SdrEdgeObj* >(pSdrDragEntrySdrObject->getClone());
+
+ if(pSdrEdgeObj)
+ {
+ aEdges.push_back(pSdrEdgeObj);
+ }
+
+ if(pSdrDragEntrySdrObject->getClone())
+ {
+ aOriginalAndClones[&pSdrDragEntrySdrObject->getOriginal()] = pSdrDragEntrySdrObject->getClone();
+ }
+ }
+ }
+
+ // #54102# if there are edges, reconnect their ends to the corresponding clones (if found)
+ if(aEdges.size())
+ {
+ for(a = 0; a < aEdges.size(); a++)
+ {
+ SdrEdgeObj* pSdrEdgeObj = aEdges[a];
+ SdrObject* pConnectedTo = pSdrEdgeObj->GetConnectedNode(true);
+
+ if(pConnectedTo)
+ {
+ SdrObjectAndCloneMap::iterator aEntry = aOriginalAndClones.find(pConnectedTo);
+
+ if(aEntry != aOriginalAndClones.end())
+ {
+ pSdrEdgeObj->ConnectToNode(true, aEntry->second);
+ }
+ }
+
+ pConnectedTo = pSdrEdgeObj->GetConnectedNode(false);
+
+ if(pConnectedTo)
+ {
+ SdrObjectAndCloneMap::iterator aEntry = aOriginalAndClones.find(pConnectedTo);
+
+ if(aEntry != aOriginalAndClones.end())
+ {
+ pSdrEdgeObj->ConnectToNode(false, aEntry->second);
+ }
+ }
+ }
+ }
+
+ // collect primitives for visualization
drawinglayer::primitive2d::Primitive2DSequence aResult;
drawinglayer::primitive2d::Primitive2DSequence aResultTransparent;
- for(a = 0; a < maSdrDragEntries.size(); a++)
- {
- SdrDragEntry* pCandidate = maSdrDragEntries[a];
+ for(a = 0; a < maSdrDragEntries.size(); a++)
+ {
+ SdrDragEntry* pCandidate = maSdrDragEntries[a];
- if(pCandidate)
- {
+ if(pCandidate)
+ {
const drawinglayer::primitive2d::Primitive2DSequence aCandidateResult(pCandidate->createPrimitive2DSequenceInCurrentState(*this));
if(aCandidateResult.hasElements())
@@ -828,23 +827,23 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay
if(aResult.hasElements())
{
- sdr::overlay::OverlayObject* pNewOverlayObject = new sdr::overlay::OverlayPrimitive2DSequenceObject(aResult);
- rOverlayManager.add(*pNewOverlayObject);
+ sdr::overlay::OverlayObject* pNewOverlayObject = new sdr::overlay::OverlayPrimitive2DSequenceObject(aResult);
+ rOverlayManager.add(*pNewOverlayObject);
addToOverlayObjectList(*pNewOverlayObject);
}
-
+
if(aResultTransparent.hasElements())
{
drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aResultTransparent, 0.5));
aResultTransparent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparencePrimitive2D, 1);
-
+
sdr::overlay::OverlayObject* pNewOverlayObject = new sdr::overlay::OverlayPrimitive2DSequenceObject(aResultTransparent);
- rOverlayManager.add(*pNewOverlayObject);
+ rOverlayManager.add(*pNewOverlayObject);
addToOverlayObjectList(*pNewOverlayObject);
}
}
- // evtl add DragStripes (help lines cross the page when dragging)
+ // evtl. add DragStripes (help lines cross the page when dragging)
if(getSdrDragView().IsDragStripes())
{
Rectangle aActionRectangle;
@@ -879,7 +878,7 @@ bool SdrDragMethod::DoAddConnectorOverlays()
{
return false;
}
-
+
if(getSdrDragView().IsDraggingPoints() || getSdrDragView().IsDraggingGluePoints())
{
return false;
@@ -931,38 +930,38 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragMethod::AddConnectorOverla
// this polygon is a temporary calculated connector path, so it is not possible to fetch
// the needed primitives directly from the pEdge object which does not get changed. If full
// drag is on, use the SdrObjects ItemSet to create a adequate representation
- bool bUseSolidDragging(getSolidDraggingActive());
-
- if(bUseSolidDragging)
- {
- // switch off solid dragging if connector is not visible
- if(!pEdge->HasLineStyle())
- {
- bUseSolidDragging = false;
- }
- }
-
- if(bUseSolidDragging)
- {
- const SfxItemSet& rItemSet = pEdge->GetMergedItemSet();
- const drawinglayer::attribute::SdrLineAttribute aLine(
- drawinglayer::primitive2d::createNewSdrLineAttribute(rItemSet));
-
- if(!aLine.isDefault())
- {
- const drawinglayer::attribute::SdrLineStartEndAttribute aLineStartEnd(
- drawinglayer::primitive2d::createNewSdrLineStartEndAttribute(
- rItemSet,
- aLine.getWidth()));
-
- drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(
- aRetval, drawinglayer::primitive2d::createPolygonLinePrimitive(
- aEdgePolygon,
- aLine,
- aLineStartEnd));
- }
- }
- else
+ bool bUseSolidDragging(getSolidDraggingActive());
+
+ if(bUseSolidDragging)
+ {
+ // switch off solid dragging if connector is not visible
+ if(!pEdge->HasLineStyle())
+ {
+ bUseSolidDragging = false;
+ }
+ }
+
+ if(bUseSolidDragging)
+ {
+ const SfxItemSet& rItemSet = pEdge->GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineAttribute aLine(
+ drawinglayer::primitive2d::createNewSdrLineAttribute(rItemSet));
+
+ if(!aLine.isDefault())
+ {
+ const drawinglayer::attribute::SdrLineStartEndAttribute aLineStartEnd(
+ drawinglayer::primitive2d::createNewSdrLineStartEndAttribute(
+ rItemSet,
+ aLine.getWidth()));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(
+ aRetval, drawinglayer::primitive2d::createPolygonLinePrimitive(
+ aEdgePolygon,
+ aLine,
+ aLineStartEnd));
+ }
+ }
+ else
{
const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
basegfx::BColor aColA(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor());
@@ -978,7 +977,7 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragMethod::AddConnectorOverla
drawinglayer::primitive2d::Primitive2DReference aPolyPolygonMarkerPrimitive2D(
new drawinglayer::primitive2d::PolygonMarkerPrimitive2D(
aEdgePolygon, aColA, aColB, fStripeLength));
- drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aPolyPolygonMarkerPrimitive2D);
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aPolyPolygonMarkerPrimitive2D);
}
}
}
@@ -993,15 +992,15 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragMethod::AddConnectorOverla
TYPEINIT1(SdrDragMovHdl,SdrDragMethod);
SdrDragMovHdl::SdrDragMovHdl(SdrDragView& rNewView)
-: SdrDragMethod(rNewView),
- bMirrObjShown(false)
+: SdrDragMethod(rNewView),
+ bMirrObjShown(false)
{
}
void SdrDragMovHdl::createSdrDragEntries()
{
- // SdrDragMovHdl does not use the default drags,
- // but creates nothing
+ // SdrDragMovHdl does not use the default drags,
+ // but creates nothing
}
void SdrDragMovHdl::TakeSdrDragComment(XubString& rStr) const
@@ -1021,40 +1020,40 @@ bool SdrDragMovHdl::BeginSdrDrag()
SdrHdl* pH1=GetHdlList().GetHdl(HDL_REF1);
SdrHdl* pH2=GetHdlList().GetHdl(HDL_REF2);
- if (eKind==HDL_MIRX)
+ if (eKind==HDL_MIRX)
{
- if (pH1==NULL || pH2==NULL)
+ if (pH1==NULL || pH2==NULL)
{
DBG_ERROR("SdrDragMovHdl::BeginSdrDrag(): Verschieben der Spiegelachse: Referenzhandles nicht gefunden");
return false;
}
-
+
DragStat().SetActionRect(Rectangle(pH1->GetPos(),pH2->GetPos()));
- }
- else
+ }
+ else
{
Point aPt(GetDragHdl()->GetPos());
DragStat().SetActionRect(Rectangle(aPt,aPt));
}
-
+
return true;
}
void SdrDragMovHdl::MoveSdrDrag(const Point& rNoSnapPnt)
{
Point aPnt(rNoSnapPnt);
-
- if ( GetDragHdl() && DragStat().CheckMinMoved(rNoSnapPnt))
+
+ if ( GetDragHdl() && DragStat().CheckMinMoved(rNoSnapPnt))
{
- if (GetDragHdl()->GetKind()==HDL_MIRX)
+ if (GetDragHdl()->GetKind()==HDL_MIRX)
{
SdrHdl* pH1=GetHdlList().GetHdl(HDL_REF1);
SdrHdl* pH2=GetHdlList().GetHdl(HDL_REF2);
-
- if (pH1==NULL || pH2==NULL)
+
+ if (pH1==NULL || pH2==NULL)
return;
-
- if (!DragStat().IsNoSnap())
+
+ if (!DragStat().IsNoSnap())
{
long nBestXSnap=0;
long nBestYSnap=0;
@@ -1066,8 +1065,8 @@ void SdrDragMovHdl::MoveSdrDrag(const Point& rNoSnapPnt)
aPnt.X()+=nBestXSnap;
aPnt.Y()+=nBestYSnap;
}
-
- if (aPnt!=DragStat().GetNow())
+
+ if (aPnt!=DragStat().GetNow())
{
Hide();
DragStat().NextMove(aPnt);
@@ -1076,41 +1075,41 @@ void SdrDragMovHdl::MoveSdrDrag(const Point& rNoSnapPnt)
pH2->SetPos(Ref2()+aDif);
SdrHdl* pHM = GetHdlList().GetHdl(HDL_MIRX);
-
+
if(pHM)
pHM->Touch();
Show();
DragStat().SetActionRect(Rectangle(pH1->GetPos(),pH2->GetPos()));
}
- }
- else
+ }
+ else
{
if (!DragStat().IsNoSnap()) SnapPos(aPnt);
long nSA=0;
- if (getSdrDragView().IsAngleSnapEnabled())
+ if (getSdrDragView().IsAngleSnapEnabled())
nSA=getSdrDragView().GetSnapAngle();
- if (getSdrDragView().IsMirrorAllowed(true,true))
+ if (getSdrDragView().IsMirrorAllowed(true,true))
{ // eingeschraenkt
if (!getSdrDragView().IsMirrorAllowed(false,false)) nSA=4500;
if (!getSdrDragView().IsMirrorAllowed(true,false)) nSA=9000;
}
- if (getSdrDragView().IsOrtho() && nSA!=9000)
+ if (getSdrDragView().IsOrtho() && nSA!=9000)
nSA=4500;
- if (nSA!=0)
+ if (nSA!=0)
{ // Winkelfang
SdrHdlKind eRef=HDL_REF1;
-
- if (GetDragHdl()->GetKind()==HDL_REF1)
+
+ if (GetDragHdl()->GetKind()==HDL_REF1)
eRef=HDL_REF2;
SdrHdl* pH=GetHdlList().GetHdl(eRef);
-
- if (pH!=NULL)
+
+ if (pH!=NULL)
{
Point aRef(pH->GetPos());
long nWink=NormAngle360(GetAngle(aPnt-aRef));
@@ -1123,29 +1122,29 @@ void SdrDragMovHdl::MoveSdrDrag(const Point& rNoSnapPnt)
double nSin=sin(a);
double nCos=cos(a);
RotatePoint(aPnt,aRef,nSin,nCos);
-
+
// Bei bestimmten Werten Rundungsfehler ausschliessen:
- if (nSA==9000)
+ if (nSA==9000)
{
if (nNeuWink==0 || nNeuWink==18000) aPnt.Y()=aRef.Y();
if (nNeuWink==9000 || nNeuWink==27000) aPnt.X()=aRef.X();
}
-
- if (nSA==4500)
+
+ if (nSA==4500)
OrthoDistance8(aRef,aPnt,true);
}
}
- if (aPnt!=DragStat().GetNow())
+ if (aPnt!=DragStat().GetNow())
{
Hide();
DragStat().NextMove(aPnt);
GetDragHdl()->SetPos(DragStat().GetNow());
SdrHdl* pHM = GetHdlList().GetHdl(HDL_MIRX);
-
+
if(pHM)
pHM->Touch();
-
+
Show();
DragStat().SetActionRect(Rectangle(aPnt,aPnt));
}
@@ -1157,17 +1156,17 @@ bool SdrDragMovHdl::EndSdrDrag(bool /*bCopy*/)
{
if( GetDragHdl() )
{
- switch (GetDragHdl()->GetKind())
+ switch (GetDragHdl()->GetKind())
{
- case HDL_REF1:
- Ref1()=DragStat().GetNow();
+ case HDL_REF1:
+ Ref1()=DragStat().GetNow();
break;
-
- case HDL_REF2:
- Ref2()=DragStat().GetNow();
+
+ case HDL_REF2:
+ Ref2()=DragStat().GetNow();
break;
- case HDL_MIRX:
+ case HDL_MIRX:
Ref1()+=DragStat().GetNow()-DragStat().GetStart();
Ref2()+=DragStat().GetNow()-DragStat().GetStart();
break;
@@ -1186,7 +1185,7 @@ void SdrDragMovHdl::CancelSdrDrag()
SdrHdl* pHdl = GetDragHdl();
if( pHdl )
pHdl->SetPos(DragStat().GetRef1());
-
+
SdrHdl* pHM = GetHdlList().GetHdl(HDL_MIRX);
if(pHM)
@@ -1197,11 +1196,11 @@ Pointer SdrDragMovHdl::GetSdrDragPointer() const
{
const SdrHdl* pHdl = GetDragHdl();
- if (pHdl!=NULL)
+ if (pHdl!=NULL)
{
return pHdl->GetPointer();
}
-
+
return Pointer(POINTER_REFHAND);
}
@@ -1213,10 +1212,10 @@ SdrDragObjOwn::SdrDragObjOwn(SdrDragView& rNewView)
: SdrDragMethod(rNewView),
mpClone(0)
{
- const SdrObject* pObj = GetDragObj();
+ const SdrObject* pObj = GetDragObj();
- if(pObj)
- {
+ if(pObj)
+ {
// suppress full drag for some object types
setSolidDraggingActive(pObj->supportsFullDrag());
}
@@ -1232,9 +1231,9 @@ SdrDragObjOwn::~SdrDragObjOwn()
void SdrDragObjOwn::createSdrDragEntries()
{
- if(mpClone)
- {
- basegfx::B2DPolyPolygon aDragPolyPolygon;
+ if(mpClone)
+ {
+ basegfx::B2DPolyPolygon aDragPolyPolygon;
bool bAddWireframe(true);
if(getSolidDraggingActive())
@@ -1246,34 +1245,33 @@ void SdrDragObjOwn::createSdrDragEntries()
sdr::contact::ObjectContact& rOC = pPV->GetPageWindow(0)->GetObjectContact();
addSdrDragEntry(new SdrDragEntrySdrObject(*mpClone, rOC, false));
- // potentially no wireframe needed, full drag works
+ // potentially no wireframe needed, full drag works
bAddWireframe = false;
}
}
- if(!bAddWireframe)
- {
- // check for extra conditions for wireframe, e.g. no border at
- // objects
- if(!mpClone->HasLineStyle())
- {
- bAddWireframe = true;
- }
- }
+ if(!bAddWireframe)
+ {
+ // check for extra conditions for wireframe, e.g. no border at objects
+ if(!mpClone->HasLineStyle())
+ {
+ bAddWireframe = true;
+ }
+ }
if(bAddWireframe)
{
- // use wireframe poly when full drag is off or did not work
- aDragPolyPolygon = mpClone->TakeXorPoly();
- }
+ // use wireframe poly when full drag is off or did not work
+ aDragPolyPolygon = mpClone->TakeXorPoly();
+ }
- // add evtl. extra DragPolyPolygon
- const basegfx::B2DPolyPolygon aSpecialDragPolyPolygon(mpClone->getSpecialDragPoly(DragStat()));
+ // add evtl. extra DragPolyPolygon
+ const basegfx::B2DPolyPolygon aSpecialDragPolyPolygon(mpClone->getSpecialDragPoly(DragStat()));
- if(aSpecialDragPolyPolygon.count())
- {
- aDragPolyPolygon.append(aSpecialDragPolyPolygon);
- }
+ if(aSpecialDragPolyPolygon.count())
+ {
+ aDragPolyPolygon.append(aSpecialDragPolyPolygon);
+ }
if(aDragPolyPolygon.count())
{
@@ -1284,21 +1282,21 @@ void SdrDragObjOwn::createSdrDragEntries()
void SdrDragObjOwn::TakeSdrDragComment(XubString& rStr) const
{
- // #i103058# get info string from the clone preferred, the original will
- // not be changed. For security, use original as fallback
- if(mpClone)
- {
+ // #i103058# get info string from the clone preferred, the original will
+ // not be changed. For security, use original as fallback
+ if(mpClone)
+ {
rStr = mpClone->getSpecialDragComment(DragStat());
- }
- else
- {
- const SdrObject* pObj = GetDragObj();
+ }
+ else
+ {
+ const SdrObject* pObj = GetDragObj();
- if(pObj)
- {
- rStr = pObj->getSpecialDragComment(DragStat());
- }
- }
+ if(pObj)
+ {
+ rStr = pObj->getSpecialDragComment(DragStat());
+ }
+ }
}
bool SdrDragObjOwn::BeginSdrDrag()
@@ -1311,57 +1309,57 @@ bool SdrDragObjOwn::BeginSdrDrag()
{
if(pObj->beginSpecialDrag(DragStat()))
{
- // create nitial clone to have a start visualisation
+ // create initial clone to have a start visualization
mpClone = pObj->getFullDragClone();
mpClone->applySpecialDrag(DragStat());
-
+
return true;
}
}
}
- return false;
+ return false;
}
void SdrDragObjOwn::MoveSdrDrag(const Point& rNoSnapPnt)
{
const SdrObject* pObj = GetDragObj();
- if(pObj)
+ if(pObj)
{
Point aPnt(rNoSnapPnt);
SdrPageView* pPV = GetDragPV();
-
- if(pPV)
+
+ if(pPV)
{
- if(!DragStat().IsNoSnap())
+ if(!DragStat().IsNoSnap())
{
SnapPos(aPnt);
}
- if(getSdrDragView().IsOrtho())
+ if(getSdrDragView().IsOrtho())
{
- if (DragStat().IsOrtho8Possible())
+ if (DragStat().IsOrtho8Possible())
{
OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
}
- else if (DragStat().IsOrtho4Possible())
+ else if (DragStat().IsOrtho4Possible())
{
OrthoDistance4(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
}
}
- if(DragStat().CheckMinMoved(rNoSnapPnt))
+ if(DragStat().CheckMinMoved(rNoSnapPnt))
{
- if(aPnt != DragStat().GetNow())
+ if(aPnt != DragStat().GetNow())
{
Hide();
DragStat().NextMove(aPnt);
// since SdrDragObjOwn currently supports no transformation of
- // existing SdrDragEntries but only their recreation, a recreation
- // after every move is needed in this mode. Delete existing
- // SdrDragEntries here to force their recreation in the following Show().
+ // existing SdrDragEntries but only their recreation, a recreation
+ // after every move is needed in this mode. Delete existing
+ // SdrDragEntries here to force their recreation in the following Show().
clearSdrDragEntries();
// delete current clone (after the last reference to it is deleted above)
@@ -1377,18 +1375,18 @@ void SdrDragObjOwn::MoveSdrDrag(const Point& rNoSnapPnt)
mpClone = pObj->getFullDragClone();
mpClone->applySpecialDrag(DragStat());
- // #120999# AutoGrowWidth may change for SdrTextObj due to the automatism used
- // with bDisableAutoWidthOnDragging, so not only geometry changes but
- // also this (pretty indirect) property change is possible. If it gets
- // changed, it needs to be copied to the original since nothing will
- // happen when it only changes in the drag clone
- const bool bOldAutoGrowWidth(((SdrTextAutoGrowWidthItem&)pObj->GetMergedItem(SDRATTR_TEXT_AUTOGROWWIDTH)).GetValue());
- const bool bNewAutoGrowWidth(((SdrTextAutoGrowWidthItem&)mpClone->GetMergedItem(SDRATTR_TEXT_AUTOGROWWIDTH)).GetValue());
-
- if(bOldAutoGrowWidth != bNewAutoGrowWidth)
- {
- GetDragObj()->SetMergedItem(SdrTextAutoGrowWidthItem(bNewAutoGrowWidth));
- }
+ // #120999# AutoGrowWidth may change for SdrTextObj due to the automatism used
+ // with bDisableAutoWidthOnDragging, so not only geometry changes but
+ // also this (pretty indirect) property change is possible. If it gets
+ // changed, it needs to be copied to the original since nothing will
+ // happen when it only changes in the drag clone
+ const bool bOldAutoGrowWidth(((SdrTextAutoGrowWidthItem&)pObj->GetMergedItem(SDRATTR_TEXT_AUTOGROWWIDTH)).GetValue());
+ const bool bNewAutoGrowWidth(((SdrTextAutoGrowWidthItem&)mpClone->GetMergedItem(SDRATTR_TEXT_AUTOGROWWIDTH)).GetValue());
+
+ if(bOldAutoGrowWidth != bNewAutoGrowWidth)
+ {
+ GetDragObj()->SetMergedItem(SdrTextAutoGrowWidthItem(bNewAutoGrowWidth));
+ }
}
Show();
@@ -1413,21 +1411,21 @@ bool SdrDragObjOwn::EndSdrDrag(bool /*bCopy*/)
if( bUndo )
{
- if(!getSdrDragView().IsInsObjPoint() && pObj->IsInserted() )
+ if(!getSdrDragView().IsInsObjPoint() && pObj->IsInserted() )
{
if (DragStat().IsEndDragChangesAttributes())
{
pUndo=getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj);
-
+
if (DragStat().IsEndDragChangesGeoAndAttributes())
{
- vConnectorUndoActions = getSdrDragView().CreateConnectorUndo( *pObj );
+ vConnectorUndoActions = getSdrDragView().CreateConnectorUndo( *pObj );
pUndo2 = getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj);
}
}
else
{
- vConnectorUndoActions = getSdrDragView().CreateConnectorUndo( *pObj );
+ vConnectorUndoActions = getSdrDragView().CreateConnectorUndo( *pObj );
pUndo= getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj);
}
}
@@ -1442,40 +1440,40 @@ bool SdrDragObjOwn::EndSdrDrag(bool /*bCopy*/)
}
}
- // evtl. use opertator= for setting changed object data (do not change selection in
- // view, this will destroy the interactor). This is possible since a clone is now
- // directly modified by the modifiers. Only SdrTableObj is adding own UNDOs
- // in it's SdrTableObj::endSpecialDrag, so currently not possible. OTOH it uses
- // a CreateUndoGeoObject() so maybe setting SetEndDragChangesAttributes is okay. I
- // will test this now
- Rectangle aBoundRect0;
+ // evtl. use operator= for setting changed object data (do not change selection in
+ // view, this will destroy the interactor). This is possible since a clone is now
+ // directly modified by the modifiers. Only SdrTableObj is adding own UNDOs
+ // in it's SdrTableObj::endSpecialDrag, so currently not possible. OTOH it uses
+ // a CreateUndoGeoObject() so maybe setting SetEndDragChangesAttributes is okay. I
+ // will test this now
+ Rectangle aBoundRect0;
- if(pObj->GetUserCall())
- {
- aBoundRect0 = pObj->GetLastBoundRect();
- }
+ if(pObj->GetUserCall())
+ {
+ aBoundRect0 = pObj->GetLastBoundRect();
+ }
- bRet = pObj->applySpecialDrag(DragStat());
-
- if(bRet)
- {
- pObj->SetChanged();
- pObj->BroadcastObjectChange();
- pObj->SendUserCall( SDRUSERCALL_RESIZE, aBoundRect0 );
- }
+ bRet = pObj->applySpecialDrag(DragStat());
- if(bRet)
+ if(bRet)
+ {
+ pObj->SetChanged();
+ pObj->BroadcastObjectChange();
+ pObj->SendUserCall( SDRUSERCALL_RESIZE, aBoundRect0 );
+ }
+
+ if(bRet)
{
if( bUndo )
{
getSdrDragView().AddUndoActions( vConnectorUndoActions );
-
+
if ( pUndo )
{
getSdrDragView().AddUndo(pUndo);
}
- if ( pUndo2 )
+ if ( pUndo2 )
{
getSdrDragView().AddUndo(pUndo2);
}
@@ -1486,12 +1484,12 @@ bool SdrDragObjOwn::EndSdrDrag(bool /*bCopy*/)
if( bUndo )
{
std::vector< SdrUndoAction* >::iterator vConnectorUndoIter( vConnectorUndoActions.begin() );
-
+
while( vConnectorUndoIter != vConnectorUndoActions.end() )
{
delete *vConnectorUndoIter++;
}
-
+
delete pUndo;
delete pUndo2;
}
@@ -1501,18 +1499,18 @@ bool SdrDragObjOwn::EndSdrDrag(bool /*bCopy*/)
getSdrDragView().EndUndo();
}
- return bRet;
+ return bRet;
}
Pointer SdrDragObjOwn::GetSdrDragPointer() const
{
const SdrHdl* pHdl=GetDragHdl();
- if (pHdl)
+ if (pHdl)
{
return pHdl->GetPointer();
}
-
+
return Pointer(POINTER_MOVE);
}
@@ -1522,17 +1520,17 @@ TYPEINIT1(SdrDragMove,SdrDragMethod);
void SdrDragMove::createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool /*bModify*/)
{
- // for SdrDragMove, use current Primitive2DSequence of SdrObject visualisation
- // in given ObjectContact directly
- sdr::contact::ViewContact& rVC = rOriginal.GetViewContact();
- sdr::contact::ViewObjectContact& rVOC = rVC.GetViewObjectContact(rObjectContact);
- sdr::contact::DisplayInfo aDisplayInfo;
+ // for SdrDragMove, use current Primitive2DSequence of SdrObject visualisation
+ // in given ObjectContact directly
+ sdr::contact::ViewContact& rVC = rOriginal.GetViewContact();
+ sdr::contact::ViewObjectContact& rVOC = rVC.GetViewObjectContact(rObjectContact);
+ sdr::contact::DisplayInfo aDisplayInfo;
- // Do not use the last ViewPort set at the OC from the last ProcessDisplay(),
- // here we want the complete primitive sequence without visibility clippings
- rObjectContact.resetViewPort();
+ // Do not use the last ViewPort set at the OC from the last ProcessDisplay(),
+ // here we want the complete primitive sequence without visibility clippings
+ rObjectContact.resetViewPort();
- addSdrDragEntry(new SdrDragEntryPrimitive2DSequence(rVOC.getPrimitive2DSequenceHierarchy(aDisplayInfo), true));
+ addSdrDragEntry(new SdrDragEntryPrimitive2DSequence(rVOC.getPrimitive2DSequenceHierarchy(aDisplayInfo), true));
}
void SdrDragMove::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
@@ -1541,7 +1539,7 @@ void SdrDragMove::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
}
SdrDragMove::SdrDragMove(SdrDragView& rNewView)
-: SdrDragMethod(rNewView)
+: SdrDragMethod(rNewView)
{
setMoveOnly(true);
}
@@ -1558,10 +1556,10 @@ void SdrDragMove::TakeSdrDragComment(XubString& rStr) const
getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDY(), aStr);
rStr += aStr;
rStr += sal_Unicode(')');
-
- if(getSdrDragView().IsDragWithCopy())
+
+ if(getSdrDragView().IsDragWithCopy())
{
- if(!getSdrDragView().IsInsObjPoint() && !getSdrDragView().IsInsGluePoint())
+ if(!getSdrDragView().IsInsObjPoint() && !getSdrDragView().IsInsGluePoint())
{
rStr += ImpGetResStr(STR_EditWithCopy);
}
@@ -1578,7 +1576,7 @@ bool SdrDragMove::BeginSdrDrag()
basegfx::B2DHomMatrix SdrDragMove::getCurrentTransformation()
{
- return basegfx::tools::createTranslateB2DHomMatrix(DragStat().GetDX(), DragStat().GetDY());
+ return basegfx::tools::createTranslateB2DHomMatrix(DragStat().GetDX(), DragStat().GetDY());
}
void SdrDragMove::ImpCheckSnap(const Point& rPt)
@@ -1587,32 +1585,32 @@ void SdrDragMove::ImpCheckSnap(const Point& rPt)
sal_uInt16 nRet=SnapPos(aPt);
aPt-=rPt;
- if ((nRet & SDRSNAP_XSNAPPED) !=0)
+ if ((nRet & SDRSNAP_XSNAPPED) !=0)
{
- if (bXSnapped)
+ if (bXSnapped)
{
- if (Abs(aPt.X())<Abs(nBestXSnap))
+ if (Abs(aPt.X())<Abs(nBestXSnap))
{
nBestXSnap=aPt.X();
}
- }
- else
+ }
+ else
{
nBestXSnap=aPt.X();
bXSnapped=true;
}
}
- if ((nRet & SDRSNAP_YSNAPPED) !=0)
+ if ((nRet & SDRSNAP_YSNAPPED) !=0)
{
- if (bYSnapped)
+ if (bYSnapped)
{
- if (Abs(aPt.Y())<Abs(nBestYSnap))
+ if (Abs(aPt.Y())<Abs(nBestYSnap))
{
nBestYSnap=aPt.Y();
}
- }
- else
+ }
+ else
{
nBestYSnap=aPt.Y();
bYSnapped=true;
@@ -1636,98 +1634,98 @@ void SdrDragMove::MoveSdrDrag(const Point& rNoSnapPnt_)
Point aRO(aRU.X(),aLO.Y());
ImpCheckSnap(aLO);
- if (!getSdrDragView().IsMoveSnapOnlyTopLeft())
+ if (!getSdrDragView().IsMoveSnapOnlyTopLeft())
{
ImpCheckSnap(aRO);
ImpCheckSnap(aLU);
ImpCheckSnap(aRU);
}
-
+
Point aPnt(aNoSnapPnt.X()+nBestXSnap,aNoSnapPnt.Y()+nBestYSnap);
bool bOrtho=getSdrDragView().IsOrtho();
-
- if (bOrtho)
+
+ if (bOrtho)
OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
- if (DragStat().CheckMinMoved(aNoSnapPnt))
+ if (DragStat().CheckMinMoved(aNoSnapPnt))
{
Point aPt1(aPnt);
Rectangle aLR(getSdrDragView().GetWorkArea());
bool bWorkArea=!aLR.IsEmpty();
bool bDragLimit=IsDragLimit();
-
- if (bDragLimit || bWorkArea)
+
+ if (bDragLimit || bWorkArea)
{
Rectangle aSR2(GetMarkedRect());
Point aD(aPt1-DragStat().GetStart());
-
- if (bDragLimit)
+
+ if (bDragLimit)
{
Rectangle aR2(GetDragLimitRect());
-
- if (bWorkArea)
+
+ if (bWorkArea)
aLR.Intersection(aR2);
- else
+ else
aLR=aR2;
}
- if (aSR2.Left()>aLR.Left() || aSR2.Right()<aLR.Right())
+ if (aSR2.Left()>aLR.Left() || aSR2.Right()<aLR.Right())
{ // ist ueberhaupt Platz zum verschieben?
aSR2.Move(aD.X(),0);
-
- if (aSR2.Left()<aLR.Left())
+
+ if (aSR2.Left()<aLR.Left())
{
aPt1.X()-=aSR2.Left()-aLR.Left();
- }
- else if (aSR2.Right()>aLR.Right())
+ }
+ else if (aSR2.Right()>aLR.Right())
{
aPt1.X()-=aSR2.Right()-aLR.Right();
}
- }
- else
+ }
+ else
aPt1.X()=DragStat().GetStart().X(); // kein Platz zum verschieben
- if (aSR2.Top()>aLR.Top() || aSR2.Bottom()<aLR.Bottom())
+ if (aSR2.Top()>aLR.Top() || aSR2.Bottom()<aLR.Bottom())
{ // ist ueberhaupt Platz zum verschieben?
aSR2.Move(0,aD.Y());
-
- if (aSR2.Top()<aLR.Top())
+
+ if (aSR2.Top()<aLR.Top())
{
aPt1.Y()-=aSR2.Top()-aLR.Top();
- }
- else if (aSR2.Bottom()>aLR.Bottom())
+ }
+ else if (aSR2.Bottom()>aLR.Bottom())
{
aPt1.Y()-=aSR2.Bottom()-aLR.Bottom();
}
- }
- else
+ }
+ else
aPt1.Y()=DragStat().GetStart().Y(); // kein Platz zum verschieben
}
- if (getSdrDragView().IsDraggingGluePoints())
+ if (getSdrDragView().IsDraggingGluePoints())
{ // Klebepunkte aufs BoundRect des Obj limitieren
aPt1-=DragStat().GetStart();
const SdrMarkList& rML=GetMarkedObjectList();
sal_uLong nMarkAnz=rML.GetMarkCount();
-
- for (sal_uLong nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++)
+
+ for (sal_uLong nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++)
{
const SdrMark* pM=rML.GetMark(nMarkNum);
const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
sal_uLong nPtAnz=pPts==NULL ? 0 : pPts->GetCount();
-
- if (nPtAnz!=0)
+
+ if (nPtAnz!=0)
{
const SdrObject* pObj=pM->GetMarkedSdrObj();
const SdrGluePointList* pGPL=pObj->GetGluePointList();
Rectangle aBound(pObj->GetCurrentBoundRect());
- for (sal_uLong nPtNum=0; nPtNum<nPtAnz; nPtNum++)
+ for (sal_uLong nPtNum=0; nPtNum<nPtAnz; nPtNum++)
{
sal_uInt16 nId=pPts->GetObject(nPtNum);
sal_uInt16 nGlueNum=pGPL->FindGluePoint(nId);
-
- if (nGlueNum!=SDRGLUEPOINT_NOTFOUND)
+
+ if (nGlueNum!=SDRGLUEPOINT_NOTFOUND)
{
Point aPt((*pGPL)[nGlueNum].GetAbsolutePos(*pObj));
aPt+=aPt1; // soviel soll verschoben werden
@@ -1743,10 +1741,10 @@ void SdrDragMove::MoveSdrDrag(const Point& rNoSnapPnt_)
aPt1+=DragStat().GetStart();
}
- if (bOrtho)
+ if (bOrtho)
OrthoDistance8(DragStat().GetStart(),aPt1,false);
- if (aPt1!=DragStat().GetNow())
+ if (aPt1!=DragStat().GetNow())
{
Hide();
DragStat().NextMove(aPt1);
@@ -1762,32 +1760,32 @@ bool SdrDragMove::EndSdrDrag(bool bCopy)
{
Hide();
- if (getSdrDragView().IsInsObjPoint() || getSdrDragView().IsInsGluePoint())
+ if (getSdrDragView().IsInsObjPoint() || getSdrDragView().IsInsGluePoint())
bCopy=false;
- if (IsDraggingPoints())
+ if (IsDraggingPoints())
{
getSdrDragView().MoveMarkedPoints(Size(DragStat().GetDX(),DragStat().GetDY()),bCopy);
- }
- else if (IsDraggingGluePoints())
+ }
+ else if (IsDraggingGluePoints())
{
getSdrDragView().MoveMarkedGluePoints(Size(DragStat().GetDX(),DragStat().GetDY()),bCopy);
- }
- else
+ }
+ else
{
getSdrDragView().MoveMarkedObj(Size(DragStat().GetDX(),DragStat().GetDY()),bCopy);
}
-
+
return true;
}
Pointer SdrDragMove::GetSdrDragPointer() const
{
- if (IsDraggingPoints() || IsDraggingGluePoints())
+ if (IsDraggingPoints() || IsDraggingGluePoints())
{
return Pointer(POINTER_MOVEPOINT);
- }
- else
+ }
+ else
{
return Pointer(POINTER_MOVE);
}
@@ -1798,9 +1796,9 @@ Pointer SdrDragMove::GetSdrDragPointer() const
TYPEINIT1(SdrDragResize,SdrDragMethod);
SdrDragResize::SdrDragResize(SdrDragView& rNewView)
-: SdrDragMethod(rNewView),
- aXFact(1,1),
- aYFact(1,1)
+: SdrDragMethod(rNewView),
+ aXFact(1,1),
+ aYFact(1,1)
{
}
@@ -1811,37 +1809,37 @@ void SdrDragResize::TakeSdrDragComment(XubString& rStr) const
Fraction aFact1(1,1);
Point aStart(DragStat().GetStart());
Point aRef(DragStat().GetRef1());
- sal_Int32 nXDiv(aStart.X() - aRef.X());
-
- if(!nXDiv)
+ sal_Int32 nXDiv(aStart.X() - aRef.X());
+
+ if(!nXDiv)
nXDiv = 1;
- sal_Int32 nYDiv(aStart.Y() - aRef.Y());
-
- if(!nYDiv)
+ sal_Int32 nYDiv(aStart.Y() - aRef.Y());
+
+ if(!nYDiv)
nYDiv = 1;
bool bX(aXFact != aFact1 && Abs(nXDiv) > 1);
bool bY(aYFact != aFact1 && Abs(nYDiv) > 1);
-
- if(bX || bY)
+
+ if(bX || bY)
{
XubString aStr;
rStr.AppendAscii(" (");
-
- if(bX)
+
+ if(bX)
{
- if(!bEqual)
+ if(!bEqual)
rStr.AppendAscii("x=");
getSdrDragView().GetModel()->TakePercentStr(aXFact, aStr);
rStr += aStr;
}
- if(bY && !bEqual)
+ if(bY && !bEqual)
{
- if(bX)
+ if(bX)
rStr += sal_Unicode(' ');
rStr.AppendAscii("y=");
@@ -1852,7 +1850,7 @@ void SdrDragResize::TakeSdrDragComment(XubString& rStr) const
rStr += sal_Unicode(')');
}
- if(getSdrDragView().IsDragWithCopy())
+ if(getSdrDragView().IsDragWithCopy())
rStr += ImpGetResStr(STR_EditWithCopy);
}
@@ -1861,7 +1859,7 @@ bool SdrDragResize::BeginSdrDrag()
SdrHdlKind eRefHdl=HDL_MOVE;
SdrHdl* pRefHdl=NULL;
- switch (GetDragHdlKind())
+ switch (GetDragHdlKind())
{
case HDL_UPLFT: eRefHdl=HDL_LWRGT; break;
case HDL_UPPER: eRefHdl=HDL_LOWER; DragStat().SetHorFixed(true); break;
@@ -1873,24 +1871,24 @@ bool SdrDragResize::BeginSdrDrag()
case HDL_LWRGT: eRefHdl=HDL_UPLFT; break;
default: break;
}
-
- if (eRefHdl!=HDL_MOVE)
+
+ if (eRefHdl!=HDL_MOVE)
pRefHdl=GetHdlList().GetHdl(eRefHdl);
- if (pRefHdl!=NULL && !getSdrDragView().IsResizeAtCenter())
+ if (pRefHdl!=NULL && !getSdrDragView().IsResizeAtCenter())
{
DragStat().Ref1()=pRefHdl->GetPos();
- }
- else
+ }
+ else
{
SdrHdl* pRef1=GetHdlList().GetHdl(HDL_UPLFT);
SdrHdl* pRef2=GetHdlList().GetHdl(HDL_LWRGT);
-
- if (pRef1!=NULL && pRef2!=NULL)
+
+ if (pRef1!=NULL && pRef2!=NULL)
{
DragStat().Ref1()=Rectangle(pRef1->GetPos(),pRef2->GetPos()).Center();
- }
- else
+ }
+ else
{
DragStat().Ref1()=GetMarkedRect().Center();
}
@@ -1903,8 +1901,8 @@ bool SdrDragResize::BeginSdrDrag()
basegfx::B2DHomMatrix SdrDragResize::getCurrentTransformation()
{
- basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix(
- -DragStat().Ref1().X(), -DragStat().Ref1().Y()));
+ basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix(
+ -DragStat().Ref1().X(), -DragStat().Ref1().Y()));
aRetval.scale(aXFact, aYFact);
aRetval.translate(DragStat().Ref1().X(), DragStat().Ref1().Y());
@@ -1921,59 +1919,59 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
bool bWorkArea=!aLR.IsEmpty();
bool bDragLimit=IsDragLimit();
- if (bDragLimit || bWorkArea)
+ if (bDragLimit || bWorkArea)
{
Rectangle aSR(GetMarkedRect());
-
- if (bDragLimit)
+
+ if (bDragLimit)
{
Rectangle aR2(GetDragLimitRect());
-
- if (bWorkArea)
+
+ if (bWorkArea)
aLR.Intersection(aR2);
- else
+ else
aLR=aR2;
}
- if (aPnt.X()<aLR.Left())
+ if (aPnt.X()<aLR.Left())
aPnt.X()=aLR.Left();
- else if (aPnt.X()>aLR.Right())
+ else if (aPnt.X()>aLR.Right())
aPnt.X()=aLR.Right();
- if (aPnt.Y()<aLR.Top())
+ if (aPnt.Y()<aLR.Top())
aPnt.Y()=aLR.Top();
- else if (aPnt.Y()>aLR.Bottom())
+ else if (aPnt.Y()>aLR.Bottom())
aPnt.Y()=aLR.Bottom();
- if (aRef.X()>aSR.Left())
+ if (aRef.X()>aSR.Left())
{
Fraction aMax(aRef.X()-aLR.Left(),aRef.X()-aSR.Left());
-
- if (aMax<aMaxFact)
+
+ if (aMax<aMaxFact)
aMaxFact=aMax;
}
- if (aRef.X()<aSR.Right())
+ if (aRef.X()<aSR.Right())
{
Fraction aMax(aLR.Right()-aRef.X(),aSR.Right()-aRef.X());
-
- if (aMax<aMaxFact)
+
+ if (aMax<aMaxFact)
aMaxFact=aMax;
}
- if (aRef.Y()>aSR.Top())
+ if (aRef.Y()>aSR.Top())
{
Fraction aMax(aRef.Y()-aLR.Top(),aRef.Y()-aSR.Top());
-
- if (aMax<aMaxFact)
+
+ if (aMax<aMaxFact)
aMaxFact=aMax;
}
- if (aRef.Y()<aSR.Bottom())
+ if (aRef.Y()<aSR.Bottom())
{
Fraction aMax(aLR.Bottom()-aRef.Y(),aSR.Bottom()-aRef.Y());
-
- if (aMax<aMaxFact)
+
+ if (aMax<aMaxFact)
aMaxFact=aMax;
}
}
@@ -1983,73 +1981,73 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
long nXMul=aPnt.X()-aRef.X();
long nYMul=aPnt.Y()-aRef.Y();
- if (nXDiv<0)
- {
- nXDiv=-nXDiv;
- nXMul=-nXMul;
+ if (nXDiv<0)
+ {
+ nXDiv=-nXDiv;
+ nXMul=-nXMul;
}
- if (nYDiv<0)
- {
- nYDiv=-nYDiv;
- nYMul=-nYMul;
+ if (nYDiv<0)
+ {
+ nYDiv=-nYDiv;
+ nYMul=-nYMul;
}
bool bXNeg=nXMul<0; if (bXNeg) nXMul=-nXMul;
bool bYNeg=nYMul<0; if (bYNeg) nYMul=-nYMul;
bool bOrtho=getSdrDragView().IsOrtho() || !getSdrDragView().IsResizeAllowed(false);
-
- if (!DragStat().IsHorFixed() && !DragStat().IsVerFixed())
+
+ if (!DragStat().IsHorFixed() && !DragStat().IsVerFixed())
{
- if (Abs(nXDiv)<=1 || Abs(nYDiv)<=1)
+ if (Abs(nXDiv)<=1 || Abs(nYDiv)<=1)
bOrtho=false;
- if (bOrtho)
+ if (bOrtho)
{
- if ((Fraction(nXMul,nXDiv)>Fraction(nYMul,nYDiv)) !=getSdrDragView().IsBigOrtho())
+ if ((Fraction(nXMul,nXDiv)>Fraction(nYMul,nYDiv)) !=getSdrDragView().IsBigOrtho())
{
nXMul=nYMul;
nXDiv=nYDiv;
- }
- else
+ }
+ else
{
nYMul=nXMul;
nYDiv=nXDiv;
}
}
- }
- else
+ }
+ else
{
- if (bOrtho)
+ if (bOrtho)
{
- if (DragStat().IsHorFixed())
- {
- bXNeg=false;
- nXMul=nYMul;
- nXDiv=nYDiv;
+ if (DragStat().IsHorFixed())
+ {
+ bXNeg=false;
+ nXMul=nYMul;
+ nXDiv=nYDiv;
}
-
- if (DragStat().IsVerFixed())
- {
- bYNeg=false;
- nYMul=nXMul;
- nYDiv=nXDiv;
+
+ if (DragStat().IsVerFixed())
+ {
+ bYNeg=false;
+ nYMul=nXMul;
+ nYDiv=nXDiv;
}
- }
- else
+ }
+ else
{
- if (DragStat().IsHorFixed())
- {
- bXNeg=false;
- nXMul=1;
- nXDiv=1;
+ if (DragStat().IsHorFixed())
+ {
+ bXNeg=false;
+ nXMul=1;
+ nXDiv=1;
}
-
- if (DragStat().IsVerFixed())
- {
- bYNeg=false;
- nYMul=1;
- nYDiv=1;
+
+ if (DragStat().IsVerFixed())
+ {
+ bYNeg=false;
+ nYMul=1;
+ nYDiv=1;
}
}
}
@@ -2057,31 +2055,31 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
Fraction aNeuXFact(nXMul,nXDiv);
Fraction aNeuYFact(nYMul,nYDiv);
- if (bOrtho)
+ if (bOrtho)
{
- if (aNeuXFact>aMaxFact)
+ if (aNeuXFact>aMaxFact)
{
aNeuXFact=aMaxFact;
aNeuYFact=aMaxFact;
}
-
- if (aNeuYFact>aMaxFact)
+
+ if (aNeuYFact>aMaxFact)
{
aNeuXFact=aMaxFact;
aNeuYFact=aMaxFact;
}
}
- if (bXNeg)
+ if (bXNeg)
aNeuXFact=Fraction(-aNeuXFact.GetNumerator(),aNeuXFact.GetDenominator());
- if (bYNeg)
+ if (bYNeg)
aNeuYFact=Fraction(-aNeuYFact.GetNumerator(),aNeuYFact.GetDenominator());
- if (DragStat().CheckMinMoved(aPnt))
+ if (DragStat().CheckMinMoved(aPnt))
{
if ((!DragStat().IsHorFixed() && aPnt.X()!=DragStat().GetNow().X()) ||
- (!DragStat().IsVerFixed() && aPnt.Y()!=DragStat().GetNow().Y()))
+ (!DragStat().IsVerFixed() && aPnt.Y()!=DragStat().GetNow().Y()))
{
Hide();
DragStat().NextMove(aPnt);
@@ -2094,22 +2092,22 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
void SdrDragResize::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
{
- rTarget.Resize(DragStat().Ref1(),aXFact,aYFact);
+ rTarget.Resize(DragStat().Ref1(),aXFact,aYFact);
}
bool SdrDragResize::EndSdrDrag(bool bCopy)
{
Hide();
- if (IsDraggingPoints())
+ if (IsDraggingPoints())
{
getSdrDragView().ResizeMarkedPoints(DragStat().Ref1(),aXFact,aYFact,bCopy);
- }
- else if (IsDraggingGluePoints())
+ }
+ else if (IsDraggingGluePoints())
{
getSdrDragView().ResizeMarkedGluePoints(DragStat().Ref1(),aXFact,aYFact,bCopy);
- }
- else
+ }
+ else
{
getSdrDragView().ResizeMarkedObj(DragStat().Ref1(),aXFact,aYFact,bCopy);
}
@@ -2121,11 +2119,11 @@ Pointer SdrDragResize::GetSdrDragPointer() const
{
const SdrHdl* pHdl=GetDragHdl();
- if (pHdl!=NULL)
+ if (pHdl!=NULL)
{
return pHdl->GetPointer();
}
-
+
return Pointer(POINTER_MOVE);
}
@@ -2144,7 +2142,7 @@ SdrDragRotate::SdrDragRotate(SdrDragView& rNewView)
nCos(1.0),
nWink0(0),
nWink(0),
- bRight(false)
+ bRight(false)
{
}
@@ -2154,8 +2152,8 @@ void SdrDragRotate::TakeSdrDragComment(XubString& rStr) const
rStr.AppendAscii(" (");
XubString aStr;
sal_Int32 nTmpWink(NormAngle360(nWink));
-
- if(bRight && nWink)
+
+ if(bRight && nWink)
{
nTmpWink -= 36000;
}
@@ -2164,7 +2162,7 @@ void SdrDragRotate::TakeSdrDragComment(XubString& rStr) const
rStr += aStr;
rStr += sal_Unicode(')');
- if(getSdrDragView().IsDragWithCopy())
+ if(getSdrDragView().IsDragWithCopy())
rStr += ImpGetResStr(STR_EditWithCopy);
}
@@ -2172,14 +2170,14 @@ bool SdrDragRotate::BeginSdrDrag()
{
SdrHdl* pH=GetHdlList().GetHdl(HDL_REF1);
- if (pH!=NULL)
+ if (pH!=NULL)
{
Show();
DragStat().Ref1()=pH->GetPos();
nWink0=GetAngle(DragStat().GetStart()-DragStat().GetRef1());
return true;
- }
- else
+ }
+ else
{
DBG_ERROR("SdrDragRotate::BeginSdrDrag(): Kein Referenzpunkt-Handle gefunden");
return false;
@@ -2188,43 +2186,43 @@ bool SdrDragRotate::BeginSdrDrag()
basegfx::B2DHomMatrix SdrDragRotate::getCurrentTransformation()
{
- return basegfx::tools::createRotateAroundPoint(
- DragStat().GetRef1().X(), DragStat().GetRef1().Y(),
- -atan2(nSin, nCos));
+ return basegfx::tools::createRotateAroundPoint(
+ DragStat().GetRef1().X(), DragStat().GetRef1().Y(),
+ -atan2(nSin, nCos));
}
void SdrDragRotate::MoveSdrDrag(const Point& rPnt_)
{
Point aPnt(rPnt_);
- if (DragStat().CheckMinMoved(aPnt))
+ if (DragStat().CheckMinMoved(aPnt))
{
long nNeuWink=NormAngle360(GetAngle(aPnt-DragStat().GetRef1())-nWink0);
long nSA=0;
-
- if (getSdrDragView().IsAngleSnapEnabled())
+
+ if (getSdrDragView().IsAngleSnapEnabled())
nSA=getSdrDragView().GetSnapAngle();
- if (!getSdrDragView().IsRotateAllowed(false))
+ if (!getSdrDragView().IsRotateAllowed(false))
nSA=9000;
- if (nSA!=0)
+ if (nSA!=0)
{ // Winkelfang
nNeuWink+=nSA/2;
nNeuWink/=nSA;
nNeuWink*=nSA;
}
-
+
nNeuWink=NormAngle180(nNeuWink);
-
- if (nWink!=nNeuWink)
+
+ if (nWink!=nNeuWink)
{
sal_uInt16 nSekt0=GetAngleSector(nWink);
sal_uInt16 nSekt1=GetAngleSector(nNeuWink);
-
- if (nSekt0==0 && nSekt1==3)
+
+ if (nSekt0==0 && nSekt1==3)
bRight=true;
- if (nSekt0==3 && nSekt1==0)
+ if (nSekt0==3 && nSekt1==0)
bRight=false;
nWink=nNeuWink;
@@ -2244,17 +2242,17 @@ bool SdrDragRotate::EndSdrDrag(bool bCopy)
{
Hide();
- if (nWink!=0)
+ if (nWink!=0)
{
- if (IsDraggingPoints())
+ if (IsDraggingPoints())
{
getSdrDragView().RotateMarkedPoints(DragStat().GetRef1(),nWink,bCopy);
- }
- else if (IsDraggingGluePoints())
+ }
+ else if (IsDraggingGluePoints())
{
getSdrDragView().RotateMarkedGluePoints(DragStat().GetRef1(),nWink,bCopy);
- }
- else
+ }
+ else
{
getSdrDragView().RotateMarkedObj(DragStat().GetRef1(),nWink,bCopy);
}
@@ -2280,7 +2278,7 @@ SdrDragShear::SdrDragShear(SdrDragView& rNewView, bool bSlant1)
bVertical(false),
bResize(false),
bUpSideDown(false),
- bSlant(bSlant1)
+ bSlant(bSlant1)
{
}
@@ -2288,21 +2286,21 @@ void SdrDragShear::TakeSdrDragComment(XubString& rStr) const
{
ImpTakeDescriptionStr(STR_DragMethShear, rStr);
rStr.AppendAscii(" (");
-
+
sal_Int32 nTmpWink(nWink);
-
- if(bUpSideDown)
+
+ if(bUpSideDown)
nTmpWink += 18000;
nTmpWink = NormAngle180(nTmpWink);
XubString aStr;
-
+
getSdrDragView().GetModel()->TakeWinkStr(nTmpWink, aStr);
rStr += aStr;
rStr += sal_Unicode(')');
-
- if(getSdrDragView().IsDragWithCopy())
+
+ if(getSdrDragView().IsDragWithCopy())
rStr += ImpGetResStr(STR_EditWithCopy);
}
@@ -2311,7 +2309,7 @@ bool SdrDragShear::BeginSdrDrag()
SdrHdlKind eRefHdl=HDL_MOVE;
SdrHdl* pRefHdl=NULL;
- switch (GetDragHdlKind())
+ switch (GetDragHdlKind())
{
case HDL_UPPER: eRefHdl=HDL_LOWER; break;
case HDL_LOWER: eRefHdl=HDL_UPPER; break;
@@ -2319,38 +2317,38 @@ bool SdrDragShear::BeginSdrDrag()
case HDL_RIGHT: eRefHdl=HDL_LEFT ; bVertical=true; break;
default: break;
}
-
- if (eRefHdl!=HDL_MOVE)
+
+ if (eRefHdl!=HDL_MOVE)
pRefHdl=GetHdlList().GetHdl(eRefHdl);
- if (pRefHdl!=NULL)
+ if (pRefHdl!=NULL)
{
DragStat().Ref1()=pRefHdl->GetPos();
nWink0=GetAngle(DragStat().GetStart()-DragStat().GetRef1());
- }
- else
+ }
+ else
{
DBG_ERROR("SdrDragShear::BeginSdrDrag(): Kein Referenzpunkt-Handle fuer Shear gefunden");
return false;
}
-
+
Show();
return true;
}
basegfx::B2DHomMatrix SdrDragShear::getCurrentTransformation()
{
- basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix(
- -DragStat().GetRef1().X(), -DragStat().GetRef1().Y()));
+ basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix(
+ -DragStat().GetRef1().X(), -DragStat().GetRef1().Y()));
- if (bResize)
+ if (bResize)
{
- if (bVertical)
+ if (bVertical)
{
aRetval.scale(aFact, 1.0);
aRetval.shearY(-nTan);
- }
- else
+ }
+ else
{
aRetval.scale(1.0, aFact);
aRetval.shearX(-nTan);
@@ -2364,27 +2362,27 @@ basegfx::B2DHomMatrix SdrDragShear::getCurrentTransformation()
void SdrDragShear::MoveSdrDrag(const Point& rPnt)
{
- if (DragStat().CheckMinMoved(rPnt))
+ if (DragStat().CheckMinMoved(rPnt))
{
bResize=!getSdrDragView().IsOrtho();
long nSA=0;
-
- if (getSdrDragView().IsAngleSnapEnabled())
+
+ if (getSdrDragView().IsAngleSnapEnabled())
nSA=getSdrDragView().GetSnapAngle();
Point aP0(DragStat().GetStart());
Point aPnt(rPnt);
Fraction aNeuFact(1,1);
-
+
// Wenn kein Winkelfang, dann ggf. Rasterfang (ausser bei Slant)
- if (nSA==0 && !bSlant)
+ if (nSA==0 && !bSlant)
aPnt=GetSnapPos(aPnt);
- if (!bSlant && !bResize)
+ if (!bSlant && !bResize)
{ // Shear ohne Resize
- if (bVertical)
- aPnt.X()=aP0.X();
- else
+ if (bVertical)
+ aPnt.X()=aP0.X();
+ else
aPnt.Y()=aP0.Y();
}
@@ -2393,35 +2391,35 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
long nNeuWink=0;
- if (bSlant)
+ if (bSlant)
{
nNeuWink=NormAngle180(-(GetAngle(aDif)-nWink0));
- if (bVertical)
+ if (bVertical)
nNeuWink=NormAngle180(-nNeuWink);
- }
- else
+ }
+ else
{
- if (bVertical)
+ if (bVertical)
nNeuWink=NormAngle180(GetAngle(aDif));
- else
+ else
nNeuWink=NormAngle180(-(GetAngle(aDif)-9000));
- if (nNeuWink<-9000 || nNeuWink>9000)
+ if (nNeuWink<-9000 || nNeuWink>9000)
nNeuWink=NormAngle180(nNeuWink+18000);
- if (bResize)
+ if (bResize)
{
Point aPt2(aPnt);
-
- if (nSA!=0)
+
+ if (nSA!=0)
aPt2=GetSnapPos(aPnt); // den also in jedem Falle fangen
- if (bVertical)
+ if (bVertical)
{
aNeuFact=Fraction(aPt2.X()-aRef.X(),aP0.X()-aRef.X());
- }
- else
+ }
+ else
{
aNeuFact=Fraction(aPt2.Y()-aRef.Y(),aP0.Y()-aRef.Y());
}
@@ -2430,10 +2428,10 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
bool bNeg=nNeuWink<0;
- if (bNeg)
+ if (bNeg)
nNeuWink=-nNeuWink;
- if (nSA!=0)
+ if (nSA!=0)
{ // Winkelfang
nNeuWink+=nSA/2;
nNeuWink/=nSA;
@@ -2443,7 +2441,7 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
nNeuWink=NormAngle360(nNeuWink);
bUpSideDown=nNeuWink>9000 && nNeuWink<27000;
- if (bSlant)
+ if (bSlant)
{ // Resize fuer Slant berechnen
// Mit Winkelfang jedoch ohne 89deg Begrenzung
long nTmpWink=nNeuWink;
@@ -2455,13 +2453,13 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
Kuerzen(aFact,10); // 3 Dezimalstellen sollten reichen
}
- if (nNeuWink>8900)
+ if (nNeuWink>8900)
nNeuWink=8900;
- if (bNeg)
+ if (bNeg)
nNeuWink=-nNeuWink;
- if (nWink!=nNeuWink || aFact!=aNeuFact)
+ if (nWink!=nNeuWink || aFact!=aNeuFact)
{
nWink=nNeuWink;
aFact=aNeuFact;
@@ -2478,19 +2476,19 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
void SdrDragShear::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
{
- if (bResize)
+ if (bResize)
{
- if (bVertical)
+ if (bVertical)
{
- rTarget.Resize(DragStat().GetRef1(),aFact,Fraction(1,1));
- }
- else
+ rTarget.Resize(DragStat().GetRef1(),aFact,Fraction(1,1));
+ }
+ else
{
- rTarget.Resize(DragStat().GetRef1(),Fraction(1,1),aFact);
+ rTarget.Resize(DragStat().GetRef1(),Fraction(1,1),aFact);
}
}
- if (nWink!=0)
+ if (nWink!=0)
{
rTarget.Shear(DragStat().GetRef1(),nWink,tan(nWink*nPi180),bVertical);
}
@@ -2500,42 +2498,42 @@ bool SdrDragShear::EndSdrDrag(bool bCopy)
{
Hide();
- if (bResize && aFact==Fraction(1,1))
+ if (bResize && aFact==Fraction(1,1))
bResize=false;
-
- if (nWink!=0 || bResize)
+
+ if (nWink!=0 || bResize)
{
- if (nWink!=0 && bResize)
+ if (nWink!=0 && bResize)
{
XubString aStr;
ImpTakeDescriptionStr(STR_EditShear,aStr);
-
- if (bCopy)
+
+ if (bCopy)
aStr+=ImpGetResStr(STR_EditWithCopy);
getSdrDragView().BegUndo(aStr);
}
- if (bResize)
+ if (bResize)
{
- if (bVertical)
+ if (bVertical)
{
getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),aFact,Fraction(1,1),bCopy);
- }
- else
+ }
+ else
{
getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),Fraction(1,1),aFact,bCopy);
}
-
+
bCopy=false;
}
- if (nWink!=0)
+ if (nWink!=0)
{
getSdrDragView().ShearMarkedObj(DragStat().GetRef1(),nWink,bVertical,bCopy);
}
- if (nWink!=0 && bResize)
+ if (nWink!=0 && bResize)
getSdrDragView().EndUndo();
return true;
@@ -2546,9 +2544,9 @@ bool SdrDragShear::EndSdrDrag(bool bCopy)
Pointer SdrDragShear::GetSdrDragPointer() const
{
- if (bVertical)
+ if (bVertical)
return Pointer(POINTER_VSHEAR);
- else
+ else
return Pointer(POINTER_HSHEAR);
}
@@ -2558,9 +2556,9 @@ TYPEINIT1(SdrDragMirror,SdrDragMethod);
void SdrDragMirror::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
{
- if(bMirrored)
+ if(bMirrored)
{
- rTarget.Mirror(DragStat().GetRef1(), DragStat().GetRef2());
+ rTarget.Mirror(DragStat().GetRef1(), DragStat().GetRef2());
}
}
@@ -2568,7 +2566,7 @@ SdrDragMirror::SdrDragMirror(SdrDragView& rNewView)
: SdrDragMethod(rNewView),
nWink(0),
bMirrored(false),
- bSide0(false)
+ bSide0(false)
{
}
@@ -2583,16 +2581,16 @@ bool SdrDragMirror::ImpCheckSide(const Point& rPnt) const
void SdrDragMirror::TakeSdrDragComment(XubString& rStr) const
{
- if (aDif.X()==0)
+ if (aDif.X()==0)
ImpTakeDescriptionStr(STR_DragMethMirrorHori,rStr);
- else if (aDif.Y()==0)
+ else if (aDif.Y()==0)
ImpTakeDescriptionStr(STR_DragMethMirrorVert,rStr);
- else if (Abs(aDif.X())==Abs(aDif.Y()))
+ else if (Abs(aDif.X())==Abs(aDif.Y()))
ImpTakeDescriptionStr(STR_DragMethMirrorDiag,rStr);
- else
+ else
ImpTakeDescriptionStr(STR_DragMethMirrorFree,rStr);
-
- if (getSdrDragView().IsDragWithCopy())
+
+ if (getSdrDragView().IsDragWithCopy())
rStr+=ImpGetResStr(STR_EditWithCopy);
}
@@ -2601,7 +2599,7 @@ bool SdrDragMirror::BeginSdrDrag()
SdrHdl* pH1=GetHdlList().GetHdl(HDL_REF1);
SdrHdl* pH2=GetHdlList().GetHdl(HDL_REF2);
- if (pH1!=NULL && pH2!=NULL)
+ if (pH1!=NULL && pH2!=NULL)
{
DragStat().Ref1()=pH1->GetPos();
DragStat().Ref2()=pH2->GetPos();
@@ -2611,18 +2609,18 @@ bool SdrDragMirror::BeginSdrDrag()
bool b90=(aDif.X()==0) || aDif.Y()==0;
bool b45=b90 || (Abs(aDif.X())==Abs(aDif.Y()));
nWink=NormAngle360(GetAngle(aDif));
-
- if (!getSdrDragView().IsMirrorAllowed(false,false) && !b45)
+
+ if (!getSdrDragView().IsMirrorAllowed(false,false) && !b45)
return false; // freier Achsenwinkel nicht erlaubt
- if (!getSdrDragView().IsMirrorAllowed(true,false) && !b90)
- return false; // 45deg auch nicht erlaubt
+ if (!getSdrDragView().IsMirrorAllowed(true,false) && !b90)
+ return false; // 45deg auch nicht erlaubt
bSide0=ImpCheckSide(DragStat().GetStart());
Show();
return true;
- }
- else
+ }
+ else
{
DBG_ERROR("SdrDragMirror::BeginSdrDrag(): Spiegelachse nicht gefunden");
return false;
@@ -2633,30 +2631,30 @@ basegfx::B2DHomMatrix SdrDragMirror::getCurrentTransformation()
{
basegfx::B2DHomMatrix aRetval;
- if (bMirrored)
+ if (bMirrored)
{
- const double fDeltaX(DragStat().GetRef2().X() - DragStat().GetRef1().X());
- const double fDeltaY(DragStat().GetRef2().Y() - DragStat().GetRef1().Y());
- const double fRotation(atan2(fDeltaY, fDeltaX));
+ const double fDeltaX(DragStat().GetRef2().X() - DragStat().GetRef1().X());
+ const double fDeltaY(DragStat().GetRef2().Y() - DragStat().GetRef1().Y());
+ const double fRotation(atan2(fDeltaY, fDeltaX));
- aRetval = basegfx::tools::createTranslateB2DHomMatrix(-DragStat().GetRef1().X(), -DragStat().GetRef1().Y());
- aRetval.rotate(-fRotation);
- aRetval.scale(1.0, -1.0);
- aRetval.rotate(fRotation);
- aRetval.translate(DragStat().GetRef1().X(), DragStat().GetRef1().Y());
- }
+ aRetval = basegfx::tools::createTranslateB2DHomMatrix(-DragStat().GetRef1().X(), -DragStat().GetRef1().Y());
+ aRetval.rotate(-fRotation);
+ aRetval.scale(1.0, -1.0);
+ aRetval.rotate(fRotation);
+ aRetval.translate(DragStat().GetRef1().X(), DragStat().GetRef1().Y());
+ }
return aRetval;
}
void SdrDragMirror::MoveSdrDrag(const Point& rPnt)
{
- if (DragStat().CheckMinMoved(rPnt))
+ if (DragStat().CheckMinMoved(rPnt))
{
bool bNeuSide=ImpCheckSide(rPnt);
bool bNeuMirr=bSide0!=bNeuSide;
-
- if (bMirrored!=bNeuMirr)
+
+ if (bMirrored!=bNeuMirr)
{
Hide();
bMirrored=bNeuMirr;
@@ -2670,11 +2668,11 @@ bool SdrDragMirror::EndSdrDrag(bool bCopy)
{
Hide();
- if (bMirrored)
+ if (bMirrored)
{
getSdrDragView().MirrorMarkedObj(DragStat().GetRef1(),DragStat().GetRef2(),bCopy);
}
-
+
return true;
}
@@ -2707,8 +2705,8 @@ bool SdrDragGradient::BeginSdrDrag()
bool bRetval(false);
pIAOHandle = (SdrHdlGradient*)GetHdlList().GetHdl(IsGradient() ? HDL_GRAD : HDL_TRNS);
-
- if(pIAOHandle)
+
+ if(pIAOHandle)
{
// save old values
DragStat().Ref1() = pIAOHandle->GetPos();
@@ -2717,7 +2715,7 @@ bool SdrDragGradient::BeginSdrDrag()
// what was hit?
bool bHit(false);
SdrHdlColor* pColHdl = pIAOHandle->GetColorHdl1();
-
+
// init handling flags
pIAOHandle->SetMoveSingleHandle(false);
pIAOHandle->SetMoveFirstHandle(false);
@@ -2737,7 +2735,7 @@ bool SdrDragGradient::BeginSdrDrag()
// test second color handle
pColHdl = pIAOHandle->GetColorHdl2();
-
+
if(!bHit && pColHdl)
{
basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y());
@@ -2762,8 +2760,8 @@ bool SdrDragGradient::BeginSdrDrag()
// everything up and running :o}
bRetval = bHit;
- }
- else
+ }
+ else
{
DBG_ERROR("SdrDragGradient::BeginSdrDrag(): IAOGradient nicht gefunden");
}
@@ -2773,10 +2771,10 @@ bool SdrDragGradient::BeginSdrDrag()
void SdrDragGradient::MoveSdrDrag(const Point& rPnt)
{
- if(pIAOHandle && DragStat().CheckMinMoved(rPnt))
+ if(pIAOHandle && DragStat().CheckMinMoved(rPnt))
{
DragStat().NextMove(rPnt);
-
+
// Do the Move here!!! DragStat().GetStart()
Point aMoveDiff = rPnt - DragStat().GetStart();
@@ -2799,14 +2797,14 @@ void SdrDragGradient::MoveSdrDrag(const Point& rPnt)
{
pIAOHandle->SetPos(DragStat().Ref1() + aMoveDiff);
pIAOHandle->Set2ndPos(DragStat().Ref2() + aMoveDiff);
-
+
if(pIAOHandle->GetColorHdl1())
pIAOHandle->GetColorHdl1()->SetPos(DragStat().Ref1() + aMoveDiff);
-
+
if(pIAOHandle->GetColorHdl2())
pIAOHandle->GetColorHdl2()->SetPos(DragStat().Ref2() + aMoveDiff);
}
-
+
// new state
pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), false, false);
}
@@ -2868,7 +2866,7 @@ SdrDragCrook::SdrDragCrook(SdrDragView& rNewView)
bAtCenter(false),
nWink(0),
nMarkSize(0),
- eMode(SDRCROOK_ROTATE)
+ eMode(SDRCROOK_ROTATE)
{
}
@@ -2876,14 +2874,14 @@ void SdrDragCrook::TakeSdrDragComment(XubString& rStr) const
{
ImpTakeDescriptionStr(!bContortion ? STR_DragMethCrook : STR_DragMethCrookContortion, rStr);
- if(bValid)
+ if(bValid)
{
rStr.AppendAscii(" (");
-
+
XubString aStr;
sal_Int32 nVal(nWink);
-
- if(bAtCenter)
+
+ if(bAtCenter)
nVal *= 2;
nVal = Abs(nVal);
@@ -2892,11 +2890,11 @@ void SdrDragCrook::TakeSdrDragComment(XubString& rStr) const
rStr += sal_Unicode(')');
}
- if(getSdrDragView().IsDragWithCopy())
+ if(getSdrDragView().IsDragWithCopy())
rStr += ImpGetResStr(STR_EditWithCopy);
}
-// #96920# These defines parametrise the created raster
+// #96920# These defines parametrize the created raster
// for interactions
#define DRAG_CROOK_RASTER_MINIMUM (4)
#define DRAG_CROOK_RASTER_MAXIMUM (15)
@@ -2904,7 +2902,7 @@ void SdrDragCrook::TakeSdrDragComment(XubString& rStr) const
basegfx::B2DPolyPolygon impCreateDragRaster(SdrPageView& rPageView, const Rectangle& rMarkRect)
{
- basegfx::B2DPolyPolygon aRetval;
+ basegfx::B2DPolyPolygon aRetval;
if(rPageView.PageWindowCount())
{
@@ -2923,72 +2921,72 @@ basegfx::B2DPolyPolygon impCreateDragRaster(SdrPageView& rPageView, const Rectan
if(nVerDiv < DRAG_CROOK_RASTER_MINIMUM)
nVerDiv = DRAG_CROOK_RASTER_MINIMUM;
- const double fXLen(rMarkRect.GetWidth() / (double)nHorDiv);
- const double fYLen(rMarkRect.GetHeight() / (double)nVerDiv);
- double fYPos(rMarkRect.Top());
- sal_uInt32 a, b;
-
- for(a = 0; a <= nVerDiv; a++)
- {
- // hor lines
- for(b = 0; b < nHorDiv; b++)
- {
- basegfx::B2DPolygon aHorLineSegment;
-
- const double fNewX(rMarkRect.Left() + (b * fXLen));
- aHorLineSegment.append(basegfx::B2DPoint(fNewX, fYPos));
- aHorLineSegment.appendBezierSegment(
- basegfx::B2DPoint(fNewX + (fXLen * (1.0 / 3.0)), fYPos),
- basegfx::B2DPoint(fNewX + (fXLen * (2.0 / 3.0)), fYPos),
- basegfx::B2DPoint(fNewX + fXLen, fYPos));
- aRetval.append(aHorLineSegment);
- }
-
- // increments
- fYPos += fYLen;
- }
-
- double fXPos(rMarkRect.Left());
-
- for(a = 0; a <= nHorDiv; a++)
- {
- // ver lines
- for(b = 0; b < nVerDiv; b++)
- {
- basegfx::B2DPolygon aVerLineSegment;
-
- const double fNewY(rMarkRect.Top() + (b * fYLen));
- aVerLineSegment.append(basegfx::B2DPoint(fXPos, fNewY));
- aVerLineSegment.appendBezierSegment(
- basegfx::B2DPoint(fXPos, fNewY + (fYLen * (1.0 / 3.0))),
- basegfx::B2DPoint(fXPos, fNewY + (fYLen * (2.0 / 3.0))),
- basegfx::B2DPoint(fXPos, fNewY + fYLen));
- aRetval.append(aVerLineSegment);
- }
-
- // increments
- fXPos += fXLen;
- }
- }
-
- return aRetval;
+ const double fXLen(rMarkRect.GetWidth() / (double)nHorDiv);
+ const double fYLen(rMarkRect.GetHeight() / (double)nVerDiv);
+ double fYPos(rMarkRect.Top());
+ sal_uInt32 a, b;
+
+ for(a = 0; a <= nVerDiv; a++)
+ {
+ // horizontal lines
+ for(b = 0; b < nHorDiv; b++)
+ {
+ basegfx::B2DPolygon aHorLineSegment;
+
+ const double fNewX(rMarkRect.Left() + (b * fXLen));
+ aHorLineSegment.append(basegfx::B2DPoint(fNewX, fYPos));
+ aHorLineSegment.appendBezierSegment(
+ basegfx::B2DPoint(fNewX + (fXLen * (1.0 / 3.0)), fYPos),
+ basegfx::B2DPoint(fNewX + (fXLen * (2.0 / 3.0)), fYPos),
+ basegfx::B2DPoint(fNewX + fXLen, fYPos));
+ aRetval.append(aHorLineSegment);
+ }
+
+ // increments
+ fYPos += fYLen;
+ }
+
+ double fXPos(rMarkRect.Left());
+
+ for(a = 0; a <= nHorDiv; a++)
+ {
+ // vertical lines
+ for(b = 0; b < nVerDiv; b++)
+ {
+ basegfx::B2DPolygon aVerLineSegment;
+
+ const double fNewY(rMarkRect.Top() + (b * fYLen));
+ aVerLineSegment.append(basegfx::B2DPoint(fXPos, fNewY));
+ aVerLineSegment.appendBezierSegment(
+ basegfx::B2DPoint(fXPos, fNewY + (fYLen * (1.0 / 3.0))),
+ basegfx::B2DPoint(fXPos, fNewY + (fYLen * (2.0 / 3.0))),
+ basegfx::B2DPoint(fXPos, fNewY + fYLen));
+ aRetval.append(aVerLineSegment);
+ }
+
+ // increments
+ fXPos += fXLen;
+ }
+ }
+
+ return aRetval;
}
void SdrDragCrook::createSdrDragEntries()
{
// Add extended frame raster first, so it will be behind objects
- if(getSdrDragView().GetSdrPageView())
- {
- const basegfx::B2DPolyPolygon aDragRaster(impCreateDragRaster(*getSdrDragView().GetSdrPageView(), GetMarkedRect()));
+ if(getSdrDragView().GetSdrPageView())
+ {
+ const basegfx::B2DPolyPolygon aDragRaster(impCreateDragRaster(*getSdrDragView().GetSdrPageView(), GetMarkedRect()));
- if(aDragRaster.count())
- {
- addSdrDragEntry(new SdrDragEntryPolyPolygon(aDragRaster));
- }
- }
+ if(aDragRaster.count())
+ {
+ addSdrDragEntry(new SdrDragEntryPolyPolygon(aDragRaster));
+ }
+ }
- // call parent
- SdrDragMethod::createSdrDragEntries();
+ // call parent
+ SdrDragMethod::createSdrDragEntries();
}
bool SdrDragCrook::BeginSdrDrag()
@@ -2998,7 +2996,7 @@ bool SdrDragCrook::BeginSdrDrag()
bResizeAllowed=getSdrDragView().IsResizeAllowed(false);
bRotateAllowed=getSdrDragView().IsRotateAllowed(false);
- if (bContortionAllowed || bNoContortionAllowed)
+ if (bContortionAllowed || bNoContortionAllowed)
{
bVertical=(GetDragHdlKind()==HDL_LOWER || GetDragHdlKind()==HDL_UPPER);
aMarkRect=GetMarkedRect();
@@ -3008,8 +3006,8 @@ bool SdrDragCrook::BeginSdrDrag()
aStart=DragStat().GetStart();
Show();
return true;
- }
- else
+ }
+ else
{
return false;
}
@@ -3023,39 +3021,39 @@ void SdrDragCrook::_MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
{
XPolyPolygon aTempPolyPoly(rTarget);
- if (pPV->HasMarkedObjPageView())
+ if (pPV->HasMarkedObjPageView())
{
sal_uInt16 nPolyAnz=aTempPolyPoly.Count();
- if (!bContortion && !getSdrDragView().IsNoDragXorPolys())
+ if (!bContortion && !getSdrDragView().IsNoDragXorPolys())
{
sal_uInt16 n1st=0,nLast=0;
Point aC(aCenter);
-
- while (n1st<nPolyAnz)
+
+ while (n1st<nPolyAnz)
{
nLast=n1st;
while (nLast<nPolyAnz && aTempPolyPoly[nLast].GetPointCount()!=0) nLast++;
Rectangle aBound(aTempPolyPoly[n1st].GetBoundRect());
sal_uInt16 i;
-
- for (i=n1st+1; i<nLast; i++)
+
+ for (i=n1st+1; i<nLast; i++)
{
aBound.Union(aTempPolyPoly[n1st].GetBoundRect());
}
-
+
Point aCtr0(aBound.Center());
Point aCtr1(aCtr0);
-
- if (bResize)
+
+ if (bResize)
{
Fraction aFact1(1,1);
-
- if (bVertical)
+
+ if (bVertical)
{
ResizePoint(aCtr1,aC,aFact1,aFact);
- }
- else
+ }
+ else
{
ResizePoint(aCtr1,aC,aFact,aFact1);
}
@@ -3064,11 +3062,11 @@ void SdrDragCrook::_MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
bool bRotOk=false;
double nSin=0,nCos=0;
- if (aRad.X()!=0 && aRad.Y()!=0)
+ if (aRad.X()!=0 && aRad.Y()!=0)
{
bRotOk=bRotate;
- switch (eMode)
+ switch (eMode)
{
case SDRCROOK_ROTATE : CrookRotateXPoint (aCtr1,NULL,NULL,aC,aRad,nSin,nCos,bVertical); break;
case SDRCROOK_SLANT : CrookSlantXPoint (aCtr1,NULL,NULL,aC,aRad,nSin,nCos,bVertical); break;
@@ -3078,50 +3076,50 @@ void SdrDragCrook::_MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
aCtr1-=aCtr0;
- for (i=n1st; i<nLast; i++)
+ for (i=n1st; i<nLast; i++)
{
- if (bRotOk)
+ if (bRotOk)
{
RotateXPoly(aTempPolyPoly[i],aCtr0,nSin,nCos);
}
-
+
aTempPolyPoly[i].Move(aCtr1.X(),aCtr1.Y());
}
n1st=nLast+1;
}
- }
- else
+ }
+ else
{
sal_uInt16 i,j;
-
- for (j=0; j<nPolyAnz; j++)
+
+ for (j=0; j<nPolyAnz; j++)
{
XPolygon& aPol=aTempPolyPoly[j];
sal_uInt16 nPtAnz=aPol.GetPointCount();
i=0;
-
- while (i<nPtAnz)
+
+ while (i<nPtAnz)
{
Point* pPnt=&aPol[i];
Point* pC1=NULL;
Point* pC2=NULL;
-
- if (i+1<nPtAnz && aPol.IsControl(i))
+
+ if (i+1<nPtAnz && aPol.IsControl(i))
{ // Kontrollpunkt links
pC1=pPnt;
i++;
pPnt=&aPol[i];
}
-
+
i++;
-
- if (i<nPtAnz && aPol.IsControl(i))
+
+ if (i<nPtAnz && aPol.IsControl(i))
{ // Kontrollpunkt rechts
pC2=&aPol[i];
i++;
}
-
+
_MovCrookPoint(*pPnt,pC1,pC2);
}
}
@@ -3139,37 +3137,37 @@ void SdrDragCrook::_MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2)
bool bC2=pC2!=NULL;
Point aC(aCenter);
- if (bResize)
+ if (bResize)
{
Fraction aFact1(1,1);
-
- if (bVert)
+
+ if (bVert)
{
ResizePoint(rPnt,aC,aFact1,aFact);
-
- if (bC1)
+
+ if (bC1)
ResizePoint(*pC1,aC,aFact1,aFact);
- if (bC2)
+ if (bC2)
ResizePoint(*pC2,aC,aFact1,aFact);
- }
- else
+ }
+ else
{
ResizePoint(rPnt,aC,aFact,aFact1);
-
- if (bC1)
+
+ if (bC1)
ResizePoint(*pC1,aC,aFact,aFact1);
- if (bC2)
+ if (bC2)
ResizePoint(*pC2,aC,aFact,aFact1);
}
}
- if (aRad.X()!=0 && aRad.Y()!=0)
+ if (aRad.X()!=0 && aRad.Y()!=0)
{
double nSin,nCos;
-
- switch (eMode)
+
+ switch (eMode)
{
case SDRCROOK_ROTATE : CrookRotateXPoint (rPnt,pC1,pC2,aC,aRad,nSin,nCos,bVert); break;
case SDRCROOK_SLANT : CrookSlantXPoint (rPnt,pC1,pC2,aC,aRad,nSin,nCos,bVert); break;
@@ -3180,7 +3178,7 @@ void SdrDragCrook::_MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2)
void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
{
- if (DragStat().CheckMinMoved(rPnt))
+ if (DragStat().CheckMinMoved(rPnt))
{
Point aPnt(rPnt);
bool bNeuMoveOnly=getSdrDragView().IsMoveOnlyDragging();
@@ -3191,20 +3189,20 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
bool bNeuRotate=bRotateAllowed && !bNeuContortion && !bNeuMoveOnly && eNeuMode==SDRCROOK_ROTATE;
long nSA=0;
- if (nSA==0)
+ if (nSA==0)
aPnt=GetSnapPos(aPnt);
Point aNeuCenter(aMarkCenter.X(),aStart.Y());
-
- if (bVertical)
- {
- aNeuCenter.X()=aStart.X();
- aNeuCenter.Y()=aMarkCenter.Y();
+
+ if (bVertical)
+ {
+ aNeuCenter.X()=aStart.X();
+ aNeuCenter.Y()=aMarkCenter.Y();
}
-
- if (!getSdrDragView().IsCrookAtCenter())
+
+ if (!getSdrDragView().IsCrookAtCenter())
{
- switch (GetDragHdlKind())
+ switch (GetDragHdlKind())
{
case HDL_UPLFT: aNeuCenter.X()=aMarkRect.Right(); bLft=true; break;
case HDL_UPPER: aNeuCenter.Y()=aMarkRect.Bottom(); bUpr=true; break;
@@ -3216,64 +3214,64 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
case HDL_LWRGT: aNeuCenter.X()=aMarkRect.Left(); bRgt=true; break;
default: bAtCenter=true;
}
- }
- else
+ }
+ else
bAtCenter=true;
Fraction aNeuFact(1,1);
long dx1=aPnt.X()-aNeuCenter.X();
long dy1=aPnt.Y()-aNeuCenter.Y();
bValid=bVertical ? dx1!=0 : dy1!=0;
-
- if (bValid)
+
+ if (bValid)
{
- if (bVertical)
+ if (bVertical)
bValid=Abs(dx1)*100>Abs(dy1);
- else
+ else
bValid=Abs(dy1)*100>Abs(dx1);
}
long nNeuRad=0;
nWink=0;
- if (bValid)
+ if (bValid)
{
double a=0; // Steigung des Radius
long nPntWink=0;
-
- if (bVertical)
+
+ if (bVertical)
{
a=((double)dy1)/((double)dx1); // Steigung des Radius
nNeuRad=((long)(dy1*a)+dx1) /2;
aNeuCenter.X()+=nNeuRad;
nPntWink=GetAngle(aPnt-aNeuCenter);
- }
- else
+ }
+ else
{
a=((double)dx1)/((double)dy1); // Steigung des Radius
nNeuRad=((long)(dx1*a)+dy1) /2;
aNeuCenter.Y()+=nNeuRad;
nPntWink=GetAngle(aPnt-aNeuCenter)-9000;
}
-
- if (!bAtCenter)
+
+ if (!bAtCenter)
{
- if (nNeuRad<0)
+ if (nNeuRad<0)
{
if (bRgt) nPntWink+=18000;
if (bLft) nPntWink=18000-nPntWink;
if (bLwr) nPntWink=-nPntWink;
- }
- else
+ }
+ else
{
if (bRgt) nPntWink=-nPntWink;
if (bUpr) nPntWink=18000-nPntWink;
if (bLwr) nPntWink+=18000;
}
-
+
nPntWink=NormAngle360(nPntWink);
- }
- else
+ }
+ else
{
if (nNeuRad<0) nPntWink+=18000;
if (bVertical) nPntWink=18000-nPntWink;
@@ -3283,9 +3281,9 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
double nUmfang=2*Abs(nNeuRad)*nPi;
- if (bResize)
+ if (bResize)
{
- if (nSA!=0)
+ if (nSA!=0)
{ // Winkelfang
long nWink0=nPntWink;
nPntWink+=nSA/2;
@@ -3295,29 +3293,29 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
a2*=BigInt(nWink);
a2/=BigInt(nWink0);
nNeuRad=long(a2);
-
- if (bVertical)
+
+ if (bVertical)
aNeuCenter.X()=aStart.X()+nNeuRad;
- else
+ else
aNeuCenter.Y()=aStart.Y()+nNeuRad;
}
long nMul=(long)(nUmfang*NormAngle360(nPntWink)/36000);
- if (bAtCenter)
+ if (bAtCenter)
nMul*=2;
aNeuFact=Fraction(nMul,nMarkSize);
nWink=nPntWink;
- }
- else
+ }
+ else
{
nWink=(long)((nMarkSize*360/nUmfang)*100)/2;
-
- if (nWink==0)
+
+ if (nWink==0)
bValid=false;
- if (bValid && nSA!=0)
+ if (bValid && nSA!=0)
{ // Winkelfang
long nWink0=nWink;
nWink+=nSA/2;
@@ -3327,36 +3325,36 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
a2*=BigInt(nWink);
a2/=BigInt(nWink0);
nNeuRad=long(a2);
-
- if (bVertical)
+
+ if (bVertical)
aNeuCenter.X()=aStart.X()+nNeuRad;
- else
+ else
aNeuCenter.Y()=aStart.Y()+nNeuRad;
}
}
}
- if (nWink==0 || nNeuRad==0)
+ if (nWink==0 || nNeuRad==0)
bValid=false;
-
- if (!bValid)
+
+ if (!bValid)
nNeuRad=0;
- if (!bValid && bResize)
+ if (!bValid && bResize)
{
long nMul=bVertical ? dy1 : dx1;
-
- if (bLft || bUpr)
+
+ if (bLft || bUpr)
nMul=-nMul;
long nDiv=nMarkSize;
-
- if (bAtCenter)
- {
- nMul*=2;
- nMul=Abs(nMul);
+
+ if (bAtCenter)
+ {
+ nMul*=2;
+ nMul=Abs(nMul);
}
-
+
aNeuFact=Fraction(nMul,nDiv);
}
@@ -3380,54 +3378,54 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
void SdrDragCrook::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
{
- const bool bDoResize(aFact!=Fraction(1,1));
+ const bool bDoResize(aFact!=Fraction(1,1));
const bool bDoCrook(aCenter!=aMarkCenter && aRad.X()!=0 && aRad.Y()!=0);
-
- if (bDoCrook || bDoResize)
+
+ if (bDoCrook || bDoResize)
{
- if (bDoResize)
+ if (bDoResize)
{
Fraction aFact1(1,1);
-
- if (bContortion)
+
+ if (bContortion)
{
- if (bVertical)
- {
- rTarget.Resize(aCenter,aFact1,aFact);
- }
- else
- {
- rTarget.Resize(aCenter,aFact,aFact1);
- }
- }
- else
+ if (bVertical)
+ {
+ rTarget.Resize(aCenter,aFact1,aFact);
+ }
+ else
+ {
+ rTarget.Resize(aCenter,aFact,aFact1);
+ }
+ }
+ else
{
Point aCtr0(rTarget.GetSnapRect().Center());
Point aCtr1(aCtr0);
-
- if (bVertical)
- {
+
+ if (bVertical)
+ {
ResizePoint(aCtr1,aCenter,aFact1,aFact);
- }
- else
- {
+ }
+ else
+ {
ResizePoint(aCtr1,aCenter,aFact,aFact1);
- }
+ }
Size aSiz(aCtr1.X()-aCtr0.X(),aCtr1.Y()-aCtr0.Y());
- rTarget.Move(aSiz);
+ rTarget.Move(aSiz);
}
}
- if (bDoCrook)
+ if (bDoCrook)
{
- const Rectangle aLocalMarkRect(getSdrDragView().GetMarkedObjRect());
- const bool bLocalRotate(!bContortion && eMode == SDRCROOK_ROTATE && getSdrDragView().IsRotateAllowed(false));
+ const Rectangle aLocalMarkRect(getSdrDragView().GetMarkedObjRect());
+ const bool bLocalRotate(!bContortion && eMode == SDRCROOK_ROTATE && getSdrDragView().IsRotateAllowed(false));
getSdrDragView().ImpCrookObj(&rTarget,aCenter,aRad,eMode,bVertical,!bContortion,bLocalRotate,aLocalMarkRect);
}
- }
+ }
}
void SdrDragCrook::applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget)
@@ -3439,55 +3437,55 @@ void SdrDragCrook::applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolyg
bool SdrDragCrook::EndSdrDrag(bool bCopy)
{
Hide();
-
- if (bResize && aFact==Fraction(1,1))
+
+ if (bResize && aFact==Fraction(1,1))
bResize=false;
const bool bUndo = getSdrDragView().IsUndoEnabled();
bool bDoCrook=aCenter!=aMarkCenter && aRad.X()!=0 && aRad.Y()!=0;
-
- if (bDoCrook || bResize)
+
+ if (bDoCrook || bResize)
{
- if (bResize && bUndo)
+ if (bResize && bUndo)
{
XubString aStr;
ImpTakeDescriptionStr(!bContortion?STR_EditCrook:STR_EditCrookContortion,aStr);
-
- if (bCopy)
+
+ if (bCopy)
aStr+=ImpGetResStr(STR_EditWithCopy);
getSdrDragView().BegUndo(aStr);
}
- if (bResize)
+ if (bResize)
{
Fraction aFact1(1,1);
-
- if (bContortion)
+
+ if (bContortion)
{
- if (bVertical)
+ if (bVertical)
getSdrDragView().ResizeMarkedObj(aCenter,aFact1,aFact,bCopy);
- else
+ else
getSdrDragView().ResizeMarkedObj(aCenter,aFact,aFact1,bCopy);
- }
- else
+ }
+ else
{
- if (bCopy)
+ if (bCopy)
getSdrDragView().CopyMarkedObj();
sal_uLong nMarkAnz=getSdrDragView().GetMarkedObjectList().GetMarkCount();
-
- for (sal_uLong nm=0; nm<nMarkAnz; nm++)
+
+ for (sal_uLong nm=0; nm<nMarkAnz; nm++)
{
SdrMark* pM=getSdrDragView().GetMarkedObjectList().GetMark(nm);
SdrObject* pO=pM->GetMarkedSdrObj();
Point aCtr0(pO->GetSnapRect().Center());
Point aCtr1(aCtr0);
-
- if (bVertical)
+
+ if (bVertical)
ResizePoint(aCtr1,aCenter,aFact1,aFact);
- else
+ else
ResizePoint(aCtr1,aCenter,aFact,aFact1);
Size aSiz(aCtr1.X()-aCtr0.X(),aCtr1.Y()-aCtr0.Y());
@@ -3500,13 +3498,13 @@ bool SdrDragCrook::EndSdrDrag(bool bCopy)
bCopy=false;
}
- if (bDoCrook)
+ if (bDoCrook)
{
getSdrDragView().CrookMarkedObj(aCenter,aRad,eMode,bVertical,!bContortion,bCopy);
getSdrDragView().SetLastCrookCenter(aCenter);
}
-
- if (bResize && bUndo)
+
+ if (bResize && bUndo)
getSdrDragView().EndUndo();
return true;
@@ -3529,7 +3527,7 @@ SdrDragDistort::SdrDragDistort(SdrDragView& rNewView)
nPolyPt(0),
bContortionAllowed(false),
bNoContortionAllowed(false),
- bContortion(false)
+ bContortion(false)
{
}
@@ -3538,7 +3536,7 @@ void SdrDragDistort::TakeSdrDragComment(XubString& rStr) const
ImpTakeDescriptionStr(STR_DragMethDistort, rStr);
XubString aStr;
-
+
rStr.AppendAscii(" (x=");
getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDX(), aStr);
rStr += aStr;
@@ -3546,26 +3544,26 @@ void SdrDragDistort::TakeSdrDragComment(XubString& rStr) const
getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDY(), aStr);
rStr += aStr;
rStr += sal_Unicode(')');
-
- if(getSdrDragView().IsDragWithCopy())
+
+ if(getSdrDragView().IsDragWithCopy())
rStr += ImpGetResStr(STR_EditWithCopy);
}
void SdrDragDistort::createSdrDragEntries()
{
// Add extended frame raster first, so it will be behind objects
- if(getSdrDragView().GetSdrPageView())
- {
- const basegfx::B2DPolyPolygon aDragRaster(impCreateDragRaster(*getSdrDragView().GetSdrPageView(), GetMarkedRect()));
+ if(getSdrDragView().GetSdrPageView())
+ {
+ const basegfx::B2DPolyPolygon aDragRaster(impCreateDragRaster(*getSdrDragView().GetSdrPageView(), GetMarkedRect()));
- if(aDragRaster.count())
- {
- addSdrDragEntry(new SdrDragEntryPolyPolygon(aDragRaster));
- }
- }
+ if(aDragRaster.count())
+ {
+ addSdrDragEntry(new SdrDragEntryPolyPolygon(aDragRaster));
+ }
+ }
- // call parent
- SdrDragMethod::createSdrDragEntries();
+ // call parent
+ SdrDragMethod::createSdrDragEntries();
}
bool SdrDragDistort::BeginSdrDrag()
@@ -3573,11 +3571,11 @@ bool SdrDragDistort::BeginSdrDrag()
bContortionAllowed=getSdrDragView().IsDistortAllowed(false);
bNoContortionAllowed=getSdrDragView().IsDistortAllowed(true);
- if (bContortionAllowed || bNoContortionAllowed)
+ if (bContortionAllowed || bNoContortionAllowed)
{
SdrHdlKind eKind=GetDragHdlKind();
nPolyPt=0xFFFF;
-
+
if (eKind==HDL_UPLFT) nPolyPt=0;
if (eKind==HDL_UPRGT) nPolyPt=1;
if (eKind==HDL_LWRGT) nPolyPt=2;
@@ -3588,8 +3586,8 @@ bool SdrDragDistort::BeginSdrDrag()
aDistortedRect=XPolygon(aMarkRect);
Show();
return true;
- }
- else
+ }
+ else
{
return false;
}
@@ -3597,13 +3595,13 @@ bool SdrDragDistort::BeginSdrDrag()
void SdrDragDistort::_MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
{
- if (bContortion)
+ if (bContortion)
{
SdrPageView* pPV = getSdrDragView().GetSdrPageView();
if(pPV)
{
- if (pPV->HasMarkedObjPageView())
+ if (pPV->HasMarkedObjPageView())
{
basegfx::B2DPolyPolygon aDragPolygon(rTarget);
const basegfx::B2DRange aOriginalRange(aMarkRect.Left(), aMarkRect.Top(), aMarkRect.Right(), aMarkRect.Bottom());
@@ -3611,8 +3609,8 @@ void SdrDragDistort::_MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
const basegfx::B2DPoint aTopRight(aDistortedRect[1].X(), aDistortedRect[1].Y());
const basegfx::B2DPoint aBottomLeft(aDistortedRect[3].X(), aDistortedRect[3].Y());
const basegfx::B2DPoint aBottomRight(aDistortedRect[2].X(), aDistortedRect[2].Y());
-
- aDragPolygon = basegfx::tools::distort(aDragPolygon, aOriginalRange, aTopLeft, aTopRight, aBottomLeft, aBottomRight);
+
+ aDragPolygon = basegfx::tools::distort(aDragPolygon, aOriginalRange, aTopLeft, aTopRight, aBottomLeft, aBottomRight);
rTarget = aDragPolygon;
}
}
@@ -3621,16 +3619,16 @@ void SdrDragDistort::_MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
void SdrDragDistort::MoveSdrDrag(const Point& rPnt)
{
- if (DragStat().CheckMinMoved(rPnt))
+ if (DragStat().CheckMinMoved(rPnt))
{
Point aPnt(GetSnapPos(rPnt));
-
- if (getSdrDragView().IsOrtho())
+
+ if (getSdrDragView().IsOrtho())
OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
bool bNeuContortion=(bContortionAllowed && !getSdrDragView().IsCrookNoContortion()) || !bNoContortionAllowed;
-
- if (bNeuContortion!=bContortion || aDistortedRect[nPolyPt]!=aPnt)
+
+ if (bNeuContortion!=bContortion || aDistortedRect[nPolyPt]!=aPnt)
{
Hide();
aDistortedRect[nPolyPt]=aPnt;
@@ -3646,12 +3644,12 @@ bool SdrDragDistort::EndSdrDrag(bool bCopy)
Hide();
bool bDoDistort=DragStat().GetDX()!=0 || DragStat().GetDY()!=0;
- if (bDoDistort)
+ if (bDoDistort)
{
getSdrDragView().DistortMarkedObj(aMarkRect,aDistortedRect,!bContortion,bCopy);
return true;
}
-
+
return false;
}
@@ -3664,7 +3662,7 @@ void SdrDragDistort::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
{
const bool bDoDistort(DragStat().GetDX()!=0 || DragStat().GetDY()!=0);
- if (bDoDistort)
+ if (bDoDistort)
{
getSdrDragView().ImpDistortObj(&rTarget, aMarkRect, aDistortedRect, !bContortion);
}
@@ -3681,7 +3679,7 @@ void SdrDragDistort::applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPol
TYPEINIT1(SdrDragCrop,SdrDragResize);
SdrDragCrop::SdrDragCrop(SdrDragView& rNewView)
-: SdrDragObjOwn(rNewView)
+: SdrDragObjOwn(rNewView)
{
// switch off solid dragging for crop; it just makes no sense since showing
// a 50% transparent object above the original will not be visible
@@ -3693,7 +3691,7 @@ void SdrDragCrop::TakeSdrDragComment(XubString& rStr) const
ImpTakeDescriptionStr(STR_DragMethCrop, rStr);
XubString aStr;
-
+
rStr.AppendAscii(" (x=");
getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDX(), aStr);
rStr += aStr;
@@ -3701,34 +3699,34 @@ void SdrDragCrop::TakeSdrDragComment(XubString& rStr) const
getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDY(), aStr);
rStr += aStr;
rStr += sal_Unicode(')');
-
- if(getSdrDragView().IsDragWithCopy())
+
+ if(getSdrDragView().IsDragWithCopy())
rStr += ImpGetResStr(STR_EditWithCopy);
}
bool SdrDragCrop::BeginSdrDrag()
{
- // call parent
- bool bRetval(SdrDragObjOwn::BeginSdrDrag());
+ // call parent
+ bool bRetval(SdrDragObjOwn::BeginSdrDrag());
- if(!GetDragHdl())
- {
- // we need the DragHdl, break if not there
- bRetval = false;
- }
+ if(!GetDragHdl())
+ {
+ // we need the DragHdl, break if not there
+ bRetval = false;
+ }
- return bRetval;
+ return bRetval;
}
bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/)
{
Hide();
-
+
if( DragStat().GetDX()==0 && DragStat().GetDY()==0 )
return false;
const SdrMarkList& rMarkList = getSdrDragView().GetMarkedObjectList();
-
+
if( rMarkList.GetMarkCount() != 1 )
return false;
@@ -3740,10 +3738,10 @@ bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/)
const GraphicObject& rGraphicObject = pObj->GetGraphicObject();
const MapMode aMapMode100thmm(MAP_100TH_MM);
Size aGraphicSize(rGraphicObject.GetPrefSize());
-
- if( MAP_PIXEL == rGraphicObject.GetPrefMapMode().GetMapUnit() )
- aGraphicSize = Application::GetDefaultDevice()->PixelToLogic( aGraphicSize, aMapMode100thmm );
- else
+
+ if( MAP_PIXEL == rGraphicObject.GetPrefMapMode().GetMapUnit() )
+ aGraphicSize = Application::GetDefaultDevice()->PixelToLogic( aGraphicSize, aMapMode100thmm );
+ else
aGraphicSize = Application::GetDefaultDevice()->LogicToLogic( aGraphicSize, rGraphicObject.GetPrefMapMode(), aMapMode100thmm);
if( aGraphicSize.nA == 0 || aGraphicSize.nB == 0 )
@@ -3758,204 +3756,204 @@ bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/)
String aUndoStr;
ImpTakeDescriptionStr(STR_DragMethCrop, aUndoStr);
- getSdrDragView().BegUndo( aUndoStr );
+ getSdrDragView().BegUndo( aUndoStr );
getSdrDragView().AddUndo( getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
- // also need attr undo, the SdrGrafCropItem will be changed
- getSdrDragView().AddUndo( getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
- }
-
- // new part to comute the user's drag activities
- // get the original objects transformation
- basegfx::B2DHomMatrix aOriginalMatrix;
- basegfx::B2DPolyPolygon aPolyPolygon;
- bool bShearCorrected(false);
-
- // get transformation from object
- pObj->TRGetBaseGeometry(aOriginalMatrix, aPolyPolygon);
-
- { // TTTT correct shear, it comes currently mirrored from TRGetBaseGeometry, can be removed with aw080
- basegfx::B2DTuple aScale;
- basegfx::B2DTuple aTranslate;
- double fRotate(0.0), fShearX(0.0);
-
- aOriginalMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
-
- if(!basegfx::fTools::equalZero(fShearX))
- {
- bShearCorrected = true;
- aOriginalMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
- aScale,
- -fShearX,
- fRotate,
- aTranslate);
- }
- }
-
- // invert it to be able to work on unit coordinates
- basegfx::B2DHomMatrix aInverse(aOriginalMatrix);
-
- aInverse.invert();
-
- // gererate start point of original drag vector in unit coordinates (the
- // vis-a-vis of the drag point)
- basegfx::B2DPoint aLocalStart(0.0, 0.0);
- bool bOnAxis(false);
-
- switch(GetDragHdlKind())
- {
- case HDL_UPLFT: aLocalStart.setX(1.0); aLocalStart.setY(1.0); break;
- case HDL_UPPER: aLocalStart.setX(0.5); aLocalStart.setY(1.0); bOnAxis = true; break;
- case HDL_UPRGT: aLocalStart.setX(0.0); aLocalStart.setY(1.0); break;
- case HDL_LEFT : aLocalStart.setX(1.0); aLocalStart.setY(0.5); bOnAxis = true; break;
- case HDL_RIGHT: aLocalStart.setX(0.0); aLocalStart.setY(0.5); bOnAxis = true; break;
- case HDL_LWLFT: aLocalStart.setX(1.0); aLocalStart.setY(0.0); break;
- case HDL_LOWER: aLocalStart.setX(0.5); aLocalStart.setY(0.0); bOnAxis = true; break;
- case HDL_LWRGT: aLocalStart.setX(0.0); aLocalStart.setY(0.0); break;
- default: break;
- }
-
- // create the current drag position in unit coordinates
- basegfx::B2DPoint aLocalCurrent(aInverse * basegfx::B2DPoint(DragStat().GetNow().X(), DragStat().GetNow().Y()));
-
- // if one of the edge handles is used, limit to X or Y drag only
- if(bOnAxis)
- {
- if(basegfx::fTools::equal(aLocalStart.getX(), 0.5))
- {
- aLocalCurrent.setX(aLocalStart.getX());
- }
- else
- {
- aLocalCurrent.setY(aLocalStart.getY());
- }
- }
-
- // create internal change in unit coordinates
- basegfx::B2DHomMatrix aDiscreteChangeMatrix;
-
- if(!basegfx::fTools::equal(aLocalCurrent.getX(), aLocalStart.getX()))
- {
- if(aLocalStart.getX() < 0.5)
- {
- aDiscreteChangeMatrix.scale(aLocalCurrent.getX(), 1.0);
- }
- else
- {
- aDiscreteChangeMatrix.scale(1.0 - aLocalCurrent.getX(), 1.0);
- aDiscreteChangeMatrix.translate(aLocalCurrent.getX(), 0.0);
- }
- }
-
- if(!basegfx::fTools::equal(aLocalCurrent.getY(), aLocalStart.getY()))
- {
- if(aLocalStart.getY() < 0.5)
- {
- aDiscreteChangeMatrix.scale(1.0, aLocalCurrent.getY());
- }
- else
- {
- aDiscreteChangeMatrix.scale(1.0, 1.0 - aLocalCurrent.getY());
- aDiscreteChangeMatrix.translate(0.0, aLocalCurrent.getY());
- }
- }
-
- // preparematrix to apply to object; evtl. back-correct shear
- basegfx::B2DHomMatrix aNewObjectMatrix(aOriginalMatrix * aDiscreteChangeMatrix);
-
- if(bShearCorrected)
- {
- // TTTT back-correct shear
- basegfx::B2DTuple aScale;
- basegfx::B2DTuple aTranslate;
- double fRotate(0.0), fShearX(0.0);
-
- aNewObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
- aNewObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
- aScale,
- -fShearX,
- fRotate,
- aTranslate);
- }
-
- // apply change to object by applying the unit coordinate change followed
- // by the original change
- pObj->TRSetBaseGeometry(aNewObjectMatrix, aPolyPolygon);
-
- // the following old code uses aOldRect/aNewRect to calculate the crop change for
- // the crop item. It implies unrotated objects, so create the unrotated original
- // erctangle and the unrotated modified rectangle. Latter can in case of shear and/or
- // rotation not be fetched by using
- //
- //Rectangle aNewRect( pObj->GetLogicRect() );
- //
- // as it was done before because the top-left of that new rect *will* have an offset
- // caused by the evtl. existing shear and/or rotation, so calculate a unrotated
- // rectangle how it would be as a result when appling the unit coordinate change
- // to the unrotated original transformation.
- basegfx::B2DTuple aScale;
- basegfx::B2DTuple aTranslate;
- double fRotate, fShearX;
-
- // get access to scale and translate
- aOriginalMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
-
- // prepare unsheared/unrotated versions of the old and new transformation
- const basegfx::B2DHomMatrix aMatrixOriginalNoShearNoRotate(
- basegfx::tools::createScaleTranslateB2DHomMatrix(
- basegfx::absolute(aScale),
- aTranslate));
-
- // create the ranges for these
- basegfx::B2DRange aRangeOriginalNoShearNoRotate(0.0, 0.0, 1.0, 1.0);
- basegfx::B2DRange aRangeNewNoShearNoRotate(0.0, 0.0, 1.0, 1.0);
-
- aRangeOriginalNoShearNoRotate.transform(aMatrixOriginalNoShearNoRotate);
- aRangeNewNoShearNoRotate.transform(aMatrixOriginalNoShearNoRotate * aDiscreteChangeMatrix);
-
- // extract the old Rectangle structures
- Rectangle aOldRect(
- basegfx::fround(aRangeOriginalNoShearNoRotate.getMinX()),
- basegfx::fround(aRangeOriginalNoShearNoRotate.getMinY()),
- basegfx::fround(aRangeOriginalNoShearNoRotate.getMaxX()),
- basegfx::fround(aRangeOriginalNoShearNoRotate.getMaxY()));
- Rectangle aNewRect(
- basegfx::fround(aRangeNewNoShearNoRotate.getMinX()),
- basegfx::fround(aRangeNewNoShearNoRotate.getMinY()),
- basegfx::fround(aRangeNewNoShearNoRotate.getMaxX()),
- basegfx::fround(aRangeNewNoShearNoRotate.getMaxY()));
-
- // continue with the old original stuff
+ // also need attr undo, the SdrGrafCropItem will be changed
+ getSdrDragView().AddUndo( getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
+ }
+
+ // new part to compute the user's drag activities
+ // get the original objects transformation
+ basegfx::B2DHomMatrix aOriginalMatrix;
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ bool bShearCorrected(false);
+
+ // get transformation from object
+ pObj->TRGetBaseGeometry(aOriginalMatrix, aPolyPolygon);
+
+ { // TTTT correct shear, it comes currently mirrored from TRGetBaseGeometry, can be removed with aw080
+ basegfx::B2DTuple aScale;
+ basegfx::B2DTuple aTranslate;
+ double fRotate(0.0), fShearX(0.0);
+
+ aOriginalMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ if(!basegfx::fTools::equalZero(fShearX))
+ {
+ bShearCorrected = true;
+ aOriginalMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aScale,
+ -fShearX,
+ fRotate,
+ aTranslate);
+ }
+ }
+
+ // invert it to be able to work on unit coordinates
+ basegfx::B2DHomMatrix aInverse(aOriginalMatrix);
+
+ aInverse.invert();
+
+ // generate start point of original drag vector in unit coordinates (the
+ // vis-a-vis of the drag point)
+ basegfx::B2DPoint aLocalStart(0.0, 0.0);
+ bool bOnAxis(false);
+
+ switch(GetDragHdlKind())
+ {
+ case HDL_UPLFT: aLocalStart.setX(1.0); aLocalStart.setY(1.0); break;
+ case HDL_UPPER: aLocalStart.setX(0.5); aLocalStart.setY(1.0); bOnAxis = true; break;
+ case HDL_UPRGT: aLocalStart.setX(0.0); aLocalStart.setY(1.0); break;
+ case HDL_LEFT : aLocalStart.setX(1.0); aLocalStart.setY(0.5); bOnAxis = true; break;
+ case HDL_RIGHT: aLocalStart.setX(0.0); aLocalStart.setY(0.5); bOnAxis = true; break;
+ case HDL_LWLFT: aLocalStart.setX(1.0); aLocalStart.setY(0.0); break;
+ case HDL_LOWER: aLocalStart.setX(0.5); aLocalStart.setY(0.0); bOnAxis = true; break;
+ case HDL_LWRGT: aLocalStart.setX(0.0); aLocalStart.setY(0.0); break;
+ default: break;
+ }
+
+ // create the current drag position in unit coordinates
+ basegfx::B2DPoint aLocalCurrent(aInverse * basegfx::B2DPoint(DragStat().GetNow().X(), DragStat().GetNow().Y()));
+
+ // if one of the edge handles is used, limit to X or Y drag only
+ if(bOnAxis)
+ {
+ if(basegfx::fTools::equal(aLocalStart.getX(), 0.5))
+ {
+ aLocalCurrent.setX(aLocalStart.getX());
+ }
+ else
+ {
+ aLocalCurrent.setY(aLocalStart.getY());
+ }
+ }
+
+ // create internal change in unit coordinates
+ basegfx::B2DHomMatrix aDiscreteChangeMatrix;
+
+ if(!basegfx::fTools::equal(aLocalCurrent.getX(), aLocalStart.getX()))
+ {
+ if(aLocalStart.getX() < 0.5)
+ {
+ aDiscreteChangeMatrix.scale(aLocalCurrent.getX(), 1.0);
+ }
+ else
+ {
+ aDiscreteChangeMatrix.scale(1.0 - aLocalCurrent.getX(), 1.0);
+ aDiscreteChangeMatrix.translate(aLocalCurrent.getX(), 0.0);
+ }
+ }
+
+ if(!basegfx::fTools::equal(aLocalCurrent.getY(), aLocalStart.getY()))
+ {
+ if(aLocalStart.getY() < 0.5)
+ {
+ aDiscreteChangeMatrix.scale(1.0, aLocalCurrent.getY());
+ }
+ else
+ {
+ aDiscreteChangeMatrix.scale(1.0, 1.0 - aLocalCurrent.getY());
+ aDiscreteChangeMatrix.translate(0.0, aLocalCurrent.getY());
+ }
+ }
+
+ // preparematrix to apply to object; evtl. back-correct shear
+ basegfx::B2DHomMatrix aNewObjectMatrix(aOriginalMatrix * aDiscreteChangeMatrix);
+
+ if(bShearCorrected)
+ {
+ // TTTT back-correct shear
+ basegfx::B2DTuple aScale;
+ basegfx::B2DTuple aTranslate;
+ double fRotate(0.0), fShearX(0.0);
+
+ aNewObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+ aNewObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aScale,
+ -fShearX,
+ fRotate,
+ aTranslate);
+ }
+
+ // apply change to object by applying the unit coordinate change followed
+ // by the original change
+ pObj->TRSetBaseGeometry(aNewObjectMatrix, aPolyPolygon);
+
+ // the following old code uses aOldRect/aNewRect to calculate the crop change for
+ // the crop item. It implies unrotated objects, so create the unrotated original
+ // rectangle and the unrotated modified rectangle. Latter can in case of shear and/or
+ // rotation not be fetched by using
+ //
+ //Rectangle aNewRect( pObj->GetLogicRect() );
+ //
+ // as it was done before because the top-left of that new rect *will* have an offset
+ // caused by the evtl. existing shear and/or rotation, so calculate a unrotated
+ // rectangle how it would be as a result when applying the unit coordinate change
+ // to the unrotated original transformation.
+ basegfx::B2DTuple aScale;
+ basegfx::B2DTuple aTranslate;
+ double fRotate, fShearX;
+
+ // get access to scale and translate
+ aOriginalMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // prepare unsheared/unrotated versions of the old and new transformation
+ const basegfx::B2DHomMatrix aMatrixOriginalNoShearNoRotate(
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ basegfx::absolute(aScale),
+ aTranslate));
+
+ // create the ranges for these
+ basegfx::B2DRange aRangeOriginalNoShearNoRotate(0.0, 0.0, 1.0, 1.0);
+ basegfx::B2DRange aRangeNewNoShearNoRotate(0.0, 0.0, 1.0, 1.0);
+
+ aRangeOriginalNoShearNoRotate.transform(aMatrixOriginalNoShearNoRotate);
+ aRangeNewNoShearNoRotate.transform(aMatrixOriginalNoShearNoRotate * aDiscreteChangeMatrix);
+
+ // extract the old Rectangle structures
+ Rectangle aOldRect(
+ basegfx::fround(aRangeOriginalNoShearNoRotate.getMinX()),
+ basegfx::fround(aRangeOriginalNoShearNoRotate.getMinY()),
+ basegfx::fround(aRangeOriginalNoShearNoRotate.getMaxX()),
+ basegfx::fround(aRangeOriginalNoShearNoRotate.getMaxY()));
+ Rectangle aNewRect(
+ basegfx::fround(aRangeNewNoShearNoRotate.getMinX()),
+ basegfx::fround(aRangeNewNoShearNoRotate.getMinY()),
+ basegfx::fround(aRangeNewNoShearNoRotate.getMaxX()),
+ basegfx::fround(aRangeNewNoShearNoRotate.getMaxY()));
+
+ // continue with the old original stuff
double fScaleX = ( aGraphicSize.Width() - rOldCrop.GetLeft() - rOldCrop.GetRight() ) / (double)aOldRect.GetWidth();
double fScaleY = ( aGraphicSize.Height() - rOldCrop.GetTop() - rOldCrop.GetBottom() ) / (double)aOldRect.GetHeight();
- // not needed since the modification is done in unit coordinates, free from shear/rotate and mirror
- // // TTTT may be removed or exhanged by other stuff in aw080
- // // to correct the never working combination of cropped images and mirroring
- // // I have to correct the rectangles the calculation is based on here. In the current
- // // core geometry stuff a vertical mirror is expressed as 180 degree rotation. All
- // // this can be removed again when aw080 will have cleaned up the old
- // // (non-)transformation mess in the core.
- // if(18000 == pObj->GetGeoStat().nDrehWink)
- // {
- // // old notation of vertical mirror, need to correct diffs since both rects
- // // are rotated by 180 degrees
- // aOldRect = Rectangle(aOldRect.TopLeft() - (aOldRect.BottomRight() - aOldRect.TopLeft()), aOldRect.TopLeft());
- // aNewRect = Rectangle(aNewRect.TopLeft() - (aNewRect.BottomRight() - aNewRect.TopLeft()), aNewRect.TopLeft());
- // }
+ // not needed since the modification is done in unit coordinates, free from shear/rotate and mirror
+ // // TTTT may be removed or exhanged by other stuff in aw080
+ // // to correct the never working combination of cropped images and mirroring
+ // // I have to correct the rectangles the calculation is based on here. In the current
+ // // core geometry stuff a vertical mirror is expressed as 180 degree rotation. All
+ // // this can be removed again when aw080 will have cleaned up the old
+ // // (non-)transformation mess in the core.
+ // if(18000 == pObj->GetGeoStat().nDrehWink)
+ // {
+ // // old notation of vertical mirror, need to correct diffs since both rects
+ // // are rotated by 180 degrees
+ // aOldRect = Rectangle(aOldRect.TopLeft() - (aOldRect.BottomRight() - aOldRect.TopLeft()), aOldRect.TopLeft());
+ // aNewRect = Rectangle(aNewRect.TopLeft() - (aNewRect.BottomRight() - aNewRect.TopLeft()), aNewRect.TopLeft());
+ // }
sal_Int32 nDiffLeft = aNewRect.nLeft - aOldRect.nLeft;
sal_Int32 nDiffTop = aNewRect.nTop - aOldRect.nTop;
sal_Int32 nDiffRight = aNewRect.nRight - aOldRect.nRight;
sal_Int32 nDiffBottom = aNewRect.nBottom - aOldRect.nBottom;
- if(pObj->IsMirrored())
- {
- // mirrored X or Y, for old stuff, exchange X
- // TTTT: check for aw080
- sal_Int32 nTmp(nDiffLeft);
- nDiffLeft = -nDiffRight;
- nDiffRight = -nTmp;
- }
+ if(pObj->IsMirrored())
+ {
+ // mirrored X or Y, for old stuff, exchange X
+ // TTTT: check for aw080
+ sal_Int32 nTmp(nDiffLeft);
+ nDiffLeft = -nDiffRight;
+ nDiffRight = -nTmp;
+ }
sal_Int32 nLeftCrop = static_cast<sal_Int32>( rOldCrop.GetLeft() + nDiffLeft * fScaleX );
sal_Int32 nTopCrop = static_cast<sal_Int32>( rOldCrop.GetTop() + nDiffTop * fScaleY );