/* -*- 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 .
*/
std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
VclMessageType::Question, VclButtonsType::YesNo,
aString)); if (xQueryBox->run() == RET_YES)
{ if (const SdrLayer* pLayer = rAdmin.GetLayer(aName))
mpDrawView->DeleteLayer(pLayer->GetName());
/* in order to redraw TabBar and Window; should be initiated later on by
a hint from Joe (as by a change if the layer order). */ // ( View::Notify() --> ViewShell::ResetActualLayer() )
mbIsLayerModeActive = false; // so that ChangeEditMode() does something
ChangeEditMode(GetEditMode(), true);
}
}
if(pCandidate)
{ // set the new candidate to text edit mode
GetView()->UnMarkAll();
GetView()->MarkObj(pCandidate, GetView()->GetSdrPageView());
GetViewFrame()->GetDispatcher()->Execute(
SID_ATTR_CHAR, SfxCallMode::ASYNCHRON);
} else
{ // insert a new page with the same page layout
GetViewFrame()->GetDispatcher()->Execute(
SID_INSERTPAGE_QUICK, SfxCallMode::ASYNCHRON);
}
} else
{
bRet = ViewShell::KeyInput(rKEvt, pWin); //If object is marked , the corresponding entry is set true , else //the corresponding entry is set false . if(KEY_TAB == rKEvt.GetKeyCode().GetCode()
|| KEY_ESCAPE == rKEvt.GetKeyCode().GetCode())
Point aWPos = GetActiveWindow()->PixelToLogic(GetActiveWindow()->GetPointerPosPixel());
if ( rRuler.GetExtraRect().Contains(rMEvt.GetPosPixel()) )
{
mpDrawView->BegSetPageOrg(aWPos);
mbIsRulerDrag = true;
} else
{ // #i34536# if no guide-lines are visible yet, that show them if( ! mpDrawView->IsHlplVisible())
mpDrawView->SetHlplVisible();
// We have to check if a context menu is shown and we have an UI // active inplace client. In that case we have to ignore the mouse // button down event. Otherwise we would crash (context menu has been // opened by inplace client and we would deactivate the inplace client, // the context menu is closed by VCL asynchronously which in the end // would work on deleted objects or the context menu has no parent anymore)
SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient(); bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() );
if (bIsOleActive && vcl::IsInPopupMenuExecute()) return;
if ( IsInputLocked() ) return;
ViewShell::MouseButtonDown(rMEvt, pWin);
//If object is marked , the corresponding entry is set true , //else the corresponding entry is set false .
FreshNavigatrTree(); if (mbPipette)
{
SfxChildWindow* pWnd = GetViewFrame()->GetChildWindow(SvxBmpMaskChildWindow::GetChildWindowId());
SvxBmpMask* pBmpMask = pWnd ? static_cast<SvxBmpMask*>(pWnd->GetWindow()) : nullptr; if (pBmpMask)
pBmpMask->PipetteClicked();
}
}
// Since the next MouseMove may execute a IsSolidDraggingNow() in // SdrCreateView::MovCreateObj and there the ApplicationBackgroundColor // is needed it is necessary to set it here. if (GetDoc())
{
ConfigureAppBackgroundColor();
mpDrawView->SetApplicationBackgroundColor( GetViewOptions().mnAppBackgroundColor );
}
ViewShell::MouseMove(rMEvt, pWin);
maMousePos = rMEvt.GetPosPixel();
::tools::Rectangle aRect;
if ( mbIsRulerDrag )
{
Point aLogPos = GetActiveWindow()->PixelToLogic(maMousePos);
mpDrawView->MovAction(aLogPos);
}
GetActiveWindow()->ReleaseMouse();
mbIsRulerDrag = false;
} else
ViewShell::MouseButtonUp(rMEvt, pWin); //If object is marked , the corresponding entry is set true , //else the corresponding entry is set false .
FreshNavigatrTree();
}
mbMouseSelecting = false;
}
void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
{ // The command event is send to the window after a possible context // menu from an inplace client is closed. Now we have the chance to // deactivate the inplace client without any problem regarding parent // windows and code on the stack.
SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient(); bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() ); if ( bIsOleActive && ( rCEvt.GetCommand() == CommandEventId::ContextMenu ))
{ // Deactivate OLE object
mpDrawView->UnmarkAll();
SelectionHasChanged(); return;
}
// Format popup with outliner language, if possible
ESelection aSelection( pOLV->GetSelection() );
eLanguage = pOLV->GetOutliner().GetLanguage( aSelection.start.nPara, aSelection.start.nIndex );
//fdo#44998 if the outliner has captured the mouse events release the lock //so the SdFieldPopup can get them
pOLV->ReleaseMouse();
SdFieldPopup aFieldPopup(pFldItem->GetField(), eLanguage);
std::unique_ptr<SvxFieldData> pField(aFieldPopup.GetField()); if (pField)
{
SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD ); // select field, so that it will be deleted on insert
ESelection aSel = pOLV->GetSelection(); bool bSel = true; if (aSel.start.nIndex == aSel.end.nIndex)
{
bSel = false;
aSel.end.nIndex++;
}
pOLV->SetSelection( aSel );
pOLV->InsertField( aFieldItem );
// reset selection back to original state if( !bSel )
aSel.end.nIndex--;
pOLV->SetSelection( aSel );
}
} else
{ // is something selected? const SdrMarkList& rMarkList(mpDrawView->GetMarkedObjectList()); if (rMarkList.GetMarkCount() == 1)
{
pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); if( HasCurrentFunction(SID_BEZIER_EDIT) && (dynamic_cast< SdrPathObj * >( pObj ) != nullptr ) )
{
aPopupId = "bezier";
} else
{ if( mpDrawView->GetTextEditObject() )
{
OutlinerView* pOutlinerView = mpDrawView->GetTextEditOutlinerView();
Point aPos(rCEvt.GetMousePosPixel());
if ( pOutlinerView )
{ if( ( rCEvt.IsMouseEvent() && pOutlinerView->IsWrongSpelledWordAtPos(aPos) ) ||
( !rCEvt.IsMouseEvent() && pOutlinerView->IsCursorAtWrongSpelledWord() ) )
{ // Popup for Online-Spelling now handled by DrawDocShell
Link<SpellCallbackInfo&,void> aLink = LINK(GetDocSh(), DrawDocShell, OnlineSpellCallback);
if( !rCEvt.IsMouseEvent() )
{
aPos = GetActiveWindow()->LogicToPixel( pOutlinerView->GetEditView().GetCursor()->GetPos() );
} // While showing the spell context menu // we lock the input so that another // context menu can not be opened during // that time (crash #i43235#). In order // to not lock the UI completely we // first release the mouse.
GetActiveWindow()->ReleaseMouse();
LockInput();
pOutlinerView->ExecuteSpellPopup(aPos, aLink);
pOutlinerView->GetEditView().Invalidate();
UnlockInput();
} else
{ if( (pObj->GetObjInventor() == SdrInventor::Default) && (pObj->GetObjIdentifier() == SdrObjKind::Table) )
{
aPopupId = "table";
} else
{
aPopupId = "drawtext";
}
}
}
} else
{
SdrInventor nInv = pObj->GetObjInventor();
SdrObjKind nId = pObj->GetObjIdentifier();
if (nInv == SdrInventor::Default)
{ switch ( nId )
{ case SdrObjKind::OutlineText: case SdrObjKind::Caption: case SdrObjKind::TitleText: case SdrObjKind::Text:
aPopupId = "textbox"; break;
case SdrObjKind::PathLine: case SdrObjKind::PolyLine:
aPopupId = "curve"; break;
case SdrObjKind::FreehandLine: case SdrObjKind::Edge:
aPopupId = "connector"; break;
case SdrObjKind::Line:
aPopupId = "line"; break;
case SdrObjKind::Measure:
aPopupId = "measure"; break;
case SdrObjKind::Rectangle: case SdrObjKind::CircleOrEllipse: case SdrObjKind::FreehandFill: case SdrObjKind::PathFill: case SdrObjKind::Polygon: case SdrObjKind::CircleSection: case SdrObjKind::CircleArc: case SdrObjKind::CircleCut: case SdrObjKind::CustomShape:
aPopupId = "draw"; break;
case SdrObjKind::Group:
aPopupId = "group"; break;
case SdrObjKind::Graphic:
aPopupId = "graphic"; break;
// nothing selected elseif (!SlideShow::IsRunning(GetViewShellBase()))
{ // tdf#163124 this is the non-native SlideShow (see !bNativeShow), // thus the above checks/actions have to be done to make the // EditView work normally, but use the "page" standard context menu // fallback only when SlideShow is not running to get the // SlideShow popup menu - as expected when SlideShow is running
aPopupId = "page";
}
} // show Popup-Menu if (!aPopupId.isEmpty())
{
GetActiveWindow()->ReleaseMouse();
if(rCEvt.IsMouseEvent())
GetViewFrame()->GetDispatcher()->ExecutePopup( aPopupId ); else
{ //don't open contextmenu at mouse position if not opened via mouse
//middle of the window if nothing is marked
Point aMenuPos(GetActiveWindow()->GetSizePixel().Width()/2
,GetActiveWindow()->GetSizePixel().Height()/2);
const SdrMarkList& rMarkList(mpDrawView->GetMarkedObjectList()); //middle of the bounding rect if something is marked if (rMarkList.GetMarkCount() >= 1)
{
::tools::Rectangle aMarkRect;
rMarkList.TakeBoundRect(nullptr,aMarkRect);
aMenuPos = GetActiveWindow()->LogicToPixel( aMarkRect.Center() );
//move the point into the visible window area if( aMenuPos.X() < 0 )
aMenuPos.setX( 0 ); if( aMenuPos.Y() < 0 )
aMenuPos.setY( 0 ); if( aMenuPos.X() > GetActiveWindow()->GetSizePixel().Width() )
aMenuPos.setX( GetActiveWindow()->GetSizePixel().Width() ); if( aMenuPos.Y() > GetActiveWindow()->GetSizePixel().Height() )
aMenuPos.setY( GetActiveWindow()->GetSizePixel().Height() );
}
//open context menu at that point
GetViewFrame()->GetDispatcher()->ExecutePopup( aPopupId, GetActiveWindow(), &aMenuPos );
}
}
} else
{
ViewShell::Command(rCEvt, pWin);
}
}
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.