/* -*- 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 aPos = mpWindow->OutputToScreenPixel(aPixPos); const ::tools::Rectangle& rRect = mrViewShell.GetAllWindowRect();
if ( bNoScrollUntilInside )
{ if ( rRect.Contains(aPos) )
bNoScrollUntilInside = false;
} else
{ short dx = 0, dy = 0;
if ( aPos.X() <= rRect.Left() ) dx = -1; if ( aPos.X() >= rRect.Right() ) dx = 1; if ( aPos.Y() <= rRect.Top() ) dy = -1; if ( aPos.Y() >= rRect.Bottom() ) dy = 1;
if ( dx != 0 || dy != 0 )
{ if (bScrollable)
{ // scroll action in derived class
mrViewShell.ScrollLines(dx, dy);
aScrollTimer.Start();
} elseif (! bDelayActive) StartDelayToScrollTimer ();
}
}
}
/** * timer handler for window scrolling
*/
IMPL_LINK_NOARG(FuPoor, ScrollHdl, Timer *, void)
{
Point aPnt(mpWindow->GetPointerPosPixel());
// use remembered MouseButton state to create correct // MouseEvents for this artificial MouseMove.
MouseMove(MouseEvent(aPnt, 1, MouseEventModifiers::NONE, GetMouseButtonCode()));
}
mrViewShell.GetViewFrame()->GetDispatcher()->Execute(
SID_ATTR_CHAR, SfxCallMode::ASYNCHRON);
} else
{ // insert a new page with the same page layout
mrViewShell.GetViewFrame()->GetDispatcher()->Execute(
SID_INSERTPAGE_QUICK, SfxCallMode::ASYNCHRON);
}
// consumed
bReturn = true;
}
} elseif (!mpDocSh->IsReadOnly())
{ // activate OLE object on RETURN for selected object // activate text edit on RETURN for selected object const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
case KEY_TAB:
{ // handle Mod1 and Mod2 to get travelling running on different systems if(rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2())
{ // do something with a selected handle? const SdrHdlList& rHdlList = mpView->GetHdlList(); bool bForward(!rKEvt.GetKeyCode().IsShift());
if( auto pDrawViewShell = dynamic_cast<DrawViewShell *>( &mrViewShell ) )
{ // The page-up key switches layers or pages depending on the // modifier key. if ( ! rKEvt.GetKeyCode().GetModifier())
{ // With no modifier pressed we move to the previous // slide.
mpView->SdrEndTextEdit();
if (nSdPage > 0)
{ // Switch the page and send events regarding // deactivation the old page and activating the new // one.
TabControl& rPageTabControl =
pDrawViewShell->GetPageTabControl(); if (rPageTabControl.IsReallyShown())
rPageTabControl.SendDeactivatePageEvent ();
pDrawViewShell->SwitchPage(nSdPage - 1); if (rPageTabControl.IsReallyShown())
rPageTabControl.SendActivatePageEvent ();
}
} elseif (rKEvt.GetKeyCode().IsMod1())
{ // With the CONTROL modifier we switch layers. if (pDrawViewShell->IsLayerModeActive())
{ // Moves to the previous layer.
SwitchLayer (-1);
}
}
}
} break;
case KEY_PAGEDOWN:
{ if( rKEvt.GetKeyCode().IsMod1() && rKEvt.GetKeyCode().IsMod2() ) break; if(dynamic_cast< const DrawViewShell *>( &mrViewShell ) != nullptr && !bSlideShow)
{ // The page-down key switches layers or pages depending on the // modifier key. if ( ! rKEvt.GetKeyCode().GetModifier())
{ // With no modifier pressed we move to the next slide.
mpView->SdrEndTextEdit();
if (nSdPage < mrDoc.GetSdPageCount(pPage->GetPageKind()) - 1)
{ // Switch the page and send events regarding // deactivation the old page and activating the new // one.
TabControl& rPageTabControl = static_cast<DrawViewShell*>(&mrViewShell)->GetPageTabControl(); if (rPageTabControl.IsReallyShown())
rPageTabControl.SendDeactivatePageEvent (); static_cast<DrawViewShell*>(&mrViewShell)->SwitchPage(nSdPage + 1); if (rPageTabControl.IsReallyShown())
rPageTabControl.SendActivatePageEvent ();
}
} elseif (rKEvt.GetKeyCode().IsMod1())
{ // With the CONTROL modifier we switch layers. if (static_cast<DrawViewShell*>(&mrViewShell)->IsLayerModeActive())
{ // With the layer mode active pressing page-down // moves to the next layer.
SwitchLayer (+1);
}
}
}
} break;
// change select state when focus is on poly point case KEY_SPACE:
{ const SdrHdlList& rHdlList = mpView->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());
if(100 < aHalfConSiz.Height())
nY *= aHalfConSiz.Height(); else
nY *= 100;
} elseif(rKEvt.GetKeyCode().IsMod2())
{ // move in 1 pixel distance
Size aLogicSizeOnePixel = mpWindow->PixelToLogic(Size(1,1));
nX *= aLogicSizeOnePixel.Width();
nY *= aLogicSizeOnePixel.Height();
} elseif(rKEvt.GetKeyCode().IsShift())
{
nX *= 1000;
nY *= 1000;
} else
{ // old, fixed move distance
nX *= 100;
nY *= 100;
}
if(nullptr == pHdl)
{ // only take action when move is allowed if(mpView->IsMoveAllowed())
{ // restrict movement to WorkArea const ::tools::Rectangle& rWorkArea = mpView->GetWorkArea();
// make moved handle visible
::tools::Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200));
mpView->MakeVisible(aVisRect, *mpWindow);
}
}
if(pEdgeObj)
{ // Restore original suppress value
pEdgeObj->SetSuppressDefaultConnect(bOldSuppress);
}
} else
{ // scroll page
mrViewShell.ScrollLines(nX, nY);
}
bReturn = true;
}
} break;
}
if (bReturn)
{
mpWindow->ReleaseMouse();
}
// when a text-editable object is selected and the // input character is printable, activate text edit on that object // and feed character to object if(!bReturn && !mpDocSh->IsReadOnly())
{ if (!mpView->IsTextEdit())
{ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
// #i118485# allow TextInput for OLEs, too if( DynCastSdrTextObj( pObj ) != nullptr && pObj->HasTextEdit())
{ // use common IsSimpleCharInput from the EditEngine. bool bPrintable(EditEngine::IsSimpleCharInput(rKEvt));
if(bPrintable)
{ // try to activate textedit mode for the selected object
SfxStringItem aInputString(SID_ATTR_CHAR, OUString(rKEvt.GetCharCode()));
// consumed
bReturn = true;
}
}
} else
{ // test if there is a title object there. If yes, try to // set it to edit mode and start typing...
DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(&mrViewShell); if (pDrawViewShell && EditEngine::IsSimpleCharInput(rKEvt))
{
SdPage* pActualPage = pDrawViewShell->GetActualPage();
SdrTextObj* pCandidate = nullptr;
// use remembered MouseButton state to create correct // MouseEvents for this artificial MouseMove.
MouseMove(MouseEvent(aPnt, 1, MouseEventModifiers::NONE, GetMouseButtonCode()));
}
bool FuPoor::MouseButtonUp (const MouseEvent& rMEvt)
{ // remember button state for creation of own MouseEvents
SetMouseButtonCode(rMEvt.GetButtons());
bool FuPoor::MouseButtonDown(const MouseEvent& rMEvt)
{ // remember button state for creation of own MouseEvents
SetMouseButtonCode(rMEvt.GetButtons());
// Calculate the new index.
sal_Int32 nIndex = pDrawViewShell->GetActiveTabLayerIndex() + nOffset;
// Make sure the new index lies inside the range of valid indices. if (nIndex < 0)
nIndex = 0; elseif (nIndex >= pDrawViewShell->GetTabLayerCount ())
nIndex = pDrawViewShell->GetTabLayerCount() - 1;
// Set the new active layer. if (nIndex != pDrawViewShell->GetActiveTabLayerIndex ())
{
LayerTabBar* pLayerTabControl = static_cast<DrawViewShell*>(&mrViewShell)->GetLayerTabControl(); if (pLayerTabControl != nullptr)
pLayerTabControl->SendDeactivatePageEvent ();
pDrawViewShell->SetActiveTabLayerIndex (nIndex);
if (pLayerTabControl != nullptr)
pLayerTabControl->SendActivatePageEvent ();
}
}
/** is called when the current function should be aborted. <p> This is used when a function gets a KEY_ESCAPE but can also be called directly.
@returns true if an active function was aborted
*/ bool FuPoor::cancel()
{ if ( dynamic_cast< const FuSelection *>( this ) == nullptr )
{
mrViewShell.GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON); returntrue;
}
returnfalse;
}
// #i33136# bool FuPoor::doConstructOrthogonal() const
{ // Check whether a media object is selected bool bResizeKeepRatio = false; const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); // tdf#89758 Avoid interactive crop preview from being proportionally scaled by default. if (rMarkList.GetMarkCount() != 0 && mpView->GetDragMode() != SdrDragMode::Crop)
{ if (rMarkList.GetMarkCount() == 1)
{
SdrObjKind aObjIdentifier = rMarkList.GetMark(0)->GetMarkedSdrObj()->GetObjIdentifier();
bResizeKeepRatio = aObjIdentifier == SdrObjKind::Graphic ||
aObjIdentifier == SdrObjKind::Media ||
aObjIdentifier == SdrObjKind::OLE2;
}
}
SdrHdl* pHdl = mpView->PickHandle(aMDPos); // Resize proportionally when media is selected and the user drags on a corner if (pHdl)
bResizeKeepRatio = bResizeKeepRatio && pHdl->IsCornerHdl();
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.