1*5b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5b190011SAndrew Rist * distributed with this work for additional information 6*5b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5b190011SAndrew Rist * "License"); you may not use this file except in compliance 9*5b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*5b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5b190011SAndrew Rist * software distributed under the License is distributed on an 15*5b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5b190011SAndrew Rist * KIND, either express or implied. See the License for the 17*5b190011SAndrew Rist * specific language governing permissions and limitations 18*5b190011SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*5b190011SAndrew Rist *************************************************************/ 21*5b190011SAndrew Rist 22*5b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include "fusel.hxx" 29cdf0e10cSrcweir #include <vos/process.hxx> 30cdf0e10cSrcweir #include <basic/sbstar.hxx> 31cdf0e10cSrcweir #include <svx/svdpagv.hxx> 32cdf0e10cSrcweir #include <svx/svdogrp.hxx> 33cdf0e10cSrcweir #include <svx/polysc3d.hxx> 34cdf0e10cSrcweir #include "drawview.hxx" 35cdf0e10cSrcweir #include <svtools/imapobj.hxx> 36cdf0e10cSrcweir #include <svl/urihelper.hxx> 37cdf0e10cSrcweir #include <unotools/localfilehelper.hxx> 38cdf0e10cSrcweir #include <svx/svxids.hrc> 39cdf0e10cSrcweir #include <svx/xfillit0.hxx> 40cdf0e10cSrcweir #include <sfx2/app.hxx> 41cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 42cdf0e10cSrcweir #include <svl/aeitem.hxx> 43cdf0e10cSrcweir #include <svl/stritem.hxx> 44cdf0e10cSrcweir #include <svl/intitem.hxx> 45cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 46cdf0e10cSrcweir #include <tools/urlobj.hxx> 47cdf0e10cSrcweir #include <sfx2/docfile.hxx> 48cdf0e10cSrcweir #include <tools/debug.hxx> 49cdf0e10cSrcweir #include <editeng/eeitem.hxx> 50cdf0e10cSrcweir #include <editeng/flditem.hxx> 51cdf0e10cSrcweir 52cdf0e10cSrcweir #include <svx/svdotable.hxx> 53cdf0e10cSrcweir 54cdf0e10cSrcweir #include "app.hrc" 55cdf0e10cSrcweir #include "strings.hrc" 56cdf0e10cSrcweir #include "res_bmp.hrc" 57cdf0e10cSrcweir #include "GraphicDocShell.hxx" 58cdf0e10cSrcweir #include "app.hxx" 59cdf0e10cSrcweir #include "DrawDocShell.hxx" 60cdf0e10cSrcweir #include "stlpool.hxx" 61cdf0e10cSrcweir #include "anmdef.hxx" 62cdf0e10cSrcweir #include "anminfo.hxx" 63cdf0e10cSrcweir #include "fudraw.hxx" 64cdf0e10cSrcweir #include "ViewShell.hxx" 65cdf0e10cSrcweir #include "ViewShellBase.hxx" 66cdf0e10cSrcweir #ifndef SD_FRAMW_VIEW_HXX 67cdf0e10cSrcweir #include "FrameView.hxx" 68cdf0e10cSrcweir #endif 69cdf0e10cSrcweir #include "View.hxx" 70cdf0e10cSrcweir #ifndef SD_WINDOW_SHELL_HXX 71cdf0e10cSrcweir #include "Window.hxx" 72cdf0e10cSrcweir #endif 73cdf0e10cSrcweir #include "drawdoc.hxx" 74cdf0e10cSrcweir #include "sdpage.hxx" 75cdf0e10cSrcweir #include "DrawViewShell.hxx" 76cdf0e10cSrcweir #include "ToolBarManager.hxx" 77cdf0e10cSrcweir #include "pgjump.hxx" 78cdf0e10cSrcweir #include <svx/globl3d.hxx> 79cdf0e10cSrcweir #include "Client.hxx" 80cdf0e10cSrcweir 81cdf0e10cSrcweir #include "slideshow.hxx" 82cdf0e10cSrcweir 83cdf0e10cSrcweir // #108981# 84cdf0e10cSrcweir #include <svx/svdundo.hxx> 85cdf0e10cSrcweir #include <avmedia/mediawindow.hxx> 86cdf0e10cSrcweir 87cdf0e10cSrcweir #include <svx/sdrhittesthelper.hxx> 88cdf0e10cSrcweir 89cdf0e10cSrcweir using namespace ::com::sun::star; 90cdf0e10cSrcweir 91cdf0e10cSrcweir namespace sd { 92cdf0e10cSrcweir 93cdf0e10cSrcweir TYPEINIT1( FuSelection, FuDraw ); 94cdf0e10cSrcweir 95cdf0e10cSrcweir /************************************************************************* 96cdf0e10cSrcweir |* 97cdf0e10cSrcweir |* Konstruktor 98cdf0e10cSrcweir |* 99cdf0e10cSrcweir \************************************************************************/ 100cdf0e10cSrcweir 101cdf0e10cSrcweir FuSelection::FuSelection ( 102cdf0e10cSrcweir ViewShell* pViewSh, 103cdf0e10cSrcweir ::sd::Window* pWin, 104cdf0e10cSrcweir ::sd::View* pView, 105cdf0e10cSrcweir SdDrawDocument* pDoc, 106cdf0e10cSrcweir SfxRequest& rReq) 107cdf0e10cSrcweir : FuDraw(pViewSh, pWin, pView, pDoc, rReq), 108cdf0e10cSrcweir bTempRotation(sal_False), 109cdf0e10cSrcweir bSelectionChanged(sal_False), 110cdf0e10cSrcweir bHideAndAnimate(sal_False), 111cdf0e10cSrcweir pHdl(NULL), 112cdf0e10cSrcweir bSuppressChangesOfSelection(sal_False), 113cdf0e10cSrcweir bMirrorSide0(sal_False), 114cdf0e10cSrcweir nEditMode(SID_BEZIER_MOVE), 115cdf0e10cSrcweir pWaterCanCandidate(NULL) 116cdf0e10cSrcweir { 117cdf0e10cSrcweir } 118cdf0e10cSrcweir 119cdf0e10cSrcweir FunctionReference FuSelection::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ) 120cdf0e10cSrcweir { 121cdf0e10cSrcweir FunctionReference xFunc( new FuSelection( pViewSh, pWin, pView, pDoc, rReq ) ); 122cdf0e10cSrcweir xFunc->DoExecute(rReq); 123cdf0e10cSrcweir return xFunc; 124cdf0e10cSrcweir } 125cdf0e10cSrcweir 126cdf0e10cSrcweir void FuSelection::DoExecute( SfxRequest& rReq ) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir FuDraw::DoExecute( rReq ); 129cdf0e10cSrcweir 130cdf0e10cSrcweir // Objektbar auswaehlen 131cdf0e10cSrcweir SelectionHasChanged(); 132cdf0e10cSrcweir } 133cdf0e10cSrcweir 134cdf0e10cSrcweir /************************************************************************* 135cdf0e10cSrcweir |* 136cdf0e10cSrcweir |* Destruktor 137cdf0e10cSrcweir |* 138cdf0e10cSrcweir \************************************************************************/ 139cdf0e10cSrcweir 140cdf0e10cSrcweir FuSelection::~FuSelection() 141cdf0e10cSrcweir { 142cdf0e10cSrcweir mpView->UnmarkAllPoints(); 143cdf0e10cSrcweir mpView->ResetCreationActive(); 144cdf0e10cSrcweir 145cdf0e10cSrcweir if ( mpView->GetDragMode() != SDRDRAG_MOVE ) 146cdf0e10cSrcweir { 147cdf0e10cSrcweir mpView->SetDragMode(SDRDRAG_MOVE); 148cdf0e10cSrcweir } 149cdf0e10cSrcweir } 150cdf0e10cSrcweir 151cdf0e10cSrcweir /************************************************************************* 152cdf0e10cSrcweir |* 153cdf0e10cSrcweir |* MouseButtonDown-event 154cdf0e10cSrcweir |* 155cdf0e10cSrcweir \************************************************************************/ 156cdf0e10cSrcweir 157cdf0e10cSrcweir sal_Bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) 158cdf0e10cSrcweir { 159cdf0e10cSrcweir // Hack fuer #?????# 160cdf0e10cSrcweir bHideAndAnimate = sal_False; 161cdf0e10cSrcweir 162cdf0e10cSrcweir pHdl = NULL; 163cdf0e10cSrcweir sal_Bool bReturn = FuDraw::MouseButtonDown(rMEvt); 164cdf0e10cSrcweir sal_Bool bWaterCan = SD_MOD()->GetWaterCan(); 165cdf0e10cSrcweir const bool bReadOnly = mpDocSh->IsReadOnly(); 166cdf0e10cSrcweir // When the right mouse button is pressed then only select objects 167cdf0e10cSrcweir // (and deselect others) as a preparation for showing the context 168cdf0e10cSrcweir // menu. 169cdf0e10cSrcweir const bool bSelectionOnly = rMEvt.IsRight(); 170cdf0e10cSrcweir 171cdf0e10cSrcweir bMBDown = sal_True; 172cdf0e10cSrcweir bSelectionChanged = sal_False; 173cdf0e10cSrcweir 174cdf0e10cSrcweir if ( mpView->IsAction() ) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir if ( rMEvt.IsRight() ) 177cdf0e10cSrcweir mpView->BckAction(); 178cdf0e10cSrcweir return sal_True; 179cdf0e10cSrcweir } 180cdf0e10cSrcweir 181cdf0e10cSrcweir sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() ); 182cdf0e10cSrcweir sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() ); 183cdf0e10cSrcweir 184cdf0e10cSrcweir // The following code is executed for right clicks as well as for left 185cdf0e10cSrcweir // clicks in order to modify the selection for the right button as a 186cdf0e10cSrcweir // preparation for the context menu. The functions BegMarkObject() and 187cdf0e10cSrcweir // BegDragObject(), however, are not called for right clicks because a) 188cdf0e10cSrcweir // it makes no sense and b) to have IsAction() return sal_False when called 189cdf0e10cSrcweir // from Command() which is a prerequisite for the context menu. 190cdf0e10cSrcweir if ((rMEvt.IsLeft() || rMEvt.IsRight()) 191cdf0e10cSrcweir && !mpView->IsAction() 192cdf0e10cSrcweir && (mpView->IsFrameDragSingles() || !mpView->HasMarkablePoints())) 193cdf0e10cSrcweir { 194cdf0e10cSrcweir /****************************************************************** 195cdf0e10cSrcweir * KEIN BEZIER_EDITOR 196cdf0e10cSrcweir ******************************************************************/ 197cdf0e10cSrcweir mpWindow->CaptureMouse(); 198cdf0e10cSrcweir pHdl = mpView->PickHandle(aMDPos); 199cdf0e10cSrcweir SdrObject* pObj; 200cdf0e10cSrcweir SdrPageView* pPV; 201cdf0e10cSrcweir 202cdf0e10cSrcweir long nAngle0 = GetAngle(aMDPos - mpView->GetRef1()); 203cdf0e10cSrcweir nAngle0 -= 27000; 204cdf0e10cSrcweir nAngle0 = NormAngle360(nAngle0); 205cdf0e10cSrcweir bMirrorSide0 = sal_Bool (nAngle0 < 18000L); 206cdf0e10cSrcweir 207cdf0e10cSrcweir if (!pHdl && mpView->Is3DRotationCreationActive()) 208cdf0e10cSrcweir { 209cdf0e10cSrcweir /****************************************************************** 210cdf0e10cSrcweir * Wenn 3D-Rotationskoerper erstellt werden sollen, jetzt 211cdf0e10cSrcweir * die Erstellung beenden 212cdf0e10cSrcweir ******************************************************************/ 213cdf0e10cSrcweir bSuppressChangesOfSelection = sal_True; 214cdf0e10cSrcweir if(mpWindow) 215cdf0e10cSrcweir mpWindow->EnterWait(); 216cdf0e10cSrcweir mpView->End3DCreation(); 217cdf0e10cSrcweir bSuppressChangesOfSelection = sal_False; 218cdf0e10cSrcweir mpView->ResetCreationActive(); 219cdf0e10cSrcweir if(mpWindow) 220cdf0e10cSrcweir mpWindow->LeaveWait(); 221cdf0e10cSrcweir } 222cdf0e10cSrcweir 223cdf0e10cSrcweir sal_Bool bTextEdit = sal_False; 224cdf0e10cSrcweir SdrViewEvent aVEvt; 225cdf0e10cSrcweir SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); 226cdf0e10cSrcweir 227cdf0e10cSrcweir if ( eHit == SDRHIT_TEXTEDITOBJ && ( mpViewShell->GetFrameView()->IsQuickEdit() || dynamic_cast< sdr::table::SdrTableObj* >( aVEvt.pObj ) != NULL ) ) 228cdf0e10cSrcweir { 229cdf0e10cSrcweir bTextEdit = sal_True; 230cdf0e10cSrcweir } 231cdf0e10cSrcweir 232cdf0e10cSrcweir if(!bTextEdit 233cdf0e10cSrcweir && !mpDocSh->IsReadOnly() 234cdf0e10cSrcweir && ((mpView->IsMarkedHit(aMDPos, nHitLog) && !rMEvt.IsShift() && !rMEvt.IsMod2()) || pHdl != NULL) 235cdf0e10cSrcweir && (rMEvt.GetClicks() != 2) 236cdf0e10cSrcweir ) 237cdf0e10cSrcweir { 238cdf0e10cSrcweir if (!pHdl && mpView->Is3DRotationCreationActive()) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir // Wechsel Rotationskoerper -> Selektion 241cdf0e10cSrcweir mpView->ResetCreationActive(); 242cdf0e10cSrcweir } 243cdf0e10cSrcweir else if (bWaterCan) 244cdf0e10cSrcweir { 245cdf0e10cSrcweir // Remember the selected object for proper handling in 246cdf0e10cSrcweir // MouseButtonUp(). 247cdf0e10cSrcweir pWaterCanCandidate = pickObject (aMDPos); 248cdf0e10cSrcweir } 249cdf0e10cSrcweir else 250cdf0e10cSrcweir { 251cdf0e10cSrcweir // Handle oder markiertes Objekt getroffen 252cdf0e10cSrcweir bFirstMouseMove = sal_True; 253cdf0e10cSrcweir aDragTimer.Start(); 254cdf0e10cSrcweir } 255cdf0e10cSrcweir 256cdf0e10cSrcweir if ( ! rMEvt.IsRight()) 257cdf0e10cSrcweir mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog); 258cdf0e10cSrcweir bReturn = sal_True; 259cdf0e10cSrcweir } 260cdf0e10cSrcweir else 261cdf0e10cSrcweir { 262cdf0e10cSrcweir if (!rMEvt.IsMod2() && mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO)) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir mpView->BegMacroObj(aMDPos, nHitLog, pObj, pPV, mpWindow); 265cdf0e10cSrcweir bReturn = sal_True; 266cdf0e10cSrcweir } 267cdf0e10cSrcweir else if ( bTextEdit ) 268cdf0e10cSrcweir { 269cdf0e10cSrcweir sal_uInt16 nSdrObjKind = aVEvt.pObj->GetObjIdentifier(); 270cdf0e10cSrcweir 271cdf0e10cSrcweir if (aVEvt.pObj->GetObjInventor() == SdrInventor && 272cdf0e10cSrcweir (nSdrObjKind == OBJ_TEXT || 273cdf0e10cSrcweir nSdrObjKind == OBJ_TITLETEXT || 274cdf0e10cSrcweir nSdrObjKind == OBJ_OUTLINETEXT || 275cdf0e10cSrcweir !aVEvt.pObj->IsEmptyPresObj())) 276cdf0e10cSrcweir { 277cdf0e10cSrcweir // Seamless Editing: Verzweigen zur Texteingabe 278cdf0e10cSrcweir if (!rMEvt.IsShift()) 279cdf0e10cSrcweir mpView->UnmarkAll(); 280cdf0e10cSrcweir 281cdf0e10cSrcweir SfxUInt16Item aItem(SID_TEXTEDIT, 1); 282cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()-> 283cdf0e10cSrcweir Execute(SID_TEXTEDIT, SFX_CALLMODE_SYNCHRON | 284cdf0e10cSrcweir SFX_CALLMODE_RECORD, &aItem, 0L); 285cdf0e10cSrcweir return bReturn; // VORSICHT, durch den synchronen Slot ist das objekt jetzt geloescht 286cdf0e10cSrcweir } 287cdf0e10cSrcweir } 288cdf0e10cSrcweir else if ( !rMEvt.IsMod2() && rMEvt.GetClicks() == 1 && 289cdf0e10cSrcweir aVEvt.eEvent == SDREVENT_EXECUTEURL ) 290cdf0e10cSrcweir { 291cdf0e10cSrcweir mpWindow->ReleaseMouse(); 292cdf0e10cSrcweir SfxStringItem aStrItem(SID_FILE_NAME, aVEvt.pURLField->GetURL()); 293cdf0e10cSrcweir SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName()); 294cdf0e10cSrcweir SfxBoolItem aBrowseItem( SID_BROWSE, sal_True ); 295cdf0e10cSrcweir SfxViewFrame* pFrame = mpViewShell->GetViewFrame(); 296cdf0e10cSrcweir mpWindow->ReleaseMouse(); 297cdf0e10cSrcweir 298cdf0e10cSrcweir if (rMEvt.IsMod1()) 299cdf0e10cSrcweir { 300cdf0e10cSrcweir // Im neuen Frame oeffnen 301cdf0e10cSrcweir pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, 302cdf0e10cSrcweir &aStrItem, &aBrowseItem, &aReferer, 0L); 303cdf0e10cSrcweir } 304cdf0e10cSrcweir else 305cdf0e10cSrcweir { 306cdf0e10cSrcweir // Im aktuellen Frame oeffnen 307cdf0e10cSrcweir SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame); 308cdf0e10cSrcweir pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, 309cdf0e10cSrcweir &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L); 310cdf0e10cSrcweir } 311cdf0e10cSrcweir 312cdf0e10cSrcweir bReturn = sal_True; 313cdf0e10cSrcweir } 314cdf0e10cSrcweir else if(!rMEvt.IsMod2() 315cdf0e10cSrcweir && mpViewShell->ISA(DrawViewShell) 316cdf0e10cSrcweir ) 317cdf0e10cSrcweir { 318cdf0e10cSrcweir if(mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER)) 319cdf0e10cSrcweir { 320cdf0e10cSrcweir // Animate object when not just selecting. 321cdf0e10cSrcweir if ( ! bSelectionOnly) 322cdf0e10cSrcweir bReturn = AnimateObj(pObj, aMDPos); 323cdf0e10cSrcweir 324cdf0e10cSrcweir if (!bReturn && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dPolyScene))) 325cdf0e10cSrcweir { 326cdf0e10cSrcweir if(rMEvt.GetClicks() == 1) 327cdf0e10cSrcweir { 328cdf0e10cSrcweir // In die Gruppe hineinschauen 329cdf0e10cSrcweir if (mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP)) 330cdf0e10cSrcweir bReturn = AnimateObj(pObj, aMDPos); 331cdf0e10cSrcweir } 332cdf0e10cSrcweir else if( !bReadOnly && rMEvt.GetClicks() == 2) 333cdf0e10cSrcweir { 334cdf0e10cSrcweir // Neu: Doppelklick auf selektiertes Gruppenobjekt 335cdf0e10cSrcweir // Gruppe betreten 336cdf0e10cSrcweir if ( ! bSelectionOnly 337cdf0e10cSrcweir && pObj 338cdf0e10cSrcweir && pObj->GetPage() == pPV->GetPage()) 339cdf0e10cSrcweir bReturn = pPV->EnterGroup(pObj); 340cdf0e10cSrcweir } 341cdf0e10cSrcweir } 342cdf0e10cSrcweir } 343cdf0e10cSrcweir 344cdf0e10cSrcweir // #i71727# replaced else here with two possibilities, once the original else (!pObj) 345cdf0e10cSrcweir // and also ignoring the found object when it's on a masterpage 346cdf0e10cSrcweir if(!pObj || (pObj->GetPage() && pObj->GetPage()->IsMasterPage())) 347cdf0e10cSrcweir { 348cdf0e10cSrcweir if(mpView->IsGroupEntered() && 2 == rMEvt.GetClicks()) 349cdf0e10cSrcweir { 350cdf0e10cSrcweir // New: double click on empty space/on obj on MasterPage, leave group 351cdf0e10cSrcweir mpView->LeaveOneGroup(); 352cdf0e10cSrcweir bReturn = sal_True; 353cdf0e10cSrcweir } 354cdf0e10cSrcweir } 355cdf0e10cSrcweir } 356cdf0e10cSrcweir 357cdf0e10cSrcweir if (!bReturn) 358cdf0e10cSrcweir { 359cdf0e10cSrcweir if (bWaterCan) 360cdf0e10cSrcweir { 361cdf0e10cSrcweir if ( ! (rMEvt.IsShift() || rMEvt.IsMod2())) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir // Find the object under the current mouse position 364cdf0e10cSrcweir // and store it for the MouseButtonUp() method to 365cdf0e10cSrcweir // evaluate. 366cdf0e10cSrcweir pWaterCanCandidate = pickObject (aMDPos); 367cdf0e10cSrcweir } 368cdf0e10cSrcweir } 369cdf0e10cSrcweir else 370cdf0e10cSrcweir { 371cdf0e10cSrcweir bReturn = sal_True; 372cdf0e10cSrcweir sal_Bool bDeactivateOLE = sal_False; 373cdf0e10cSrcweir 374cdf0e10cSrcweir if ( !rMEvt.IsShift() && !rMEvt.IsMod2() ) 375cdf0e10cSrcweir { 376cdf0e10cSrcweir OSL_ASSERT (mpViewShell->GetViewShell()!=NULL); 377cdf0e10cSrcweir Client* pIPClient = static_cast<Client*>( 378cdf0e10cSrcweir mpViewShell->GetViewShell()->GetIPClient()); 379cdf0e10cSrcweir 380cdf0e10cSrcweir if (pIPClient && pIPClient->IsObjectInPlaceActive()) 381cdf0e10cSrcweir { 382cdf0e10cSrcweir // OLE-Objekt wird im nachfolgenden UnmarkAll() deaktiviert 383cdf0e10cSrcweir bDeactivateOLE = sal_True; 384cdf0e10cSrcweir } 385cdf0e10cSrcweir 386cdf0e10cSrcweir mpView->UnmarkAll(); 387cdf0e10cSrcweir } 388cdf0e10cSrcweir 389cdf0e10cSrcweir sal_Bool bMarked = sal_False; 390cdf0e10cSrcweir 391cdf0e10cSrcweir if ( !rMEvt.IsMod1() && !bDeactivateOLE) 392cdf0e10cSrcweir { 393cdf0e10cSrcweir if ( rMEvt.IsMod2() ) 394cdf0e10cSrcweir { 395cdf0e10cSrcweir bMarked = mpView->MarkNextObj(aMDPos, nHitLog, rMEvt.IsShift() ); 396cdf0e10cSrcweir } 397cdf0e10cSrcweir else 398cdf0e10cSrcweir { 399cdf0e10cSrcweir sal_Bool bToggle = sal_False; 400cdf0e10cSrcweir 401cdf0e10cSrcweir if (rMEvt.IsShift() && mpView->GetMarkedObjectList().GetMarkCount() > 1) 402cdf0e10cSrcweir { 403cdf0e10cSrcweir // Bei Einfachselektion kein Toggle 404cdf0e10cSrcweir bToggle = sal_True; 405cdf0e10cSrcweir } 406cdf0e10cSrcweir 407cdf0e10cSrcweir bMarked = mpView->MarkObj(aMDPos, nHitLog, bToggle, sal_False); 408cdf0e10cSrcweir } 409cdf0e10cSrcweir } 410cdf0e10cSrcweir 411cdf0e10cSrcweir if( !bDeactivateOLE ) 412cdf0e10cSrcweir { 413cdf0e10cSrcweir if ( !bReadOnly && 414cdf0e10cSrcweir bMarked && 415cdf0e10cSrcweir (!rMEvt.IsShift() || mpView->IsMarkedHit(aMDPos, nHitLog))) 416cdf0e10cSrcweir { 417cdf0e10cSrcweir /********************************************************** 418cdf0e10cSrcweir * Objekt verschieben 419cdf0e10cSrcweir **********************************************************/ 420cdf0e10cSrcweir aDragTimer.Start(); 421cdf0e10cSrcweir 422cdf0e10cSrcweir pHdl=mpView->PickHandle(aMDPos); 423cdf0e10cSrcweir if ( ! rMEvt.IsRight()) 424cdf0e10cSrcweir mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog); 425cdf0e10cSrcweir } 426cdf0e10cSrcweir else 427cdf0e10cSrcweir { 428cdf0e10cSrcweir /********************************************************** 429cdf0e10cSrcweir * Objekt selektieren 430cdf0e10cSrcweir **********************************************************/ 431cdf0e10cSrcweir if ( ! rMEvt.IsRight()) 432cdf0e10cSrcweir mpView->BegMarkObj(aMDPos); 433cdf0e10cSrcweir } 434cdf0e10cSrcweir } 435cdf0e10cSrcweir 436cdf0e10cSrcweir if( bMarked && bTempRotation && (nSlotId == SID_OBJECT_ROTATE) && !rMEvt.IsShift() && (rMEvt.GetClicks() != 2) ) 437cdf0e10cSrcweir { 438cdf0e10cSrcweir nSlotId = SID_OBJECT_SELECT; 439cdf0e10cSrcweir Activate(); 440cdf0e10cSrcweir } 441cdf0e10cSrcweir } 442cdf0e10cSrcweir } 443cdf0e10cSrcweir } 444cdf0e10cSrcweir } 445cdf0e10cSrcweir else if ( !bReadOnly 446cdf0e10cSrcweir && (rMEvt.IsLeft() || rMEvt.IsRight()) 447cdf0e10cSrcweir && !mpView->IsAction()) 448cdf0e10cSrcweir { 449cdf0e10cSrcweir /********************************************************************** 450cdf0e10cSrcweir * BEZIER-EDITOR 451cdf0e10cSrcweir **********************************************************************/ 452cdf0e10cSrcweir mpWindow->CaptureMouse(); 453cdf0e10cSrcweir SdrViewEvent aVEvt; 454cdf0e10cSrcweir SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); 455cdf0e10cSrcweir 456cdf0e10cSrcweir if (eHit == SDRHIT_HANDLE && aVEvt.pHdl->GetKind() == HDL_BWGT) 457cdf0e10cSrcweir { 458cdf0e10cSrcweir /****************************************************************** 459cdf0e10cSrcweir * Handle draggen 460cdf0e10cSrcweir ******************************************************************/ 461cdf0e10cSrcweir if ( ! rMEvt.IsRight()) 462cdf0e10cSrcweir mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog); 463cdf0e10cSrcweir } 464cdf0e10cSrcweir else if (eHit == SDRHIT_MARKEDOBJECT && nEditMode == SID_BEZIER_INSERT) 465cdf0e10cSrcweir { 466cdf0e10cSrcweir /****************************************************************** 467cdf0e10cSrcweir * Klebepunkt einfuegen 468cdf0e10cSrcweir ******************************************************************/ 469cdf0e10cSrcweir mpView->BegInsObjPoint(aMDPos, rMEvt.IsMod1()); 470cdf0e10cSrcweir } 471cdf0e10cSrcweir else if (eHit == SDRHIT_MARKEDOBJECT && rMEvt.IsMod1()) 472cdf0e10cSrcweir { 473cdf0e10cSrcweir /****************************************************************** 474cdf0e10cSrcweir * Klebepunkt selektieren 475cdf0e10cSrcweir ******************************************************************/ 476cdf0e10cSrcweir if (!rMEvt.IsShift()) 477cdf0e10cSrcweir mpView->UnmarkAllPoints(); 478cdf0e10cSrcweir 479cdf0e10cSrcweir if ( ! rMEvt.IsRight()) 480cdf0e10cSrcweir mpView->BegMarkPoints(aMDPos); 481cdf0e10cSrcweir } 482cdf0e10cSrcweir else if (eHit == SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() && !rMEvt.IsMod2()) 483cdf0e10cSrcweir { 484cdf0e10cSrcweir /****************************************************************** 485cdf0e10cSrcweir * Objekt verschieben 486cdf0e10cSrcweir ******************************************************************/ 487cdf0e10cSrcweir if ( ! rMEvt.IsRight()) 488cdf0e10cSrcweir mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, NULL, nDrgLog); 489cdf0e10cSrcweir } 490cdf0e10cSrcweir else if (eHit == SDRHIT_HANDLE) 491cdf0e10cSrcweir { 492cdf0e10cSrcweir /****************************************************************** 493cdf0e10cSrcweir * Klebepunkt selektieren 494cdf0e10cSrcweir ******************************************************************/ 495cdf0e10cSrcweir if (!mpView->IsPointMarked(*aVEvt.pHdl) || rMEvt.IsShift()) 496cdf0e10cSrcweir { 497cdf0e10cSrcweir if (!rMEvt.IsShift()) 498cdf0e10cSrcweir { 499cdf0e10cSrcweir mpView->UnmarkAllPoints(); 500cdf0e10cSrcweir pHdl = mpView->PickHandle(aMDPos); 501cdf0e10cSrcweir } 502cdf0e10cSrcweir else 503cdf0e10cSrcweir { 504cdf0e10cSrcweir if (mpView->IsPointMarked(*aVEvt.pHdl)) 505cdf0e10cSrcweir { 506cdf0e10cSrcweir mpView->UnmarkPoint(*aVEvt.pHdl); 507cdf0e10cSrcweir pHdl = NULL; 508cdf0e10cSrcweir } 509cdf0e10cSrcweir else 510cdf0e10cSrcweir { 511cdf0e10cSrcweir pHdl = mpView->PickHandle(aMDPos); 512cdf0e10cSrcweir } 513cdf0e10cSrcweir } 514cdf0e10cSrcweir 515cdf0e10cSrcweir if (pHdl) 516cdf0e10cSrcweir { 517cdf0e10cSrcweir mpView->MarkPoint(*pHdl); 518cdf0e10cSrcweir if ( ! rMEvt.IsRight()) 519cdf0e10cSrcweir mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog); 520cdf0e10cSrcweir } 521cdf0e10cSrcweir } 522cdf0e10cSrcweir else 523cdf0e10cSrcweir { 524cdf0e10cSrcweir // #90239# point IS marked and NO shift is pressed. Start 525cdf0e10cSrcweir // dragging of selected point(s) 526cdf0e10cSrcweir pHdl = mpView->PickHandle(aMDPos); 527cdf0e10cSrcweir if(pHdl) 528cdf0e10cSrcweir if ( ! rMEvt.IsRight()) 529cdf0e10cSrcweir mpView->BegDragObj(aMDPos, (OutputDevice*)NULL, pHdl, nDrgLog); 530cdf0e10cSrcweir } 531cdf0e10cSrcweir } 532cdf0e10cSrcweir else 533cdf0e10cSrcweir { 534cdf0e10cSrcweir /****************************************************************** 535cdf0e10cSrcweir * Objekt selektieren oder draggen 536cdf0e10cSrcweir ******************************************************************/ 537cdf0e10cSrcweir if (!rMEvt.IsShift() && !rMEvt.IsMod2() && eHit == SDRHIT_UNMARKEDOBJECT) 538cdf0e10cSrcweir { 539cdf0e10cSrcweir mpView->UnmarkAllObj(); 540cdf0e10cSrcweir } 541cdf0e10cSrcweir 542cdf0e10cSrcweir sal_Bool bMarked = sal_False; 543cdf0e10cSrcweir 544cdf0e10cSrcweir if (!rMEvt.IsMod1()) 545cdf0e10cSrcweir { 546cdf0e10cSrcweir if (rMEvt.IsMod2()) 547cdf0e10cSrcweir { 548cdf0e10cSrcweir bMarked = mpView->MarkNextObj(aMDPos, nHitLog, rMEvt.IsShift()); 549cdf0e10cSrcweir } 550cdf0e10cSrcweir else 551cdf0e10cSrcweir { 552cdf0e10cSrcweir bMarked = mpView->MarkObj(aMDPos, nHitLog, rMEvt.IsShift(), sal_False); 553cdf0e10cSrcweir } 554cdf0e10cSrcweir } 555cdf0e10cSrcweir 556cdf0e10cSrcweir if (bMarked && 557cdf0e10cSrcweir (!rMEvt.IsShift() || eHit == SDRHIT_MARKEDOBJECT)) 558cdf0e10cSrcweir { 559cdf0e10cSrcweir // Objekt verschieben 560cdf0e10cSrcweir if ( ! rMEvt.IsRight()) 561cdf0e10cSrcweir mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog); 562cdf0e10cSrcweir } 563cdf0e10cSrcweir else if (mpView->AreObjectsMarked()) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir /************************************************************** 566cdf0e10cSrcweir * Klebepunkt selektieren 567cdf0e10cSrcweir **************************************************************/ 568cdf0e10cSrcweir if (!rMEvt.IsShift()) 569cdf0e10cSrcweir mpView->UnmarkAllPoints(); 570cdf0e10cSrcweir 571cdf0e10cSrcweir if ( ! rMEvt.IsRight()) 572cdf0e10cSrcweir mpView->BegMarkPoints(aMDPos); 573cdf0e10cSrcweir } 574cdf0e10cSrcweir else 575cdf0e10cSrcweir { 576cdf0e10cSrcweir /************************************************************** 577cdf0e10cSrcweir * Objekt selektieren 578cdf0e10cSrcweir **************************************************************/ 579cdf0e10cSrcweir if ( ! rMEvt.IsRight()) 580cdf0e10cSrcweir mpView->BegMarkObj(aMDPos); 581cdf0e10cSrcweir } 582cdf0e10cSrcweir 583cdf0e10cSrcweir ForcePointer(&rMEvt); 584cdf0e10cSrcweir } 585cdf0e10cSrcweir } 586cdf0e10cSrcweir 587cdf0e10cSrcweir if (!bIsInDragMode) 588cdf0e10cSrcweir { 589cdf0e10cSrcweir ForcePointer(&rMEvt); 590cdf0e10cSrcweir } 591cdf0e10cSrcweir 592cdf0e10cSrcweir return bReturn; 593cdf0e10cSrcweir } 594cdf0e10cSrcweir 595cdf0e10cSrcweir /************************************************************************* 596cdf0e10cSrcweir |* 597cdf0e10cSrcweir |* MouseMove-event 598cdf0e10cSrcweir |* 599cdf0e10cSrcweir \************************************************************************/ 600cdf0e10cSrcweir 601cdf0e10cSrcweir sal_Bool FuSelection::MouseMove(const MouseEvent& rMEvt) 602cdf0e10cSrcweir { 603cdf0e10cSrcweir sal_Bool bReturn = FuDraw::MouseMove(rMEvt); 604cdf0e10cSrcweir 605cdf0e10cSrcweir if (aDragTimer.IsActive()) 606cdf0e10cSrcweir { 607cdf0e10cSrcweir if(bFirstMouseMove) 608cdf0e10cSrcweir { 609cdf0e10cSrcweir bFirstMouseMove = sal_False; 610cdf0e10cSrcweir } 611cdf0e10cSrcweir else 612cdf0e10cSrcweir { 613cdf0e10cSrcweir aDragTimer.Stop(); 614cdf0e10cSrcweir } 615cdf0e10cSrcweir } 616cdf0e10cSrcweir 617cdf0e10cSrcweir if (mpView->IsAction()) 618cdf0e10cSrcweir { 619cdf0e10cSrcweir Point aPix(rMEvt.GetPosPixel()); 620cdf0e10cSrcweir Point aPnt(mpWindow->PixelToLogic(aPix)); 621cdf0e10cSrcweir 622cdf0e10cSrcweir ForceScroll(aPix); 623cdf0e10cSrcweir 624cdf0e10cSrcweir if (mpView->IsInsObjPoint()) 625cdf0e10cSrcweir { 626cdf0e10cSrcweir mpView->MovInsObjPoint(aPnt); 627cdf0e10cSrcweir } 628cdf0e10cSrcweir else 629cdf0e10cSrcweir { 630cdf0e10cSrcweir mpView->MovAction(aPnt); 631cdf0e10cSrcweir } 632cdf0e10cSrcweir } 633cdf0e10cSrcweir 634cdf0e10cSrcweir ForcePointer(&rMEvt); 635cdf0e10cSrcweir 636cdf0e10cSrcweir return (bReturn); 637cdf0e10cSrcweir } 638cdf0e10cSrcweir 639cdf0e10cSrcweir /************************************************************************* 640cdf0e10cSrcweir |* 641cdf0e10cSrcweir |* MouseButtonUp-event 642cdf0e10cSrcweir |* 643cdf0e10cSrcweir \************************************************************************/ 644cdf0e10cSrcweir 645cdf0e10cSrcweir sal_Bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) 646cdf0e10cSrcweir { 647cdf0e10cSrcweir sal_Bool bReturn = sal_False; 648cdf0e10cSrcweir // When the right mouse button is pressed then only select objects 649cdf0e10cSrcweir // (and deselect others) as a preparation for showing the context 650cdf0e10cSrcweir // menu. 651cdf0e10cSrcweir const bool bSelectionOnly = rMEvt.IsRight(); 652cdf0e10cSrcweir 653cdf0e10cSrcweir if (bHideAndAnimate) 654cdf0e10cSrcweir { 655cdf0e10cSrcweir // Animation laeuft noch -> sofort returnieren 656cdf0e10cSrcweir bHideAndAnimate = sal_False; 657cdf0e10cSrcweir pHdl = NULL; 658cdf0e10cSrcweir mpWindow->ReleaseMouse(); 659cdf0e10cSrcweir return(sal_True); 660cdf0e10cSrcweir } 661cdf0e10cSrcweir 662cdf0e10cSrcweir if (aDragTimer.IsActive() ) 663cdf0e10cSrcweir { 664cdf0e10cSrcweir aDragTimer.Stop(); 665cdf0e10cSrcweir bIsInDragMode = sal_False; 666cdf0e10cSrcweir } 667cdf0e10cSrcweir 668cdf0e10cSrcweir if( !mpView ) 669cdf0e10cSrcweir return (sal_False); 670cdf0e10cSrcweir 671cdf0e10cSrcweir Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); 672cdf0e10cSrcweir sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() ); 673cdf0e10cSrcweir sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() ); 674cdf0e10cSrcweir 675cdf0e10cSrcweir if (mpView->IsFrameDragSingles() || !mpView->HasMarkablePoints()) 676cdf0e10cSrcweir { 677cdf0e10cSrcweir /********************************************************************** 678cdf0e10cSrcweir * KEIN BEZIER_EDITOR 679cdf0e10cSrcweir **********************************************************************/ 680cdf0e10cSrcweir if ( mpView->IsDragObj() ) 681cdf0e10cSrcweir { 682cdf0e10cSrcweir /****************************************************************** 683cdf0e10cSrcweir * Objekt wurde verschoben 684cdf0e10cSrcweir ******************************************************************/ 685cdf0e10cSrcweir FrameView* pFrameView = mpViewShell->GetFrameView(); 686cdf0e10cSrcweir sal_Bool bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy()); 687cdf0e10cSrcweir 688cdf0e10cSrcweir if (bDragWithCopy) 689cdf0e10cSrcweir { 690cdf0e10cSrcweir bDragWithCopy = !mpView->IsPresObjSelected(sal_False, sal_True); 691cdf0e10cSrcweir } 692cdf0e10cSrcweir 693cdf0e10cSrcweir mpView->SetDragWithCopy(bDragWithCopy); 694cdf0e10cSrcweir mpView->EndDragObj( mpView->IsDragWithCopy() ); 695cdf0e10cSrcweir 696cdf0e10cSrcweir mpView->ForceMarkedToAnotherPage(); 697cdf0e10cSrcweir 698cdf0e10cSrcweir if (!rMEvt.IsShift() && !rMEvt.IsMod1() && !rMEvt.IsMod2() && 699cdf0e10cSrcweir !bSelectionChanged && 700cdf0e10cSrcweir Abs(aPnt.X() - aMDPos.X()) < nDrgLog && 701cdf0e10cSrcweir Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog) 702cdf0e10cSrcweir { 703cdf0e10cSrcweir /************************************************************** 704cdf0e10cSrcweir * Toggle zw. Selektion und Rotation 705cdf0e10cSrcweir **************************************************************/ 706cdf0e10cSrcweir SdrObject* pSingleObj = NULL; 707cdf0e10cSrcweir sal_uLong nMarkCount = mpView->GetMarkedObjectList().GetMarkCount(); 708cdf0e10cSrcweir 709cdf0e10cSrcweir if (nMarkCount==1) 710cdf0e10cSrcweir { 711cdf0e10cSrcweir pSingleObj = mpView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); 712cdf0e10cSrcweir } 713cdf0e10cSrcweir 714cdf0e10cSrcweir if (nSlotId == SID_OBJECT_SELECT 715cdf0e10cSrcweir && mpView->IsRotateAllowed() 716cdf0e10cSrcweir 717cdf0e10cSrcweir && (rMEvt.GetClicks() != 2) 718cdf0e10cSrcweir && (mpViewShell->GetFrameView()->IsClickChangeRotation() 719cdf0e10cSrcweir || (pSingleObj 720cdf0e10cSrcweir && pSingleObj->GetObjInventor()==E3dInventor)) 721cdf0e10cSrcweir && ! bSelectionOnly) 722cdf0e10cSrcweir 723cdf0e10cSrcweir { 724cdf0e10cSrcweir bTempRotation = sal_True; 725cdf0e10cSrcweir nSlotId = SID_OBJECT_ROTATE; 726cdf0e10cSrcweir Activate(); 727cdf0e10cSrcweir } 728cdf0e10cSrcweir else if (nSlotId == SID_OBJECT_ROTATE) 729cdf0e10cSrcweir { 730cdf0e10cSrcweir nSlotId = SID_OBJECT_SELECT; 731cdf0e10cSrcweir Activate(); 732cdf0e10cSrcweir } 733cdf0e10cSrcweir } 734cdf0e10cSrcweir else if (nSlotId == SID_CONVERT_TO_3D_LATHE) 735cdf0e10cSrcweir { 736cdf0e10cSrcweir if (!pHdl) 737cdf0e10cSrcweir { 738cdf0e10cSrcweir bSuppressChangesOfSelection = sal_True; 739cdf0e10cSrcweir mpView->Start3DCreation(); 740cdf0e10cSrcweir bSuppressChangesOfSelection = sal_False; 741cdf0e10cSrcweir } 742cdf0e10cSrcweir else if (pHdl->GetKind() != HDL_MIRX && 743cdf0e10cSrcweir pHdl->GetKind() != HDL_REF1 && 744cdf0e10cSrcweir pHdl->GetKind() != HDL_REF2 && mpView->Is3DRotationCreationActive()) 745cdf0e10cSrcweir { 746cdf0e10cSrcweir /********************************************************* 747cdf0e10cSrcweir * Wenn 3D-Rotationskoerper erstellt werden sollen, jetzt 748cdf0e10cSrcweir * die Erstellung beenden 749cdf0e10cSrcweir **********************************************************/ 750cdf0e10cSrcweir long nAngle1 = GetAngle(aPnt - mpView->GetRef1()); 751cdf0e10cSrcweir nAngle1 -= 27000; 752cdf0e10cSrcweir nAngle1 = NormAngle360(nAngle1); 753cdf0e10cSrcweir sal_Bool bMirrorSide1 = sal_Bool (nAngle1 < 18000L); 754cdf0e10cSrcweir 755cdf0e10cSrcweir if (bMirrorSide0 != bMirrorSide1) 756cdf0e10cSrcweir { 757cdf0e10cSrcweir bSuppressChangesOfSelection = sal_True; 758cdf0e10cSrcweir if(mpWindow) 759cdf0e10cSrcweir mpWindow->EnterWait(); 760cdf0e10cSrcweir mpView->End3DCreation(); 761cdf0e10cSrcweir bSuppressChangesOfSelection = sal_False; 762cdf0e10cSrcweir nSlotId = SID_OBJECT_SELECT; 763cdf0e10cSrcweir if(mpWindow) 764cdf0e10cSrcweir mpWindow->LeaveWait(); 765cdf0e10cSrcweir Activate(); 766cdf0e10cSrcweir } 767cdf0e10cSrcweir } 768cdf0e10cSrcweir } 769cdf0e10cSrcweir } 770cdf0e10cSrcweir else if (rMEvt.IsMod1() 771cdf0e10cSrcweir && !rMEvt.IsMod2() 772cdf0e10cSrcweir && Abs(aPnt.X() - aMDPos.X()) < nDrgLog 773cdf0e10cSrcweir && Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog) 774cdf0e10cSrcweir { 775cdf0e10cSrcweir // Gruppe betreten 776cdf0e10cSrcweir mpView->MarkObj(aPnt, nHitLog, rMEvt.IsShift(), rMEvt.IsMod1()); 777cdf0e10cSrcweir } 778cdf0e10cSrcweir 779cdf0e10cSrcweir if (mpView->IsAction() ) 780cdf0e10cSrcweir { 781cdf0e10cSrcweir mpView->EndAction(); 782cdf0e10cSrcweir } 783cdf0e10cSrcweir 784cdf0e10cSrcweir if( SD_MOD()->GetWaterCan() ) 785cdf0e10cSrcweir { 786cdf0e10cSrcweir if( rMEvt.IsRight() ) 787cdf0e10cSrcweir { 788cdf0e10cSrcweir // Bei rechter Maustaste wird im Giesskannenmodus ein Undo ausgefuehrt 789cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_UNDO, SFX_CALLMODE_ASYNCHRON ); 790cdf0e10cSrcweir } 791cdf0e10cSrcweir else if (pWaterCanCandidate != NULL) 792cdf0e10cSrcweir { 793cdf0e10cSrcweir // Is the candiate object still under the mouse? 794cdf0e10cSrcweir if (pickObject (aPnt) == pWaterCanCandidate) 795cdf0e10cSrcweir { 796cdf0e10cSrcweir SdStyleSheetPool* pPool = static_cast<SdStyleSheetPool*>( 797cdf0e10cSrcweir mpDocSh->GetStyleSheetPool()); 798cdf0e10cSrcweir if (pPool != NULL) 799cdf0e10cSrcweir { 800cdf0e10cSrcweir SfxStyleSheet* pStyleSheet = static_cast<SfxStyleSheet*>( 801cdf0e10cSrcweir pPool->GetActualStyleSheet()); 802cdf0e10cSrcweir if (pStyleSheet != NULL && mpView->IsUndoEnabled() ) 803cdf0e10cSrcweir { 804cdf0e10cSrcweir // #108981# 805cdf0e10cSrcweir // Added UNDOs for the WaterCan mode. This was never done in 806cdf0e10cSrcweir // the past, thus it was missing all the time. 807cdf0e10cSrcweir SdrUndoAction* pUndoAttr = mpDoc->GetSdrUndoFactory().CreateUndoAttrObject(*pWaterCanCandidate, sal_True, sal_True); 808cdf0e10cSrcweir mpView->BegUndo(pUndoAttr->GetComment()); 809cdf0e10cSrcweir mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoGeoObject(*pWaterCanCandidate)); 810cdf0e10cSrcweir mpView->AddUndo(pUndoAttr); 811cdf0e10cSrcweir 812cdf0e10cSrcweir pWaterCanCandidate->SetStyleSheet (pStyleSheet, sal_False); 813cdf0e10cSrcweir 814cdf0e10cSrcweir // #108981# 815cdf0e10cSrcweir mpView->EndUndo(); 816cdf0e10cSrcweir } 817cdf0e10cSrcweir } 818cdf0e10cSrcweir } 819cdf0e10cSrcweir } 820cdf0e10cSrcweir // else when there has been no object under the mouse when the 821cdf0e10cSrcweir // button was pressed then nothing happens even when there is 822cdf0e10cSrcweir // one now. 823cdf0e10cSrcweir } 824cdf0e10cSrcweir 825cdf0e10cSrcweir sal_uInt16 nClicks = rMEvt.GetClicks(); 826cdf0e10cSrcweir 827cdf0e10cSrcweir if (nClicks == 2 && rMEvt.IsLeft() && bMBDown && 828cdf0e10cSrcweir !rMEvt.IsMod1() && !rMEvt.IsShift() ) 829cdf0e10cSrcweir { 830cdf0e10cSrcweir DoubleClick(rMEvt); 831cdf0e10cSrcweir } 832cdf0e10cSrcweir 833cdf0e10cSrcweir bMBDown = sal_False; 834cdf0e10cSrcweir 835cdf0e10cSrcweir ForcePointer(&rMEvt); 836cdf0e10cSrcweir pHdl = NULL; 837cdf0e10cSrcweir mpWindow->ReleaseMouse(); 838cdf0e10cSrcweir SdrObject* pSingleObj = NULL; 839cdf0e10cSrcweir sal_uLong nMarkCount = mpView->GetMarkedObjectList().GetMarkCount(); 840cdf0e10cSrcweir 841cdf0e10cSrcweir if (nMarkCount==1) 842cdf0e10cSrcweir { 843cdf0e10cSrcweir pSingleObj = mpView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); 844cdf0e10cSrcweir } 845cdf0e10cSrcweir 846cdf0e10cSrcweir if ( (nSlotId != SID_OBJECT_SELECT && nMarkCount==0) || 847cdf0e10cSrcweir ( mpView->GetDragMode() == SDRDRAG_CROOK && 848cdf0e10cSrcweir !mpView->IsCrookAllowed( mpView->IsCrookNoContortion() ) ) || 849cdf0e10cSrcweir ( mpView->GetDragMode() == SDRDRAG_SHEAR && 850cdf0e10cSrcweir !mpView->IsShearAllowed() && !mpView->IsDistortAllowed() ) || 851cdf0e10cSrcweir ( nSlotId==SID_CONVERT_TO_3D_LATHE && pSingleObj && 852cdf0e10cSrcweir (pSingleObj->GetObjInventor() != SdrInventor || 853cdf0e10cSrcweir pSingleObj->GetObjIdentifier() == OBJ_MEASURE) ) ) 854cdf0e10cSrcweir { 855cdf0e10cSrcweir bReturn = sal_True; 856cdf0e10cSrcweir ForcePointer(&rMEvt); 857cdf0e10cSrcweir pHdl = NULL; 858cdf0e10cSrcweir mpWindow->ReleaseMouse(); 859cdf0e10cSrcweir FuDraw::MouseButtonUp(rMEvt); 860cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SYNCHRON); 861cdf0e10cSrcweir return bReturn; // VORSICHT, durch den synchronen Slot ist das objekt jetzt geloescht 862cdf0e10cSrcweir } 863cdf0e10cSrcweir 864cdf0e10cSrcweir FuDraw::MouseButtonUp(rMEvt); 865cdf0e10cSrcweir } 866cdf0e10cSrcweir else 867cdf0e10cSrcweir { 868cdf0e10cSrcweir /********************************************************************** 869cdf0e10cSrcweir * BEZIER_EDITOR 870cdf0e10cSrcweir **********************************************************************/ 871cdf0e10cSrcweir if ( mpView->IsAction() ) 872cdf0e10cSrcweir { 873cdf0e10cSrcweir if ( mpView->IsInsObjPoint() ) 874cdf0e10cSrcweir { 875cdf0e10cSrcweir mpView->EndInsObjPoint(SDRCREATE_FORCEEND); 876cdf0e10cSrcweir } 877cdf0e10cSrcweir else if ( mpView->IsDragObj() ) 878cdf0e10cSrcweir { 879cdf0e10cSrcweir FrameView* pFrameView = mpViewShell->GetFrameView(); 880cdf0e10cSrcweir sal_Bool bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy()); 881cdf0e10cSrcweir 882cdf0e10cSrcweir if (bDragWithCopy) 883cdf0e10cSrcweir { 884cdf0e10cSrcweir bDragWithCopy = !mpView->IsPresObjSelected(sal_False, sal_True); 885cdf0e10cSrcweir } 886cdf0e10cSrcweir 887cdf0e10cSrcweir mpView->SetDragWithCopy(bDragWithCopy); 888cdf0e10cSrcweir mpView->EndDragObj( mpView->IsDragWithCopy() ); 889cdf0e10cSrcweir } 890cdf0e10cSrcweir else 891cdf0e10cSrcweir { 892cdf0e10cSrcweir mpView->EndAction(); 893cdf0e10cSrcweir 894cdf0e10cSrcweir sal_uInt16 nDrgLog2 = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() ); 895cdf0e10cSrcweir Point aPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() ); 896cdf0e10cSrcweir 897cdf0e10cSrcweir if (Abs(aMDPos.X() - aPos.X()) < nDrgLog2 && 898cdf0e10cSrcweir Abs(aMDPos.Y() - aPos.Y()) < nDrgLog2 && 899cdf0e10cSrcweir !rMEvt.IsShift() && !rMEvt.IsMod2()) 900cdf0e10cSrcweir { 901cdf0e10cSrcweir SdrViewEvent aVEvt; 902cdf0e10cSrcweir SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); 903cdf0e10cSrcweir 904cdf0e10cSrcweir if (eHit == SDRHIT_NONE) 905cdf0e10cSrcweir { 906cdf0e10cSrcweir // Klick auf der Stelle: deselektieren 907cdf0e10cSrcweir mpView->UnmarkAllObj(); 908cdf0e10cSrcweir } 909cdf0e10cSrcweir } 910cdf0e10cSrcweir } 911cdf0e10cSrcweir } 912cdf0e10cSrcweir else if (!rMEvt.IsShift() && rMEvt.IsMod1() && !rMEvt.IsMod2() && 913cdf0e10cSrcweir Abs(aPnt.X() - aMDPos.X()) < nDrgLog && 914cdf0e10cSrcweir Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog) 915cdf0e10cSrcweir { 916cdf0e10cSrcweir // Gruppe betreten 917cdf0e10cSrcweir mpView->MarkObj(aPnt, nHitLog, sal_False, rMEvt.IsMod1()); 918cdf0e10cSrcweir } 919cdf0e10cSrcweir 920cdf0e10cSrcweir 921cdf0e10cSrcweir ForcePointer(&rMEvt); 922cdf0e10cSrcweir pHdl = NULL; 923cdf0e10cSrcweir mpWindow->ReleaseMouse(); 924cdf0e10cSrcweir 925cdf0e10cSrcweir FuDraw::MouseButtonUp(rMEvt); 926cdf0e10cSrcweir } 927cdf0e10cSrcweir 928cdf0e10cSrcweir return (bReturn); 929cdf0e10cSrcweir } 930cdf0e10cSrcweir 931cdf0e10cSrcweir /************************************************************************* 932cdf0e10cSrcweir |* 933cdf0e10cSrcweir |* Tastaturereignisse bearbeiten 934cdf0e10cSrcweir |* 935cdf0e10cSrcweir |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls 936cdf0e10cSrcweir |* sal_False. 937cdf0e10cSrcweir |* 938cdf0e10cSrcweir \************************************************************************/ 939cdf0e10cSrcweir 940cdf0e10cSrcweir sal_Bool FuSelection::KeyInput(const KeyEvent& rKEvt) 941cdf0e10cSrcweir { 942cdf0e10cSrcweir sal_Bool bReturn = sal_False; 943cdf0e10cSrcweir 944cdf0e10cSrcweir switch (rKEvt.GetKeyCode().GetCode()) 945cdf0e10cSrcweir { 946cdf0e10cSrcweir case KEY_ESCAPE: 947cdf0e10cSrcweir { 948cdf0e10cSrcweir bReturn = FuSelection::cancel(); 949cdf0e10cSrcweir } 950cdf0e10cSrcweir break; 951cdf0e10cSrcweir } 952cdf0e10cSrcweir 953cdf0e10cSrcweir if (!bReturn) 954cdf0e10cSrcweir { 955cdf0e10cSrcweir bReturn = FuDraw::KeyInput(rKEvt); 956cdf0e10cSrcweir 957cdf0e10cSrcweir if(mpView->GetMarkedObjectList().GetMarkCount() == 0) 958cdf0e10cSrcweir { 959cdf0e10cSrcweir mpView->ResetCreationActive(); 960cdf0e10cSrcweir 961cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD); 962cdf0e10cSrcweir } 963cdf0e10cSrcweir } 964cdf0e10cSrcweir 965cdf0e10cSrcweir return(bReturn); 966cdf0e10cSrcweir 967cdf0e10cSrcweir } 968cdf0e10cSrcweir 969cdf0e10cSrcweir 970cdf0e10cSrcweir /************************************************************************* 971cdf0e10cSrcweir |* 972cdf0e10cSrcweir |* Function aktivieren 973cdf0e10cSrcweir |* 974cdf0e10cSrcweir \************************************************************************/ 975cdf0e10cSrcweir 976cdf0e10cSrcweir void FuSelection::Activate() 977cdf0e10cSrcweir { 978cdf0e10cSrcweir SdrDragMode eMode; 979cdf0e10cSrcweir mpView->ResetCreationActive(); 980cdf0e10cSrcweir mpView->SetEditMode(SDREDITMODE_EDIT); 981cdf0e10cSrcweir 982cdf0e10cSrcweir switch( nSlotId ) 983cdf0e10cSrcweir { 984cdf0e10cSrcweir case SID_OBJECT_ROTATE: 985cdf0e10cSrcweir { 986cdf0e10cSrcweir // (gemapter) Slot wird explizit auf Rotate gesetzt #31052# 987cdf0e10cSrcweir if( mpViewShell->ISA(DrawViewShell) ) 988cdf0e10cSrcweir { 989cdf0e10cSrcweir sal_uInt16* pSlotArray = 990cdf0e10cSrcweir static_cast<DrawViewShell*>(mpViewShell)->GetSlotArray(); 991cdf0e10cSrcweir pSlotArray[ 1 ] = SID_OBJECT_ROTATE; 992cdf0e10cSrcweir } 993cdf0e10cSrcweir 994cdf0e10cSrcweir eMode = SDRDRAG_ROTATE; 995cdf0e10cSrcweir 996cdf0e10cSrcweir if ( mpView->GetDragMode() != eMode ) 997cdf0e10cSrcweir mpView->SetDragMode(eMode); 998cdf0e10cSrcweir } 999cdf0e10cSrcweir break; 1000cdf0e10cSrcweir 1001cdf0e10cSrcweir case SID_OBJECT_MIRROR: 1002cdf0e10cSrcweir { 1003cdf0e10cSrcweir eMode = SDRDRAG_MIRROR; 1004cdf0e10cSrcweir 1005cdf0e10cSrcweir if ( mpView->GetDragMode() != eMode ) 1006cdf0e10cSrcweir mpView->SetDragMode(eMode); 1007cdf0e10cSrcweir } 1008cdf0e10cSrcweir break; 1009cdf0e10cSrcweir 1010cdf0e10cSrcweir case SID_OBJECT_CROP: 1011cdf0e10cSrcweir { 1012cdf0e10cSrcweir eMode = SDRDRAG_CROP; 1013cdf0e10cSrcweir 1014cdf0e10cSrcweir if ( mpView->GetDragMode() != eMode ) 1015cdf0e10cSrcweir mpView->SetDragMode(eMode); 1016cdf0e10cSrcweir } 1017cdf0e10cSrcweir break; 1018cdf0e10cSrcweir 1019cdf0e10cSrcweir case SID_OBJECT_TRANSPARENCE: 1020cdf0e10cSrcweir { 1021cdf0e10cSrcweir eMode = SDRDRAG_TRANSPARENCE; 1022cdf0e10cSrcweir 1023cdf0e10cSrcweir if ( mpView->GetDragMode() != eMode ) 1024cdf0e10cSrcweir mpView->SetDragMode(eMode); 1025cdf0e10cSrcweir } 1026cdf0e10cSrcweir break; 1027cdf0e10cSrcweir 1028cdf0e10cSrcweir case SID_OBJECT_GRADIENT: 1029cdf0e10cSrcweir { 1030cdf0e10cSrcweir eMode = SDRDRAG_GRADIENT; 1031cdf0e10cSrcweir 1032cdf0e10cSrcweir if ( mpView->GetDragMode() != eMode ) 1033cdf0e10cSrcweir mpView->SetDragMode(eMode); 1034cdf0e10cSrcweir } 1035cdf0e10cSrcweir break; 1036cdf0e10cSrcweir 1037cdf0e10cSrcweir case SID_OBJECT_SHEAR: 1038cdf0e10cSrcweir { 1039cdf0e10cSrcweir eMode = SDRDRAG_SHEAR; 1040cdf0e10cSrcweir 1041cdf0e10cSrcweir if ( mpView->GetDragMode() != eMode ) 1042cdf0e10cSrcweir mpView->SetDragMode(eMode); 1043cdf0e10cSrcweir } 1044cdf0e10cSrcweir break; 1045cdf0e10cSrcweir 1046cdf0e10cSrcweir case SID_OBJECT_CROOK_ROTATE: 1047cdf0e10cSrcweir { 1048cdf0e10cSrcweir eMode = SDRDRAG_CROOK; 1049cdf0e10cSrcweir 1050cdf0e10cSrcweir if ( mpView->GetDragMode() != eMode ) 1051cdf0e10cSrcweir { 1052cdf0e10cSrcweir mpView->SetDragMode(eMode); 1053cdf0e10cSrcweir mpView->SetCrookMode(SDRCROOK_ROTATE); 1054cdf0e10cSrcweir } 1055cdf0e10cSrcweir } 1056cdf0e10cSrcweir break; 1057cdf0e10cSrcweir 1058cdf0e10cSrcweir case SID_OBJECT_CROOK_SLANT: 1059cdf0e10cSrcweir { 1060cdf0e10cSrcweir eMode = SDRDRAG_CROOK; 1061cdf0e10cSrcweir 1062cdf0e10cSrcweir if ( mpView->GetDragMode() != eMode ) 1063cdf0e10cSrcweir { 1064cdf0e10cSrcweir mpView->SetDragMode(eMode); 1065cdf0e10cSrcweir mpView->SetCrookMode(SDRCROOK_SLANT); 1066cdf0e10cSrcweir } 1067cdf0e10cSrcweir } 1068cdf0e10cSrcweir break; 1069cdf0e10cSrcweir 1070cdf0e10cSrcweir case SID_OBJECT_CROOK_STRETCH: 1071cdf0e10cSrcweir { 1072cdf0e10cSrcweir eMode = SDRDRAG_CROOK; 1073cdf0e10cSrcweir 1074cdf0e10cSrcweir if ( mpView->GetDragMode() != eMode ) 1075cdf0e10cSrcweir { 1076cdf0e10cSrcweir mpView->SetDragMode(eMode); 1077cdf0e10cSrcweir mpView->SetCrookMode(SDRCROOK_STRETCH); 1078cdf0e10cSrcweir } 1079cdf0e10cSrcweir } 1080cdf0e10cSrcweir break; 1081cdf0e10cSrcweir 1082cdf0e10cSrcweir case SID_CONVERT_TO_3D_LATHE: 1083cdf0e10cSrcweir { 1084cdf0e10cSrcweir eMode = SDRDRAG_MIRROR; 1085cdf0e10cSrcweir bSuppressChangesOfSelection = sal_True; 1086cdf0e10cSrcweir 1087cdf0e10cSrcweir if ( mpView->GetDragMode() != eMode ) 1088cdf0e10cSrcweir mpView->SetDragMode(eMode); 1089cdf0e10cSrcweir 1090cdf0e10cSrcweir if (!mpView->Is3DRotationCreationActive()) 1091cdf0e10cSrcweir mpView->Start3DCreation(); 1092cdf0e10cSrcweir 1093cdf0e10cSrcweir bSuppressChangesOfSelection = sal_False; 1094cdf0e10cSrcweir } 1095cdf0e10cSrcweir break; 1096cdf0e10cSrcweir 1097cdf0e10cSrcweir default: 1098cdf0e10cSrcweir { 1099cdf0e10cSrcweir eMode = SDRDRAG_MOVE; 1100cdf0e10cSrcweir 1101cdf0e10cSrcweir if ( mpView->GetDragMode() != eMode ) 1102cdf0e10cSrcweir mpView->SetDragMode(eMode); 1103cdf0e10cSrcweir } 1104cdf0e10cSrcweir break; 1105cdf0e10cSrcweir } 1106cdf0e10cSrcweir 1107cdf0e10cSrcweir if (nSlotId != SID_OBJECT_ROTATE) 1108cdf0e10cSrcweir { 1109cdf0e10cSrcweir bTempRotation = sal_False; 1110cdf0e10cSrcweir } 1111cdf0e10cSrcweir 1112cdf0e10cSrcweir FuDraw::Activate(); 1113cdf0e10cSrcweir } 1114cdf0e10cSrcweir 1115cdf0e10cSrcweir 1116cdf0e10cSrcweir 1117cdf0e10cSrcweir /************************************************************************* 1118cdf0e10cSrcweir |* 1119cdf0e10cSrcweir |* Function deaktivieren 1120cdf0e10cSrcweir |* 1121cdf0e10cSrcweir \************************************************************************/ 1122cdf0e10cSrcweir 1123cdf0e10cSrcweir void FuSelection::Deactivate() 1124cdf0e10cSrcweir { 1125cdf0e10cSrcweir FuDraw::Deactivate(); 1126cdf0e10cSrcweir } 1127cdf0e10cSrcweir 1128cdf0e10cSrcweir 1129cdf0e10cSrcweir /************************************************************************* 1130cdf0e10cSrcweir |* 1131cdf0e10cSrcweir |* Selektion hat sich geaendert 1132cdf0e10cSrcweir |* 1133cdf0e10cSrcweir \************************************************************************/ 1134cdf0e10cSrcweir 1135cdf0e10cSrcweir void FuSelection::SelectionHasChanged() 1136cdf0e10cSrcweir { 1137cdf0e10cSrcweir bSelectionChanged = sal_True; 1138cdf0e10cSrcweir 1139cdf0e10cSrcweir FuDraw::SelectionHasChanged(); 1140cdf0e10cSrcweir 1141cdf0e10cSrcweir if ((mpView->Is3DRotationCreationActive() && !bSuppressChangesOfSelection)) 1142cdf0e10cSrcweir { 1143cdf0e10cSrcweir // Wechsel Rotationskoerper -> Selektion 1144cdf0e10cSrcweir mpView->ResetCreationActive(); 1145cdf0e10cSrcweir nSlotId = SID_OBJECT_SELECT; 1146cdf0e10cSrcweir Activate(); 1147cdf0e10cSrcweir } 1148cdf0e10cSrcweir 1149cdf0e10cSrcweir // Activate the right tool bar for the current context of the view. 1150cdf0e10cSrcweir mpViewShell->GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*mpViewShell, *mpView); 1151cdf0e10cSrcweir } 1152cdf0e10cSrcweir 1153cdf0e10cSrcweir 1154cdf0e10cSrcweir /************************************************************************* 1155cdf0e10cSrcweir |* 1156cdf0e10cSrcweir |* Aktuellen Bezier-Editmodus setzen 1157cdf0e10cSrcweir |* 1158cdf0e10cSrcweir \************************************************************************/ 1159cdf0e10cSrcweir 1160cdf0e10cSrcweir void FuSelection::SetEditMode(sal_uInt16 nMode) 1161cdf0e10cSrcweir { 1162cdf0e10cSrcweir nEditMode = nMode; 1163cdf0e10cSrcweir 1164cdf0e10cSrcweir if (nEditMode == SID_BEZIER_INSERT) 1165cdf0e10cSrcweir { 1166cdf0e10cSrcweir mpView->SetInsObjPointMode(sal_True); 1167cdf0e10cSrcweir } 1168cdf0e10cSrcweir else 1169cdf0e10cSrcweir { 1170cdf0e10cSrcweir mpView->SetInsObjPointMode(sal_False); 1171cdf0e10cSrcweir } 1172cdf0e10cSrcweir 1173cdf0e10cSrcweir ForcePointer(); 1174cdf0e10cSrcweir 1175cdf0e10cSrcweir SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings(); 1176cdf0e10cSrcweir rBindings.Invalidate(SID_BEZIER_MOVE); 1177cdf0e10cSrcweir rBindings.Invalidate(SID_BEZIER_INSERT); 1178cdf0e10cSrcweir } 1179cdf0e10cSrcweir 1180cdf0e10cSrcweir /************************************************************************* 1181cdf0e10cSrcweir |* 1182cdf0e10cSrcweir |* Animation oder Interaktion ausfuehren 1183cdf0e10cSrcweir |* 1184cdf0e10cSrcweir \************************************************************************/ 1185cdf0e10cSrcweir 1186cdf0e10cSrcweir sal_Bool FuSelection::AnimateObj(SdrObject* pObj, const Point& rPos) 1187cdf0e10cSrcweir { 1188cdf0e10cSrcweir sal_Bool bAnimated = sal_False; 1189cdf0e10cSrcweir sal_Bool bClosed = pObj->IsClosedObj(); 1190cdf0e10cSrcweir sal_Bool bFilled = sal_False; 1191cdf0e10cSrcweir 1192cdf0e10cSrcweir if (bClosed) 1193cdf0e10cSrcweir { 1194cdf0e10cSrcweir SfxItemSet aSet(mpDoc->GetPool()); 1195cdf0e10cSrcweir 1196cdf0e10cSrcweir aSet.Put(pObj->GetMergedItemSet()); 1197cdf0e10cSrcweir 1198cdf0e10cSrcweir const XFillStyleItem& rFillStyle = (const XFillStyleItem&) aSet.Get(XATTR_FILLSTYLE); 1199cdf0e10cSrcweir bFilled = rFillStyle.GetValue() != XFILL_NONE; 1200cdf0e10cSrcweir } 1201cdf0e10cSrcweir 1202cdf0e10cSrcweir const SetOfByte* pVisiLayer = &mpView->GetSdrPageView()->GetVisibleLayers(); 1203cdf0e10cSrcweir sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() ); 1204cdf0e10cSrcweir const long n2HitLog = nHitLog * 2; 1205cdf0e10cSrcweir Point aHitPosR(rPos); 1206cdf0e10cSrcweir Point aHitPosL(rPos); 1207cdf0e10cSrcweir Point aHitPosT(rPos); 1208cdf0e10cSrcweir Point aHitPosB(rPos); 1209cdf0e10cSrcweir 1210cdf0e10cSrcweir aHitPosR.X() += n2HitLog; 1211cdf0e10cSrcweir aHitPosL.X() -= n2HitLog; 1212cdf0e10cSrcweir aHitPosT.Y() += n2HitLog; 1213cdf0e10cSrcweir aHitPosB.Y() -= n2HitLog; 1214cdf0e10cSrcweir 1215cdf0e10cSrcweir if ( !bClosed || 1216cdf0e10cSrcweir !bFilled || 1217cdf0e10cSrcweir (SdrObjectPrimitiveHit(*pObj, aHitPosR, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && 1218cdf0e10cSrcweir SdrObjectPrimitiveHit(*pObj, aHitPosL, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && 1219cdf0e10cSrcweir SdrObjectPrimitiveHit(*pObj, aHitPosT, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && 1220cdf0e10cSrcweir SdrObjectPrimitiveHit(*pObj, aHitPosB, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) ) ) 1221cdf0e10cSrcweir { 1222cdf0e10cSrcweir if ( mpDoc->GetIMapInfo( pObj ) ) 1223cdf0e10cSrcweir { 1224cdf0e10cSrcweir const IMapObject* pIMapObj = mpDoc->GetHitIMapObject( pObj, rPos, *mpWindow ); 1225cdf0e10cSrcweir 1226cdf0e10cSrcweir if ( pIMapObj && pIMapObj->GetURL().Len() ) 1227cdf0e10cSrcweir { 1228cdf0e10cSrcweir // Sprung zu Dokument 1229cdf0e10cSrcweir mpWindow->ReleaseMouse(); 1230cdf0e10cSrcweir SfxStringItem aStrItem(SID_FILE_NAME, pIMapObj->GetURL()); 1231cdf0e10cSrcweir SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName()); 1232cdf0e10cSrcweir SfxViewFrame* pFrame = mpViewShell->GetViewFrame(); 1233cdf0e10cSrcweir SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame); 1234cdf0e10cSrcweir SfxBoolItem aBrowseItem( SID_BROWSE, sal_True ); 1235cdf0e10cSrcweir mpWindow->ReleaseMouse(); 1236cdf0e10cSrcweir pFrame->GetDispatcher()-> 1237cdf0e10cSrcweir Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, 1238cdf0e10cSrcweir &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L); 1239cdf0e10cSrcweir 1240cdf0e10cSrcweir bAnimated = sal_True; 1241cdf0e10cSrcweir } 1242cdf0e10cSrcweir } 1243cdf0e10cSrcweir else if (!mpDocSh->ISA(GraphicDocShell) && 1244cdf0e10cSrcweir mpView->ISA(DrawView) && 1245cdf0e10cSrcweir mpDoc->GetAnimationInfo(pObj)) 1246cdf0e10cSrcweir { 1247cdf0e10cSrcweir /********************************************************** 1248cdf0e10cSrcweir * Animations-Objekt in der Mitte getroffen -> Interaktion 1249cdf0e10cSrcweir **********************************************************/ 1250cdf0e10cSrcweir SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj); 1251cdf0e10cSrcweir DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>(mpViewShell); 1252cdf0e10cSrcweir mpWindow->ReleaseMouse(); 1253cdf0e10cSrcweir 1254cdf0e10cSrcweir switch (pInfo->meClickAction) 1255cdf0e10cSrcweir { 1256cdf0e10cSrcweir case presentation::ClickAction_BOOKMARK: 1257cdf0e10cSrcweir { 1258cdf0e10cSrcweir // Sprung zu Bookmark (Seite oder Objekt) 1259cdf0e10cSrcweir SfxStringItem aItem(SID_NAVIGATOR_OBJECT, pInfo->GetBookmark()); 1260cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()-> 1261cdf0e10cSrcweir Execute(SID_NAVIGATOR_OBJECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L); 1262cdf0e10cSrcweir bAnimated = sal_True; 1263cdf0e10cSrcweir } 1264cdf0e10cSrcweir break; 1265cdf0e10cSrcweir 1266cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT: 1267cdf0e10cSrcweir { 1268cdf0e10cSrcweir String sBookmark( pInfo->GetBookmark() ); 1269cdf0e10cSrcweir // Sprung zu Dokument 1270cdf0e10cSrcweir if (sBookmark.Len()) 1271cdf0e10cSrcweir { 1272cdf0e10cSrcweir SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName()); 1273cdf0e10cSrcweir SfxStringItem aStrItem(SID_FILE_NAME, sBookmark); 1274cdf0e10cSrcweir SfxViewFrame* pFrame = mpViewShell->GetViewFrame(); 1275cdf0e10cSrcweir SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame); 1276cdf0e10cSrcweir SfxBoolItem aBrowseItem( SID_BROWSE, sal_True ); 1277cdf0e10cSrcweir pFrame->GetDispatcher()-> 1278cdf0e10cSrcweir Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, 1279cdf0e10cSrcweir &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L); 1280cdf0e10cSrcweir } 1281cdf0e10cSrcweir 1282cdf0e10cSrcweir bAnimated = sal_True; 1283cdf0e10cSrcweir } 1284cdf0e10cSrcweir break; 1285cdf0e10cSrcweir 1286cdf0e10cSrcweir case presentation::ClickAction_PREVPAGE: 1287cdf0e10cSrcweir { 1288cdf0e10cSrcweir // Sprung zur vorherigen Seite 1289cdf0e10cSrcweir SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_PREVIOUS); 1290cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()-> 1291cdf0e10cSrcweir Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, 1292cdf0e10cSrcweir &aItem, 0L); 1293cdf0e10cSrcweir bAnimated = sal_True; 1294cdf0e10cSrcweir } 1295cdf0e10cSrcweir break; 1296cdf0e10cSrcweir 1297cdf0e10cSrcweir case presentation::ClickAction_NEXTPAGE: 1298cdf0e10cSrcweir { 1299cdf0e10cSrcweir // Sprung zur naechsten Seite 1300cdf0e10cSrcweir SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_NEXT); 1301cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()-> 1302cdf0e10cSrcweir Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, 1303cdf0e10cSrcweir &aItem, 0L); 1304cdf0e10cSrcweir bAnimated = sal_True; 1305cdf0e10cSrcweir } 1306cdf0e10cSrcweir break; 1307cdf0e10cSrcweir 1308cdf0e10cSrcweir case presentation::ClickAction_FIRSTPAGE: 1309cdf0e10cSrcweir { 1310cdf0e10cSrcweir // Sprung zu erster Seite 1311cdf0e10cSrcweir SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_FIRST); 1312cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()-> 1313cdf0e10cSrcweir Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, 1314cdf0e10cSrcweir &aItem, 0L); 1315cdf0e10cSrcweir bAnimated = sal_True; 1316cdf0e10cSrcweir } 1317cdf0e10cSrcweir break; 1318cdf0e10cSrcweir 1319cdf0e10cSrcweir case presentation::ClickAction_LASTPAGE: 1320cdf0e10cSrcweir { 1321cdf0e10cSrcweir // Sprung zu letzter Seite 1322cdf0e10cSrcweir SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_LAST); 1323cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()-> 1324cdf0e10cSrcweir Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, 1325cdf0e10cSrcweir &aItem, 0L); 1326cdf0e10cSrcweir bAnimated = sal_True; 1327cdf0e10cSrcweir } 1328cdf0e10cSrcweir break; 1329cdf0e10cSrcweir 1330cdf0e10cSrcweir case presentation::ClickAction_SOUND: 1331cdf0e10cSrcweir { 1332cdf0e10cSrcweir try 1333cdf0e10cSrcweir { 1334cdf0e10cSrcweir mxPlayer.set( avmedia::MediaWindow::createPlayer( pInfo->GetBookmark()), uno::UNO_QUERY_THROW ); 1335cdf0e10cSrcweir mxPlayer->start(); 1336cdf0e10cSrcweir } 1337cdf0e10cSrcweir catch( uno::Exception& e ) 1338cdf0e10cSrcweir { 1339cdf0e10cSrcweir (void)e; 1340cdf0e10cSrcweir } 1341cdf0e10cSrcweir bAnimated = sal_True; 1342cdf0e10cSrcweir } 1343cdf0e10cSrcweir break; 1344cdf0e10cSrcweir 1345cdf0e10cSrcweir case presentation::ClickAction_VERB: 1346cdf0e10cSrcweir { 1347cdf0e10cSrcweir // Verb zuweisen 1348cdf0e10cSrcweir mpView->UnmarkAll(); 1349cdf0e10cSrcweir mpView->MarkObj(pObj, mpView->GetSdrPageView(), sal_False, sal_False); 1350cdf0e10cSrcweir pDrViewSh->DoVerb((sal_Int16)pInfo->mnVerb); 1351cdf0e10cSrcweir bAnimated = sal_True; 1352cdf0e10cSrcweir } 1353cdf0e10cSrcweir break; 1354cdf0e10cSrcweir 1355cdf0e10cSrcweir case presentation::ClickAction_PROGRAM: 1356cdf0e10cSrcweir { 1357cdf0e10cSrcweir String aBaseURL = GetDocSh()->GetMedium()->GetBaseURL(); 1358cdf0e10cSrcweir INetURLObject aURL( ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), pInfo->GetBookmark(), 1359cdf0e10cSrcweir URIHelper::GetMaybeFileHdl(), true, false, 1360cdf0e10cSrcweir INetURLObject::WAS_ENCODED, INetURLObject::DECODE_UNAMBIGUOUS ) ); 1361cdf0e10cSrcweir 1362cdf0e10cSrcweir if( INET_PROT_FILE == aURL.GetProtocol() ) 1363cdf0e10cSrcweir { 1364cdf0e10cSrcweir SfxStringItem aUrl( SID_FILE_NAME, aURL.GetMainURL( INetURLObject::NO_DECODE ) ); 1365cdf0e10cSrcweir SfxBoolItem aBrowsing( SID_BROWSE, sal_True ); 1366cdf0e10cSrcweir 1367cdf0e10cSrcweir SfxViewFrame* pViewFrm = SfxViewFrame::Current(); 1368cdf0e10cSrcweir if (pViewFrm) 1369cdf0e10cSrcweir pViewFrm->GetDispatcher()->Execute( SID_OPENDOC, 1370cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, 1371cdf0e10cSrcweir &aUrl, 1372cdf0e10cSrcweir &aBrowsing, 1373cdf0e10cSrcweir 0L ); 1374cdf0e10cSrcweir } 1375cdf0e10cSrcweir 1376cdf0e10cSrcweir bAnimated = sal_True; 1377cdf0e10cSrcweir } 1378cdf0e10cSrcweir break; 1379cdf0e10cSrcweir 1380cdf0e10cSrcweir case presentation::ClickAction_MACRO: 1381cdf0e10cSrcweir { 1382cdf0e10cSrcweir // Execute makro 1383cdf0e10cSrcweir String aMacro = pInfo->GetBookmark(); 1384cdf0e10cSrcweir 1385cdf0e10cSrcweir if ( SfxApplication::IsXScriptURL( aMacro ) ) 1386cdf0e10cSrcweir { 1387cdf0e10cSrcweir uno::Any aRet; 1388cdf0e10cSrcweir uno::Sequence< sal_Int16 > aOutArgsIndex; 1389cdf0e10cSrcweir uno::Sequence< uno::Any > aOutArgs; 1390cdf0e10cSrcweir uno::Sequence< uno::Any >* pInArgs = 1391cdf0e10cSrcweir new uno::Sequence< uno::Any >(0); 1392cdf0e10cSrcweir 1393cdf0e10cSrcweir ErrCode eErr = mpDocSh->CallXScript( aMacro, 1394cdf0e10cSrcweir *pInArgs, aRet, aOutArgsIndex, aOutArgs); 1395cdf0e10cSrcweir 1396cdf0e10cSrcweir // Check the return value from the script 1397cdf0e10cSrcweir sal_Bool bTmp = sal_False; 1398cdf0e10cSrcweir if ( eErr == ERRCODE_NONE && 1399cdf0e10cSrcweir aRet.getValueType() == getCppuBooleanType() && 1400cdf0e10cSrcweir sal_True == ( aRet >>= bTmp ) && 1401cdf0e10cSrcweir bTmp == sal_True ) 1402cdf0e10cSrcweir { 1403cdf0e10cSrcweir bAnimated = sal_True; 1404cdf0e10cSrcweir } 1405cdf0e10cSrcweir else 1406cdf0e10cSrcweir { 1407cdf0e10cSrcweir bAnimated = sal_False; 1408cdf0e10cSrcweir } 1409cdf0e10cSrcweir } 1410cdf0e10cSrcweir else 1411cdf0e10cSrcweir { 1412cdf0e10cSrcweir // aMacro has got following format: 1413cdf0e10cSrcweir // "Macroname.Modulname.Libname.Documentname" or 1414cdf0e10cSrcweir // "Macroname.Modulname.Libname.Applicationsname" 1415cdf0e10cSrcweir String aMacroName = 1416cdf0e10cSrcweir aMacro.GetToken(0, sal_Unicode('.')); 1417cdf0e10cSrcweir String aModulName = 1418cdf0e10cSrcweir aMacro.GetToken(1, sal_Unicode('.')); 1419cdf0e10cSrcweir String aLibName = 1420cdf0e10cSrcweir aMacro.GetToken(2, sal_Unicode('.')); 1421cdf0e10cSrcweir String aDocName = 1422cdf0e10cSrcweir aMacro.GetToken(3, sal_Unicode('.')); 1423cdf0e10cSrcweir 1424cdf0e10cSrcweir // In this moment the Call-method only 1425cdf0e10cSrcweir // resolves modulename+macroname 1426cdf0e10cSrcweir String aExecMacro(aModulName); 1427cdf0e10cSrcweir aExecMacro.Append( sal_Unicode('.') ); 1428cdf0e10cSrcweir aExecMacro.Append( aMacroName ); 1429cdf0e10cSrcweir bAnimated = mpDocSh->GetBasic()->Call(aExecMacro); 1430cdf0e10cSrcweir } 1431cdf0e10cSrcweir } 1432cdf0e10cSrcweir break; 1433cdf0e10cSrcweir 1434cdf0e10cSrcweir default: 1435cdf0e10cSrcweir { 1436cdf0e10cSrcweir bAnimated = sal_False; 1437cdf0e10cSrcweir } 1438cdf0e10cSrcweir break; 1439cdf0e10cSrcweir } 1440cdf0e10cSrcweir } 1441cdf0e10cSrcweir 1442cdf0e10cSrcweir if (!bAnimated && 1443cdf0e10cSrcweir mpView->ISA(DrawView) && 1444cdf0e10cSrcweir !mpDocSh->ISA(GraphicDocShell) && 1445cdf0e10cSrcweir SlideShow::IsRunning( mpViewShell->GetViewShellBase() ) && 1446cdf0e10cSrcweir mpDoc->GetAnimationInfo(pObj)) 1447cdf0e10cSrcweir { 1448cdf0e10cSrcweir /********************************************************** 1449cdf0e10cSrcweir * Effekt-Objekt in der Mitte getroffen -> Effekt abspielen 1450cdf0e10cSrcweir **********************************************************/ 1451cdf0e10cSrcweir SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj); 1452cdf0e10cSrcweir 1453cdf0e10cSrcweir switch (pInfo->meClickAction) 1454cdf0e10cSrcweir { 1455cdf0e10cSrcweir case presentation::ClickAction_VANISH: 1456cdf0e10cSrcweir case presentation::ClickAction_INVISIBLE: 1457cdf0e10cSrcweir break; 1458cdf0e10cSrcweir 1459cdf0e10cSrcweir default: 1460cdf0e10cSrcweir bAnimated = sal_False; 1461cdf0e10cSrcweir break; 1462cdf0e10cSrcweir } 1463cdf0e10cSrcweir } 1464cdf0e10cSrcweir } 1465cdf0e10cSrcweir 1466cdf0e10cSrcweir return bAnimated; 1467cdf0e10cSrcweir } 1468cdf0e10cSrcweir 1469cdf0e10cSrcweir 1470cdf0e10cSrcweir 1471cdf0e10cSrcweir /** is called when the currenct function should be aborted. <p> 1472cdf0e10cSrcweir This is used when a function gets a KEY_ESCAPE but can also 1473cdf0e10cSrcweir be called directly. 1474cdf0e10cSrcweir 1475cdf0e10cSrcweir @returns true if a active function was aborted 1476cdf0e10cSrcweir */ 1477cdf0e10cSrcweir bool FuSelection::cancel() 1478cdf0e10cSrcweir { 1479cdf0e10cSrcweir if (mpView->Is3DRotationCreationActive()) 1480cdf0e10cSrcweir { 1481cdf0e10cSrcweir mpView->ResetCreationActive(); 1482cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD); 1483cdf0e10cSrcweir return true; 1484cdf0e10cSrcweir } 1485cdf0e10cSrcweir else 1486cdf0e10cSrcweir { 1487cdf0e10cSrcweir return false; 1488cdf0e10cSrcweir } 1489cdf0e10cSrcweir } 1490cdf0e10cSrcweir 1491cdf0e10cSrcweir 1492cdf0e10cSrcweir 1493cdf0e10cSrcweir 1494cdf0e10cSrcweir SdrObject* FuSelection::pickObject (const Point& rTestPoint) 1495cdf0e10cSrcweir { 1496cdf0e10cSrcweir SdrObject* pObject = NULL; 1497cdf0e10cSrcweir SdrPageView* pPageView; 1498cdf0e10cSrcweir sal_uInt16 nHitLog = sal_uInt16 (mpWindow->PixelToLogic(Size(HITPIX,0)).Width()); 1499cdf0e10cSrcweir mpView->PickObj (rTestPoint, nHitLog, pObject, pPageView, SDRSEARCH_PICKMARKABLE); 1500cdf0e10cSrcweir return pObject; 1501cdf0e10cSrcweir } 1502cdf0e10cSrcweir } // end of namespace sd 1503