/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
Point aPnt(rPnt);
basegfx::B2DVector aGridOffset(0.0, 0.0); const SdrMarkList& rMarkList = GetMarkedObjectList();
// Coordinate maybe affected by GridOffset, so we may need to // adapt to Model-coordinates here if((comphelper::LibreOfficeKit::isActive() && mpMarkedObj
&& getPossibleGridOffsetForSdrObject(aGridOffset, rMarkList.GetMark(0)->GetMarkedSdrObj(), GetSdrPageView()))
|| (getPossibleGridOffsetForPosition(
aGridOffset,
basegfx::B2DPoint(aPnt.X(), aPnt.Y()),
GetSdrPageView())))
{
aPnt.AdjustX(basegfx::fround<tools::Long>(-aGridOffset.getX()));
aPnt.AdjustY(basegfx::fround<tools::Long>(-aGridOffset.getY()));
}
maDragStat.SetView(static_cast<SdrView*>(this));
maDragStat.SetPageView(mpMarkedPV); // <<-- DragPV has to go here!!!
maDragStat.SetMinMove(ImpGetMinMovLogic(nMinMov,pOut));
maDragStat.SetHdl(pHdl);
maDragStat.NextPoint();
mpDragWin=pOut;
mpDragHdl=pHdl;
meDragHdl= pHdl==nullptr ? SdrHdlKind::Move : pHdl->GetKind();
mbDragHdl=meDragHdl==SdrHdlKind::Ref1 || meDragHdl==SdrHdlKind::Ref2 || meDragHdl==SdrHdlKind::MirrorAxis;
// Expand test for SdrHdlKind::Anchor_TR bool bNotDraggable = (SdrHdlKind::Anchor == meDragHdl || SdrHdlKind::Anchor_TR == meDragHdl);
if(pHdl && (pHdl->GetKind() == SdrHdlKind::SmartTag) && pForcedMeth )
{ // just use the forced method for smart tags
} elseif(mbDragHdl)
{
mpCurrentSdrDragMethod.reset(new SdrDragMovHdl(*this));
} elseif(!bNotDraggable)
{ switch (meDragMode)
{ case SdrDragMode::Rotate: case SdrDragMode::Shear:
{ switch (meDragHdl)
{ case SdrHdlKind::Left: case SdrHdlKind::Right: case SdrHdlKind::Upper: case SdrHdlKind::Lower:
{ // are 3D objects selected? bool b3DObjSelected = false; for(size_t a=0; !b3DObjSelected && a<rMarkList.GetMarkCount(); ++a)
{
SdrObject* pObj = rMarkList.GetMark(a)->GetMarkedSdrObj(); if(DynCastE3dObject(pObj))
b3DObjSelected = true;
} // If yes, allow shear even when !IsShearAllowed, // because 3D objects are limited rotations if (!b3DObjSelected && !IsShearAllowed()) returnfalse;
mpCurrentSdrDragMethod.reset(new SdrDragShear(*this,meDragMode==SdrDragMode::Rotate));
} break; case SdrHdlKind::UpperLeft: case SdrHdlKind::UpperRight: case SdrHdlKind::LowerLeft: case SdrHdlKind::LowerRight:
{ if (meDragMode==SdrDragMode::Shear)
{ if (!IsDistortAllowed(true) && !IsDistortAllowed()) returnfalse;
mpCurrentSdrDragMethod.reset(new SdrDragDistort(*this));
} else
{ if (!IsRotateAllowed(true)) returnfalse;
mpCurrentSdrDragMethod.reset(new SdrDragRotate(*this));
}
} break; default:
{ if (IsMarkedHitMovesAlways() && meDragHdl==SdrHdlKind::Move)
{ // SdrHdlKind::Move is true, even if Obj is hit directly if (!IsMoveAllowed()) returnfalse;
mpCurrentSdrDragMethod.reset(new SdrDragMove(*this));
} else
{ if (!IsRotateAllowed(true)) returnfalse;
mpCurrentSdrDragMethod.reset(new SdrDragRotate(*this));
}
}
}
} break; case SdrDragMode::Mirror:
{ if (meDragHdl==SdrHdlKind::Move && IsMarkedHitMovesAlways())
{ if (!IsMoveAllowed()) returnfalse;
mpCurrentSdrDragMethod.reset(new SdrDragMove(*this));
} else
{ if (!IsMirrorAllowed(true,true)) returnfalse;
mpCurrentSdrDragMethod.reset(new SdrDragMirror(*this));
}
} break;
case SdrDragMode::Crop:
{ if (meDragHdl==SdrHdlKind::Move && IsMarkedHitMovesAlways())
{ if (!IsMoveAllowed()) returnfalse;
mpCurrentSdrDragMethod.reset(new SdrDragMove(*this));
} else
{ if (!IsCropAllowed()) returnfalse;
mpCurrentSdrDragMethod.reset(new SdrDragCrop(*this));
}
} break;
if(bConnectorSelected)
{ // #i97784# // fallback to old behaviour for connectors (see // text in task description for more details)
} elseif(!IsMoveAllowed() || !IsResizeAllowed())
{ // #i77187# // do not allow move of polygon points if object is move or size protected returnfalse;
}
}
if(!mpCurrentSdrDragMethod)
{ // fallback to DragSpecial if no interaction defined
mpCurrentSdrDragMethod.reset( new SdrDragObjOwn(*this) );
}
}
}
}
}
} if (pForcedMeth)
{
mpCurrentSdrDragMethod = std::move(pForcedMeth);
}
maDragStat.SetDragMethod(mpCurrentSdrDragMethod.get()); if (mpCurrentSdrDragMethod)
{
bRet = mpCurrentSdrDragMethod->BeginSdrDrag(); if (!bRet)
{ if (pHdl==nullptr && dynamic_cast< const SdrDragObjOwn* >(mpCurrentSdrDragMethod.get()) != nullptr)
{ // Obj may not Move SpecialDrag, so try with MoveFrameDrag
mpCurrentSdrDragMethod.reset();
if (!IsMoveAllowed()) returnfalse;
mbFramDrag=true;
mpCurrentSdrDragMethod.reset( new SdrDragMove(*this) );
maDragStat.SetDragMethod(mpCurrentSdrDragMethod.get());
bRet = mpCurrentSdrDragMethod->BeginSdrDrag();
}
} if (!bRet)
{
mpCurrentSdrDragMethod.reset();
maDragStat.SetDragMethod(mpCurrentSdrDragMethod.get());
}
}
}
return bRet;
}
void SdrDragView::MovDragObj(const Point& rPnt)
{ if (!mpCurrentSdrDragMethod) return;
Point aPnt(rPnt);
basegfx::B2DVector aGridOffset(0.0, 0.0);
// Coordinate maybe affected by GridOffset, so we may need to // adapt to Model-coordinates here const SdrMarkList& rMarkList = GetMarkedObjectList(); if((comphelper::LibreOfficeKit::isActive() && mpMarkedObj
&& getPossibleGridOffsetForSdrObject(aGridOffset, rMarkList.GetMark(0)->GetMarkedSdrObj(), GetSdrPageView()))
|| (getPossibleGridOffsetForPosition(
aGridOffset,
basegfx::B2DPoint(aPnt.X(), aPnt.Y()),
GetSdrPageView())))
{
aPnt.AdjustX(basegfx::fround<tools::Long>(-aGridOffset.getX()));
aPnt.AdjustY(basegfx::fround<tools::Long>(-aGridOffset.getY()));
}
ImpLimitToWorkArea(aPnt);
mpCurrentSdrDragMethod->MoveSdrDrag(aPnt); // this call already makes a Hide()/Show combination
}
// #i73341# If inserting GluePoint, do not insist on last points being different if(mpCurrentSdrDragMethod && maDragStat.IsMinMoved() && (IsInsertGluePoint() || maDragStat.GetNow() != maDragStat.GetPrev()))
{
sal_Int32 nSavedHdlCount=0;
if (mbEliminatePolyPoints)
{
nSavedHdlCount=GetMarkablePointCount();
}
// Changed for the GridOffset stuff: No longer iterate over // SdrPaintWindow(s), but now over SdrPageWindow(s), so doing the // same as the SdrHdl visualizations (see ::CreateB2dIAObject) do. // This is needed to get access to an ObjectContact which is needed // to evtl. process that GridOffset in CreateOverlayGeometry
SdrPageView* pPageView(GetSdrPageView());
bool SdrDragView::IsSolidDragging() const
{ // allow each user to disable by having a local setting, but using AND for // checking allowance return mbSolidDragging && officecfg::Office::Common::Drawinglayer::SolidDragCreate::get();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.