if (pView->IsOrtho() != bOrtho)
pView->SetOrtho(bOrtho); if (pView->IsAngleSnapEnabled() != bAngleSnap)
pView->SetAngleSnapEnabled(bAngleSnap);
if (pView->IsCreate1stPointAsCenter() != bCenter)
pView->SetCreate1stPointAsCenter(bCenter); if (pView->IsResizeAtCenter() != bCenter)
pView->SetResizeAtCenter(bCenter);
}
void FuDraw::ResetModifiers()
{ if (!pView) return;
if (pView->IsOrtho())
pView->SetOrtho(false); if (pView->IsAngleSnapEnabled())
pView->SetAngleSnapEnabled(false);
if (pView->IsGridSnap() != bGridOpt)
pView->SetGridSnap(bGridOpt); if (pView->IsSnapEnabled() != bGridOpt)
pView->SetSnapEnabled(bGridOpt);
if (pView->IsCreate1stPointAsCenter())
pView->SetCreate1stPointAsCenter(false); if (pView->IsResizeAtCenter())
pView->SetResizeAtCenter(false);
}
bool FuDraw::MouseButtonDown(const MouseEvent& rMEvt)
{ // remember button state for creation of own MouseEvents
SetMouseButtonCode(rMEvt.GetButtons());
DoModifiers( rMEvt ); returnfalse;
}
bool FuDraw::MouseMove(const MouseEvent& rMEvt)
{ // evaluate modifiers only if in a drawing layer action // (don't interfere with keyboard shortcut handling) if (pView->IsAction())
DoModifiers( rMEvt );
returnfalse;
}
bool FuDraw::MouseButtonUp(const MouseEvent& rMEvt)
{ // remember button state for creation of own MouseEvents
SetMouseButtonCode(rMEvt.GetButtons());
ResetModifiers(); returnfalse;
}
// Process Keyboard events. Return true if an event is being handled staticbool lcl_KeyEditMode( SdrObject* pObj, ScTabViewShell& rViewShell, const KeyEvent* pInitialKey )
{ bool bReturn = false; if ( DynCastSdrTextObj( pObj) != nullptr && dynamic_cast<const SdrUnoObj*>( pObj) == nullptr )
{
assert(pObj); // start text edit - like FuSelection::MouseButtonUp, // but with bCursorToEnd instead of mouse position
// don't switch shells if text shell is already active
FuPoor* pPoor = rViewShell.GetViewData().GetView()->GetDrawFuncPtr(); if ( !pPoor || pPoor->GetSlotID() != nTextSlotId )
{
rViewShell.GetViewData().GetDispatcher().
Execute(nTextSlotId, SfxCallMode::SYNCHRON | SfxCallMode::RECORD);
}
// get the resulting FuText and set in edit mode
pPoor = rViewShell.GetViewData().GetView()->GetDrawFuncPtr(); if ( pPoor && pPoor->GetSlotID() == nTextSlotId ) // no RTTI
{
FuText* pText = static_cast<FuText*>(pPoor);
pText->SetInEditMode( pObj, nullptr, true, pInitialKey ); //! set cursor to end of text
}
bReturn = true;
} return bReturn;
}
case KEY_F2:
{ if( rKEvt.GetKeyCode().GetModifier() == 0 )
{ // put selected text object in edit mode // (this is not SID_SETINPUTMODE, but F2 hardcoded, like in Writer) if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); bool isMobilePhone = comphelper::LibreOfficeKit::isActive() && rViewShell.isLOKMobilePhone(); // Double tapping on charts on phone may result in activating the edit mode which is not wanted. // It happens due to the delay of selection message of the object from kit to javascript // in that case F2 is sent instead of double click if (isMobilePhone && ScDocument::IsChart(pObj))
{
rViewShell.ActivateObject(static_cast<SdrOle2Obj*>(pObj), css::embed::EmbedVerbs::MS_OLEVERB_PRIMARY); break;
} if ( lcl_KeyEditMode( pObj, rViewShell, nullptr ) ) // start text edit for suitable object
bReturn = true;
}
}
} break;
case KEY_TAB:
{ // in calc do NOT start draw object selection using TAB/SHIFT-TAB when // there is not yet an object selected if(rMarkList.GetMarkCount() != 0)
{
vcl::KeyCode aCode = rKEvt.GetKeyCode();
if ( !aCode.IsMod1() && !aCode.IsMod2() )
{ // changeover to the next object if(!pView->MarkNextObj( !aCode.IsShift() ))
{ //If there is only one object, don't do the UnmarkAllObj() & MarkNextObj(). if ( pView->HasMultipleMarkableObjects() && pView->HasMarkableObj() )
{ // No next object: go over open end and // get first from the other side
pView->UnmarkAllObj();
pView->MarkNextObj(!aCode.IsShift());
}
}
// II if(rMarkList.GetMarkCount() != 0)
pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow);
bReturn = true;
}
// handle Mod1 and Mod2 to get travelling running on different systems if(rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2())
{ // II do something with a selected handle? const SdrHdlList& rHdlList = pView->GetHdlList(); bool bForward(!rKEvt.GetKeyCode().IsShift());
case KEY_END:
{ // in calc do NOT select the last draw object when // there is not yet an object selected if(rMarkList.GetMarkCount() != 0)
{
vcl::KeyCode aCode = rKEvt.GetKeyCode();
if ( aCode.IsMod1() )
{ // mark last object
pView->UnmarkAllObj();
pView->MarkNextObj();
// II if(rMarkList.GetMarkCount() != 0)
pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow);
bReturn = true;
}
}
} break;
case KEY_HOME:
{ // in calc do NOT select the first draw object when // there is not yet an object selected if(rMarkList.GetMarkCount() != 0)
{
vcl::KeyCode aCode = rKEvt.GetKeyCode();
if ( aCode.IsMod1() )
{ // mark first object
pView->UnmarkAllObj();
pView->MarkNextObj(true);
// II if(rMarkList.GetMarkCount() != 0)
pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow);
bReturn = true;
}
}
} break;
case KEY_UP: case KEY_DOWN: case KEY_LEFT: case KEY_RIGHT:
{ // in calc do cursor travelling of draw objects only when // there is an object selected yet if(rMarkList.GetMarkCount() != 0)
{
if(rMarkList.GetMarkCount() == 1)
{ // disable cursor travelling on note objects as the tail connector position // must not move.
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); if( ScDrawLayer::IsNoteCaption( pObj ) ) break;
}
if(!rKEvt.GetKeyCode().IsMod1() && !bReadOnly)
{ if(rKEvt.GetKeyCode().IsMod2())
{ // move in 1 pixel distance
Size aLogicSizeOnePixel = pWindow ? pWindow->PixelToLogic(Size(1,1)) : Size(100, 100);
nX *= aLogicSizeOnePixel.Width();
nY *= aLogicSizeOnePixel.Height();
} elseif(rKEvt.GetKeyCode().IsShift()) // #i121236# Support for shift key in calc
{
nX *= 1000;
nY *= 1000;
} else
{ // old, fixed move distance
nX *= 100;
nY *= 100;
}
// is there a movement to do? if(0 != nX || 0 != nY)
{ // II const SdrHdlList& rHdlList = pView->GetHdlList();
SdrHdl* pHdl = rHdlList.GetFocusHdl();
if(nullptr == pHdl)
{ // only take action when move is allowed if(pView->IsMoveAllowed())
{ // restrict movement to WorkArea const tools::Rectangle& rWorkArea = pView->GetWorkArea();
// make moved handle visible
tools::Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200));
pView->MakeVisible(aVisRect, *pWindow);
bReturn = true;
}
}
}
}
}
} break;
case KEY_SPACE:
{ // in calc do only something when draw objects are selected if(rMarkList.GetMarkCount() != 0)
{ const SdrHdlList& rHdlList = pView->GetHdlList();
SdrHdl* pHdl = rHdlList.GetFocusHdl();
if(pHdl)
{ if(pHdl->GetKind() == SdrHdlKind::Poly)
{ // rescue ID of point with focus
sal_uInt32 nPol(pHdl->GetPolyNum());
sal_uInt32 nPnt(pHdl->GetPointNum());
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.