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 10*5b190011SAndrew Rist * 11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*5b190011SAndrew Rist * 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. 19*5b190011SAndrew Rist * 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 #include <sot/object.hxx> 28cdf0e10cSrcweir #include <editeng/eeitem.hxx> 29cdf0e10cSrcweir #include <vcl/waitobj.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <editeng/flditem.hxx> 32cdf0e10cSrcweir #include <svx/svdogrp.hxx> 33cdf0e10cSrcweir #include <tools/urlobj.hxx> 34cdf0e10cSrcweir #include <vcl/help.hxx> 35cdf0e10cSrcweir #include <svx/bmpmask.hxx> 36cdf0e10cSrcweir #include <svx/svdotext.hxx> 37cdf0e10cSrcweir #include <sfx2/app.hxx> 38cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 39cdf0e10cSrcweir #include <sfx2/bindings.hxx> 40cdf0e10cSrcweir #include <svx/svdpagv.hxx> 41cdf0e10cSrcweir #include <svtools/imapobj.hxx> 42cdf0e10cSrcweir #include <svx/svxids.hrc> 43cdf0e10cSrcweir #include <svx/obj3d.hxx> 44cdf0e10cSrcweir #include <svx/polysc3d.hxx> 45cdf0e10cSrcweir #include <svx/svdpagv.hxx> 46cdf0e10cSrcweir 47cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 48cdf0e10cSrcweir 49cdf0e10cSrcweir #include "anminfo.hxx" 50cdf0e10cSrcweir #include "anmdef.hxx" 51cdf0e10cSrcweir #include "imapinfo.hxx" 52cdf0e10cSrcweir #include "app.hrc" 53cdf0e10cSrcweir #include "glob.hrc" 54cdf0e10cSrcweir #include "strings.hrc" 55cdf0e10cSrcweir #include "res_bmp.hrc" 56cdf0e10cSrcweir 57cdf0e10cSrcweir #include "app.hxx" 58cdf0e10cSrcweir #include "GraphicDocShell.hxx" 59cdf0e10cSrcweir #include "fudraw.hxx" 60cdf0e10cSrcweir #include "ViewShell.hxx" 61cdf0e10cSrcweir #include "FrameView.hxx" 62cdf0e10cSrcweir #include "View.hxx" 63cdf0e10cSrcweir #ifndef SD_WINDOW_SHELL_HXX 64cdf0e10cSrcweir #include "Window.hxx" 65cdf0e10cSrcweir #endif 66cdf0e10cSrcweir #include "drawdoc.hxx" 67cdf0e10cSrcweir #include "DrawDocShell.hxx" 68cdf0e10cSrcweir #include "Client.hxx" 69cdf0e10cSrcweir #include "sdresid.hxx" 70cdf0e10cSrcweir #include "drawview.hxx" 71cdf0e10cSrcweir #include "fusel.hxx" 72cdf0e10cSrcweir #include <svl/aeitem.hxx> 73cdf0e10cSrcweir #include <vcl/msgbox.hxx> 74cdf0e10cSrcweir #include "slideshow.hxx" 75cdf0e10cSrcweir #include <svx/sdrhittesthelper.hxx> 76cdf0e10cSrcweir 77cdf0e10cSrcweir using namespace ::com::sun::star; 78cdf0e10cSrcweir 79cdf0e10cSrcweir namespace sd { 80cdf0e10cSrcweir 81cdf0e10cSrcweir TYPEINIT1( FuDraw, FuPoor ); 82cdf0e10cSrcweir 83cdf0e10cSrcweir /************************************************************************* 84cdf0e10cSrcweir |* 85cdf0e10cSrcweir |* Base-class for all drawmodul-specific functions 86cdf0e10cSrcweir |* 87cdf0e10cSrcweir \************************************************************************/ 88cdf0e10cSrcweir 89cdf0e10cSrcweir FuDraw::FuDraw(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, 90cdf0e10cSrcweir SdDrawDocument* pDoc, SfxRequest& rReq) : 91cdf0e10cSrcweir FuPoor(pViewSh, pWin, pView, pDoc, rReq), 92cdf0e10cSrcweir bMBDown(sal_False), 93cdf0e10cSrcweir bDragHelpLine(sal_False), 94cdf0e10cSrcweir bPermanent(sal_False) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir } 97cdf0e10cSrcweir 98cdf0e10cSrcweir /************************************************************************* 99cdf0e10cSrcweir |* 100cdf0e10cSrcweir |* Destruktor 101cdf0e10cSrcweir |* 102cdf0e10cSrcweir \************************************************************************/ 103cdf0e10cSrcweir 104cdf0e10cSrcweir FuDraw::~FuDraw() 105cdf0e10cSrcweir { 106cdf0e10cSrcweir mpView->BrkAction(); 107cdf0e10cSrcweir } 108cdf0e10cSrcweir 109cdf0e10cSrcweir /************************************************************************* 110cdf0e10cSrcweir |* 111cdf0e10cSrcweir |* MouseButtonDown-event 112cdf0e10cSrcweir |* 113cdf0e10cSrcweir \************************************************************************/ 114cdf0e10cSrcweir 115cdf0e10cSrcweir sal_Bool FuDraw::MouseButtonDown(const MouseEvent& rMEvt) 116cdf0e10cSrcweir { 117cdf0e10cSrcweir // #95491# remember button state for creation of own MouseEvents 118cdf0e10cSrcweir SetMouseButtonCode(rMEvt.GetButtons()); 119cdf0e10cSrcweir 120cdf0e10cSrcweir sal_Bool bReturn = sal_False; 121cdf0e10cSrcweir 122cdf0e10cSrcweir bDragHelpLine = sal_False; 123cdf0e10cSrcweir 124cdf0e10cSrcweir aMDPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() ); 125cdf0e10cSrcweir 126cdf0e10cSrcweir if ( rMEvt.IsLeft() ) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir FrameView* pFrameView = mpViewShell->GetFrameView(); 129cdf0e10cSrcweir 130cdf0e10cSrcweir // sal_Bool bOrtho = mpView->IsOrthoDesired() || pFrameView->IsOrtho(); 131cdf0e10cSrcweir // bOrtho = bOrtho != rMEvt.IsShift(); 132cdf0e10cSrcweir sal_Bool bOrtho = sal_False; 133cdf0e10cSrcweir 134cdf0e10cSrcweir sal_Bool bRestricted = sal_True; 135cdf0e10cSrcweir 136cdf0e10cSrcweir if (mpView->IsDragObj()) 137cdf0e10cSrcweir { 138cdf0e10cSrcweir // object is dragged (move, resize,...) 139cdf0e10cSrcweir const SdrHdl* pHdl = mpView->GetDragStat().GetHdl(); 140cdf0e10cSrcweir 141cdf0e10cSrcweir if (!pHdl || (!pHdl->IsCornerHdl() && !pHdl->IsVertexHdl())) 142cdf0e10cSrcweir { 143cdf0e10cSrcweir // Move 144cdf0e10cSrcweir bRestricted = sal_False; 145cdf0e10cSrcweir } 146cdf0e10cSrcweir } 147cdf0e10cSrcweir 148cdf0e10cSrcweir // #i33136# 149cdf0e10cSrcweir if(bRestricted && doConstructOrthogonal()) 150cdf0e10cSrcweir { 151cdf0e10cSrcweir // Restrict movement: 152cdf0e10cSrcweir // rectangle->quadrat, ellipse->circle etc. 153cdf0e10cSrcweir bOrtho = !rMEvt.IsShift(); 154cdf0e10cSrcweir } 155cdf0e10cSrcweir else 156cdf0e10cSrcweir { 157cdf0e10cSrcweir bOrtho = rMEvt.IsShift() != pFrameView->IsOrtho(); 158cdf0e10cSrcweir } 159cdf0e10cSrcweir 160cdf0e10cSrcweir if (!mpView->IsSnapEnabled()) 161cdf0e10cSrcweir mpView->SetSnapEnabled(sal_True); 162cdf0e10cSrcweir sal_Bool bSnapModPressed = rMEvt.IsMod1(); 163cdf0e10cSrcweir 164cdf0e10cSrcweir sal_Bool bGridSnap = pFrameView->IsGridSnap(); 165cdf0e10cSrcweir bGridSnap = (bSnapModPressed != bGridSnap); 166cdf0e10cSrcweir 167cdf0e10cSrcweir if (mpView->IsGridSnap() != bGridSnap) 168cdf0e10cSrcweir mpView->SetGridSnap(bGridSnap); 169cdf0e10cSrcweir 170cdf0e10cSrcweir sal_Bool bBordSnap = pFrameView->IsBordSnap(); 171cdf0e10cSrcweir bBordSnap = (bSnapModPressed != bBordSnap); 172cdf0e10cSrcweir 173cdf0e10cSrcweir if (mpView->IsBordSnap() != bBordSnap) 174cdf0e10cSrcweir mpView->SetBordSnap(bBordSnap); 175cdf0e10cSrcweir 176cdf0e10cSrcweir sal_Bool bHlplSnap = pFrameView->IsHlplSnap(); 177cdf0e10cSrcweir bHlplSnap = (bSnapModPressed != bHlplSnap); 178cdf0e10cSrcweir 179cdf0e10cSrcweir if (mpView->IsHlplSnap() != bHlplSnap) 180cdf0e10cSrcweir mpView->SetHlplSnap(bHlplSnap); 181cdf0e10cSrcweir 182cdf0e10cSrcweir sal_Bool bOFrmSnap = pFrameView->IsOFrmSnap(); 183cdf0e10cSrcweir bOFrmSnap = (bSnapModPressed != bOFrmSnap); 184cdf0e10cSrcweir 185cdf0e10cSrcweir if (mpView->IsOFrmSnap() != bOFrmSnap) 186cdf0e10cSrcweir mpView->SetOFrmSnap(bOFrmSnap); 187cdf0e10cSrcweir 188cdf0e10cSrcweir sal_Bool bOPntSnap = pFrameView->IsOPntSnap(); 189cdf0e10cSrcweir bOPntSnap = (bSnapModPressed != bOPntSnap); 190cdf0e10cSrcweir 191cdf0e10cSrcweir if (mpView->IsOPntSnap() != bOPntSnap) 192cdf0e10cSrcweir mpView->SetOPntSnap(bOPntSnap); 193cdf0e10cSrcweir 194cdf0e10cSrcweir sal_Bool bOConSnap = pFrameView->IsOConSnap(); 195cdf0e10cSrcweir bOConSnap = (bSnapModPressed != bOConSnap); 196cdf0e10cSrcweir 197cdf0e10cSrcweir if (mpView->IsOConSnap() != bOConSnap) 198cdf0e10cSrcweir mpView->SetOConSnap(bOConSnap); 199cdf0e10cSrcweir 200cdf0e10cSrcweir sal_Bool bAngleSnap = rMEvt.IsShift() == !pFrameView->IsAngleSnapEnabled(); 201cdf0e10cSrcweir 202cdf0e10cSrcweir if (mpView->IsAngleSnapEnabled() != bAngleSnap) 203cdf0e10cSrcweir mpView->SetAngleSnapEnabled(bAngleSnap); 204cdf0e10cSrcweir 205cdf0e10cSrcweir if (mpView->IsOrtho() != bOrtho) 206cdf0e10cSrcweir mpView->SetOrtho(bOrtho); 207cdf0e10cSrcweir 208cdf0e10cSrcweir sal_Bool bCenter = rMEvt.IsMod2(); 209cdf0e10cSrcweir 210cdf0e10cSrcweir if ( mpView->IsCreate1stPointAsCenter() != bCenter || 211cdf0e10cSrcweir mpView->IsResizeAtCenter() != bCenter ) 212cdf0e10cSrcweir { 213cdf0e10cSrcweir mpView->SetCreate1stPointAsCenter(bCenter); 214cdf0e10cSrcweir mpView->SetResizeAtCenter(bCenter); 215cdf0e10cSrcweir } 216cdf0e10cSrcweir 217cdf0e10cSrcweir SdrPageView* pPV = 0; 218cdf0e10cSrcweir sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() ); 219cdf0e10cSrcweir 220cdf0e10cSrcweir // #76572# look only for HelpLines when they are visible (!) 221cdf0e10cSrcweir sal_Bool bHelpLine(sal_False); 222cdf0e10cSrcweir if(mpView->IsHlplVisible()) 223cdf0e10cSrcweir bHelpLine = mpView->PickHelpLine(aMDPos, nHitLog, *mpWindow, nHelpLine, pPV); 224cdf0e10cSrcweir sal_Bool bHitHdl = (mpView->PickHandle(aMDPos) != NULL); 225cdf0e10cSrcweir 226cdf0e10cSrcweir if ( bHelpLine 227cdf0e10cSrcweir && !mpView->IsCreateObj() 228cdf0e10cSrcweir && ((mpView->GetEditMode() == SDREDITMODE_EDIT && !bHitHdl) || (rMEvt.IsShift() && bSnapModPressed)) ) 229cdf0e10cSrcweir { 230cdf0e10cSrcweir mpWindow->CaptureMouse(); 231cdf0e10cSrcweir mpView->BegDragHelpLine(nHelpLine, pPV); 232cdf0e10cSrcweir bDragHelpLine = mpView->IsDragHelpLine(); 233cdf0e10cSrcweir bReturn = sal_True; 234cdf0e10cSrcweir } 235cdf0e10cSrcweir } 236cdf0e10cSrcweir ForcePointer(&rMEvt); 237cdf0e10cSrcweir 238cdf0e10cSrcweir return bReturn; 239cdf0e10cSrcweir } 240cdf0e10cSrcweir 241cdf0e10cSrcweir /************************************************************************* 242cdf0e10cSrcweir |* 243cdf0e10cSrcweir |* MouseMove-event 244cdf0e10cSrcweir |* 245cdf0e10cSrcweir \************************************************************************/ 246cdf0e10cSrcweir 247cdf0e10cSrcweir sal_Bool FuDraw::MouseMove(const MouseEvent& rMEvt) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir FrameView* pFrameView = mpViewShell->GetFrameView(); 250cdf0e10cSrcweir Point aPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() ); 251cdf0e10cSrcweir 252cdf0e10cSrcweir // sal_Bool bOrtho = mpView->IsOrthoDesired() || pFrameView->IsOrtho(); 253cdf0e10cSrcweir // bOrtho = bOrtho != rMEvt.IsShift(); 254cdf0e10cSrcweir sal_Bool bOrtho = sal_False; 255cdf0e10cSrcweir 256cdf0e10cSrcweir sal_Bool bRestricted = sal_True; 257cdf0e10cSrcweir 258cdf0e10cSrcweir if (mpView->IsDragObj()) 259cdf0e10cSrcweir { 260cdf0e10cSrcweir // object is dragged (move, resize, ...) 261cdf0e10cSrcweir const SdrHdl* pHdl = mpView->GetDragStat().GetHdl(); 262cdf0e10cSrcweir 263cdf0e10cSrcweir if (!pHdl || (!pHdl->IsCornerHdl() && !pHdl->IsVertexHdl())) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir // Move 266cdf0e10cSrcweir bRestricted = sal_False; 267cdf0e10cSrcweir } 268cdf0e10cSrcweir } 269cdf0e10cSrcweir 270cdf0e10cSrcweir if (mpView->IsAction()) 271cdf0e10cSrcweir { 272cdf0e10cSrcweir // #i33136# 273cdf0e10cSrcweir if(bRestricted && doConstructOrthogonal()) 274cdf0e10cSrcweir { 275cdf0e10cSrcweir // Restrict movement: 276cdf0e10cSrcweir // rectangle->quadrat, ellipse->circle etc. 277cdf0e10cSrcweir bOrtho = !rMEvt.IsShift(); 278cdf0e10cSrcweir } 279cdf0e10cSrcweir else 280cdf0e10cSrcweir { 281cdf0e10cSrcweir bOrtho = rMEvt.IsShift() != pFrameView->IsOrtho(); 282cdf0e10cSrcweir } 283cdf0e10cSrcweir 284cdf0e10cSrcweir sal_Bool bSnapModPressed = rMEvt.IsMod2(); 285cdf0e10cSrcweir mpView->SetDragWithCopy(rMEvt.IsMod1() && pFrameView->IsDragWithCopy()); 286cdf0e10cSrcweir 287cdf0e10cSrcweir sal_Bool bGridSnap = pFrameView->IsGridSnap(); 288cdf0e10cSrcweir bGridSnap = (bSnapModPressed != bGridSnap); 289cdf0e10cSrcweir 290cdf0e10cSrcweir if (mpView->IsGridSnap() != bGridSnap) 291cdf0e10cSrcweir mpView->SetGridSnap(bGridSnap); 292cdf0e10cSrcweir 293cdf0e10cSrcweir sal_Bool bBordSnap = pFrameView->IsBordSnap(); 294cdf0e10cSrcweir bBordSnap = (bSnapModPressed != bBordSnap); 295cdf0e10cSrcweir 296cdf0e10cSrcweir if (mpView->IsBordSnap() != bBordSnap) 297cdf0e10cSrcweir mpView->SetBordSnap(bBordSnap); 298cdf0e10cSrcweir 299cdf0e10cSrcweir sal_Bool bHlplSnap = pFrameView->IsHlplSnap(); 300cdf0e10cSrcweir bHlplSnap = (bSnapModPressed != bHlplSnap); 301cdf0e10cSrcweir 302cdf0e10cSrcweir if (mpView->IsHlplSnap() != bHlplSnap) 303cdf0e10cSrcweir mpView->SetHlplSnap(bHlplSnap); 304cdf0e10cSrcweir 305cdf0e10cSrcweir sal_Bool bOFrmSnap = pFrameView->IsOFrmSnap(); 306cdf0e10cSrcweir bOFrmSnap = (bSnapModPressed != bOFrmSnap); 307cdf0e10cSrcweir 308cdf0e10cSrcweir if (mpView->IsOFrmSnap() != bOFrmSnap) 309cdf0e10cSrcweir mpView->SetOFrmSnap(bOFrmSnap); 310cdf0e10cSrcweir 311cdf0e10cSrcweir sal_Bool bOPntSnap = pFrameView->IsOPntSnap(); 312cdf0e10cSrcweir bOPntSnap = (bSnapModPressed != bOPntSnap); 313cdf0e10cSrcweir 314cdf0e10cSrcweir if (mpView->IsOPntSnap() != bOPntSnap) 315cdf0e10cSrcweir mpView->SetOPntSnap(bOPntSnap); 316cdf0e10cSrcweir 317cdf0e10cSrcweir sal_Bool bOConSnap = pFrameView->IsOConSnap(); 318cdf0e10cSrcweir bOConSnap = (bSnapModPressed != bOConSnap); 319cdf0e10cSrcweir 320cdf0e10cSrcweir if (mpView->IsOConSnap() != bOConSnap) 321cdf0e10cSrcweir mpView->SetOConSnap(bOConSnap); 322cdf0e10cSrcweir 323cdf0e10cSrcweir sal_Bool bAngleSnap = rMEvt.IsShift() == !pFrameView->IsAngleSnapEnabled(); 324cdf0e10cSrcweir 325cdf0e10cSrcweir if (mpView->IsAngleSnapEnabled() != bAngleSnap) 326cdf0e10cSrcweir mpView->SetAngleSnapEnabled(bAngleSnap); 327cdf0e10cSrcweir 328cdf0e10cSrcweir if (mpView->IsOrtho() != bOrtho) 329cdf0e10cSrcweir mpView->SetOrtho(bOrtho); 330cdf0e10cSrcweir 331cdf0e10cSrcweir sal_Bool bCenter = rMEvt.IsMod2(); 332cdf0e10cSrcweir 333cdf0e10cSrcweir if ( mpView->IsCreate1stPointAsCenter() != bCenter || 334cdf0e10cSrcweir mpView->IsResizeAtCenter() != bCenter ) 335cdf0e10cSrcweir { 336cdf0e10cSrcweir mpView->SetCreate1stPointAsCenter(bCenter); 337cdf0e10cSrcweir mpView->SetResizeAtCenter(bCenter); 338cdf0e10cSrcweir } 339cdf0e10cSrcweir 340cdf0e10cSrcweir if ( mpView->IsDragHelpLine() ) 341cdf0e10cSrcweir mpView->MovDragHelpLine(aPos); 342cdf0e10cSrcweir } 343cdf0e10cSrcweir 344cdf0e10cSrcweir sal_Bool bReturn = mpView->MouseMove(rMEvt, mpWindow); 345cdf0e10cSrcweir 346cdf0e10cSrcweir if (mpView->IsAction()) 347cdf0e10cSrcweir { 348cdf0e10cSrcweir // Because the flag set back if necessary in MouseMove 349cdf0e10cSrcweir if (mpView->IsOrtho() != bOrtho) 350cdf0e10cSrcweir mpView->SetOrtho(bOrtho); 351cdf0e10cSrcweir } 352cdf0e10cSrcweir 353cdf0e10cSrcweir ForcePointer(&rMEvt); 354cdf0e10cSrcweir 355cdf0e10cSrcweir return bReturn; 356cdf0e10cSrcweir } 357cdf0e10cSrcweir 358cdf0e10cSrcweir /************************************************************************* 359cdf0e10cSrcweir |* 360cdf0e10cSrcweir |* MouseButtonUp-event 361cdf0e10cSrcweir |* 362cdf0e10cSrcweir \************************************************************************/ 363cdf0e10cSrcweir 364cdf0e10cSrcweir sal_Bool FuDraw::MouseButtonUp(const MouseEvent& rMEvt) 365cdf0e10cSrcweir { 366cdf0e10cSrcweir if ( mpView->IsDragHelpLine() ) 367cdf0e10cSrcweir mpView->EndDragHelpLine(); 368cdf0e10cSrcweir 369cdf0e10cSrcweir if ( bDragHelpLine ) 370cdf0e10cSrcweir { 371cdf0e10cSrcweir Rectangle aOutputArea(Point(0,0), mpWindow->GetOutputSizePixel()); 372cdf0e10cSrcweir 373cdf0e10cSrcweir if ( !aOutputArea.IsInside(rMEvt.GetPosPixel()) ) 374cdf0e10cSrcweir mpView->GetSdrPageView()->DeleteHelpLine(nHelpLine); 375cdf0e10cSrcweir 376cdf0e10cSrcweir mpWindow->ReleaseMouse(); 377cdf0e10cSrcweir } 378cdf0e10cSrcweir 379cdf0e10cSrcweir FrameView* pFrameView = mpViewShell->GetFrameView(); 380cdf0e10cSrcweir mpView->SetOrtho( pFrameView->IsOrtho() ); 381cdf0e10cSrcweir mpView->SetAngleSnapEnabled( pFrameView->IsAngleSnapEnabled() ); 382cdf0e10cSrcweir mpView->SetSnapEnabled(sal_True); 383cdf0e10cSrcweir mpView->SetCreate1stPointAsCenter(sal_False); 384cdf0e10cSrcweir mpView->SetResizeAtCenter(sal_False); 385cdf0e10cSrcweir mpView->SetDragWithCopy(pFrameView->IsDragWithCopy()); 386cdf0e10cSrcweir mpView->SetGridSnap(pFrameView->IsGridSnap()); 387cdf0e10cSrcweir mpView->SetBordSnap(pFrameView->IsBordSnap()); 388cdf0e10cSrcweir mpView->SetHlplSnap(pFrameView->IsHlplSnap()); 389cdf0e10cSrcweir mpView->SetOFrmSnap(pFrameView->IsOFrmSnap()); 390cdf0e10cSrcweir mpView->SetOPntSnap(pFrameView->IsOPntSnap()); 391cdf0e10cSrcweir mpView->SetOConSnap(pFrameView->IsOConSnap()); 392cdf0e10cSrcweir 393cdf0e10cSrcweir bIsInDragMode = sal_False; 394cdf0e10cSrcweir ForcePointer(&rMEvt); 395cdf0e10cSrcweir FuPoor::MouseButtonUp(rMEvt); 396cdf0e10cSrcweir 397cdf0e10cSrcweir return sal_False; 398cdf0e10cSrcweir } 399cdf0e10cSrcweir 400cdf0e10cSrcweir /************************************************************************* 401cdf0e10cSrcweir |* 402cdf0e10cSrcweir |* Process keyboard-events 403cdf0e10cSrcweir |* 404cdf0e10cSrcweir |* When processing a KeyEvent the returnvalue is sal_True, otherwise sal_False. 405cdf0e10cSrcweir |* 406cdf0e10cSrcweir \************************************************************************/ 407cdf0e10cSrcweir 408cdf0e10cSrcweir sal_Bool FuDraw::KeyInput(const KeyEvent& rKEvt) 409cdf0e10cSrcweir { 410cdf0e10cSrcweir sal_Bool bReturn = sal_False; 411cdf0e10cSrcweir 412cdf0e10cSrcweir switch ( rKEvt.GetKeyCode().GetCode() ) 413cdf0e10cSrcweir { 414cdf0e10cSrcweir case KEY_ESCAPE: 415cdf0e10cSrcweir { 416cdf0e10cSrcweir bReturn = FuDraw::cancel(); 417cdf0e10cSrcweir } 418cdf0e10cSrcweir break; 419cdf0e10cSrcweir 420cdf0e10cSrcweir case KEY_DELETE: 421cdf0e10cSrcweir case KEY_BACKSPACE: 422cdf0e10cSrcweir { 423cdf0e10cSrcweir if (!mpDocSh->IsReadOnly()) 424cdf0e10cSrcweir { 425cdf0e10cSrcweir if ( mpView && mpView->IsPresObjSelected(sal_False, sal_True, sal_False, sal_True) ) 426cdf0e10cSrcweir { 427cdf0e10cSrcweir InfoBox(mpWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 428cdf0e10cSrcweir } 429cdf0e10cSrcweir else 430cdf0e10cSrcweir { 431cdf0e10cSrcweir // Falls IP-Client aktiv, werden die Pointer 432cdf0e10cSrcweir // auf das OLE- und das alte Graphic-Object 433cdf0e10cSrcweir // am SdClient zurueckgesetzt, damit bei 434cdf0e10cSrcweir // ::SelectionHasChanged nach dem Loeschen 435cdf0e10cSrcweir // nicht mehr versucht wird, ein Grafik-Objekt 436cdf0e10cSrcweir // zu restaurieren, das gar nicht mehr existiert. 437cdf0e10cSrcweir // Alle anderen OLE-Objekte sind davon nicht 438cdf0e10cSrcweir // betroffen (KA 06.10.95) 439cdf0e10cSrcweir OSL_ASSERT (mpViewShell->GetViewShell()!=NULL); 440cdf0e10cSrcweir Client* pIPClient = static_cast<Client*>( 441cdf0e10cSrcweir mpViewShell->GetViewShell()->GetIPClient()); 442cdf0e10cSrcweir if (pIPClient && pIPClient->IsObjectInPlaceActive()) 443cdf0e10cSrcweir pIPClient->SetSdrGrafObj(NULL); 444cdf0e10cSrcweir 445cdf0e10cSrcweir // wait-mousepointer while deleting object 446cdf0e10cSrcweir WaitObject aWait( (Window*)mpViewShell->GetActiveWindow() ); 447cdf0e10cSrcweir // delete object 448cdf0e10cSrcweir mpView->DeleteMarked(); 449cdf0e10cSrcweir } 450cdf0e10cSrcweir } 451cdf0e10cSrcweir bReturn = sal_True; 452cdf0e10cSrcweir } 453cdf0e10cSrcweir break; 454cdf0e10cSrcweir 455cdf0e10cSrcweir case KEY_TAB: 456cdf0e10cSrcweir { 457cdf0e10cSrcweir KeyCode aCode = rKEvt.GetKeyCode(); 458cdf0e10cSrcweir 459cdf0e10cSrcweir if ( !aCode.IsMod1() && !aCode.IsMod2() ) 460cdf0e10cSrcweir { 461cdf0e10cSrcweir // #105336# Moved next line which was a bugfix itself into 462cdf0e10cSrcweir // the scope which really does the object selection travel 463cdf0e10cSrcweir // and thus is allowed to call SelectionHasChanged(). 464cdf0e10cSrcweir 465cdf0e10cSrcweir // Switch to FuSelect. 466cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()->Execute( 467cdf0e10cSrcweir SID_OBJECT_SELECT, 468cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD); 469cdf0e10cSrcweir 470cdf0e10cSrcweir // changeover to the next object 471cdf0e10cSrcweir if(!mpView->MarkNextObj( !aCode.IsShift() )) 472cdf0e10cSrcweir { 473cdf0e10cSrcweir // #97016# No next object: go over open end and 474cdf0e10cSrcweir // get first from the other side 475cdf0e10cSrcweir mpView->UnmarkAllObj(); 476cdf0e10cSrcweir mpView->MarkNextObj(!aCode.IsShift()); 477cdf0e10cSrcweir } 478cdf0e10cSrcweir 479cdf0e10cSrcweir // #97016# II 480cdf0e10cSrcweir if(mpView->AreObjectsMarked()) 481cdf0e10cSrcweir mpView->MakeVisible(mpView->GetAllMarkedRect(), *mpWindow); 482cdf0e10cSrcweir 483cdf0e10cSrcweir bReturn = sal_True; 484cdf0e10cSrcweir } 485cdf0e10cSrcweir } 486cdf0e10cSrcweir break; 487cdf0e10cSrcweir 488cdf0e10cSrcweir case KEY_END: 489cdf0e10cSrcweir { 490cdf0e10cSrcweir KeyCode aCode = rKEvt.GetKeyCode(); 491cdf0e10cSrcweir 492cdf0e10cSrcweir if ( aCode.IsMod1() ) 493cdf0e10cSrcweir { 494cdf0e10cSrcweir // #97016# mark last object 495cdf0e10cSrcweir mpView->UnmarkAllObj(); 496cdf0e10cSrcweir mpView->MarkNextObj(sal_False); 497cdf0e10cSrcweir 498cdf0e10cSrcweir // #97016# II 499cdf0e10cSrcweir if(mpView->AreObjectsMarked()) 500cdf0e10cSrcweir mpView->MakeVisible(mpView->GetAllMarkedRect(), *mpWindow); 501cdf0e10cSrcweir 502cdf0e10cSrcweir bReturn = sal_True; 503cdf0e10cSrcweir } 504cdf0e10cSrcweir } 505cdf0e10cSrcweir break; 506cdf0e10cSrcweir 507cdf0e10cSrcweir case KEY_HOME: 508cdf0e10cSrcweir { 509cdf0e10cSrcweir KeyCode aCode = rKEvt.GetKeyCode(); 510cdf0e10cSrcweir 511cdf0e10cSrcweir if ( aCode.IsMod1() ) 512cdf0e10cSrcweir { 513cdf0e10cSrcweir // #97016# mark first object 514cdf0e10cSrcweir mpView->UnmarkAllObj(); 515cdf0e10cSrcweir mpView->MarkNextObj(sal_True); 516cdf0e10cSrcweir 517cdf0e10cSrcweir // #97016# II 518cdf0e10cSrcweir if(mpView->AreObjectsMarked()) 519cdf0e10cSrcweir mpView->MakeVisible(mpView->GetAllMarkedRect(), *mpWindow); 520cdf0e10cSrcweir 521cdf0e10cSrcweir bReturn = sal_True; 522cdf0e10cSrcweir } 523cdf0e10cSrcweir } 524cdf0e10cSrcweir break; 525cdf0e10cSrcweir 526cdf0e10cSrcweir default: 527cdf0e10cSrcweir break; 528cdf0e10cSrcweir } 529cdf0e10cSrcweir 530cdf0e10cSrcweir if (!bReturn) 531cdf0e10cSrcweir { 532cdf0e10cSrcweir bReturn = FuPoor::KeyInput(rKEvt); 533cdf0e10cSrcweir } 534cdf0e10cSrcweir else 535cdf0e10cSrcweir { 536cdf0e10cSrcweir mpWindow->ReleaseMouse(); 537cdf0e10cSrcweir } 538cdf0e10cSrcweir 539cdf0e10cSrcweir return (bReturn); 540cdf0e10cSrcweir } 541cdf0e10cSrcweir 542cdf0e10cSrcweir /************************************************************************* 543cdf0e10cSrcweir |* 544cdf0e10cSrcweir |* Fade out the selection-presentation before scrolling 545cdf0e10cSrcweir |* 546cdf0e10cSrcweir \************************************************************************/ 547cdf0e10cSrcweir 548cdf0e10cSrcweir void FuDraw::ScrollStart() 549cdf0e10cSrcweir { 550cdf0e10cSrcweir } 551cdf0e10cSrcweir 552cdf0e10cSrcweir /************************************************************************* 553cdf0e10cSrcweir |* 554cdf0e10cSrcweir |* After scrolling show the selection-presentation again 555cdf0e10cSrcweir |* 556cdf0e10cSrcweir \************************************************************************/ 557cdf0e10cSrcweir 558cdf0e10cSrcweir void FuDraw::ScrollEnd() 559cdf0e10cSrcweir { 560cdf0e10cSrcweir } 561cdf0e10cSrcweir 562cdf0e10cSrcweir /************************************************************************* 563cdf0e10cSrcweir |* 564cdf0e10cSrcweir |* Aktivate function 565cdf0e10cSrcweir |* 566cdf0e10cSrcweir \************************************************************************/ 567cdf0e10cSrcweir 568cdf0e10cSrcweir void FuDraw::Activate() 569cdf0e10cSrcweir { 570cdf0e10cSrcweir FuPoor::Activate(); 571cdf0e10cSrcweir ForcePointer(); 572cdf0e10cSrcweir } 573cdf0e10cSrcweir 574cdf0e10cSrcweir /************************************************************************* 575cdf0e10cSrcweir |* 576cdf0e10cSrcweir |* Deaktivate function 577cdf0e10cSrcweir |* 578cdf0e10cSrcweir \************************************************************************/ 579cdf0e10cSrcweir 580cdf0e10cSrcweir void FuDraw::Deactivate() 581cdf0e10cSrcweir { 582cdf0e10cSrcweir FuPoor::Deactivate(); 583cdf0e10cSrcweir } 584cdf0e10cSrcweir 585cdf0e10cSrcweir 586cdf0e10cSrcweir /************************************************************************* 587cdf0e10cSrcweir |* 588cdf0e10cSrcweir |* Toggle mouse-pointer 589cdf0e10cSrcweir |* 590cdf0e10cSrcweir \************************************************************************/ 591cdf0e10cSrcweir 592cdf0e10cSrcweir void FuDraw::ForcePointer(const MouseEvent* pMEvt) 593cdf0e10cSrcweir { 594cdf0e10cSrcweir Point aPnt; 595cdf0e10cSrcweir sal_uInt16 nModifier = 0; 596cdf0e10cSrcweir sal_Bool bLeftDown = sal_False; 597cdf0e10cSrcweir sal_Bool bDefPointer = sal_True; 598cdf0e10cSrcweir 599cdf0e10cSrcweir if (pMEvt) 600cdf0e10cSrcweir { 601cdf0e10cSrcweir aPnt = mpWindow->PixelToLogic(pMEvt->GetPosPixel()); 602cdf0e10cSrcweir nModifier = pMEvt->GetModifier(); 603cdf0e10cSrcweir bLeftDown = pMEvt->IsLeft(); 604cdf0e10cSrcweir } 605cdf0e10cSrcweir else 606cdf0e10cSrcweir { 607cdf0e10cSrcweir aPnt = mpWindow->PixelToLogic(mpWindow->GetPointerPosPixel()); 608cdf0e10cSrcweir } 609cdf0e10cSrcweir 610cdf0e10cSrcweir if (mpView->IsDragObj()) 611cdf0e10cSrcweir { 612cdf0e10cSrcweir if (SD_MOD()->GetWaterCan() && !mpView->PickHandle(aPnt)) 613cdf0e10cSrcweir { 614cdf0e10cSrcweir /****************************************************************** 615cdf0e10cSrcweir * Giesskannenmodus 616cdf0e10cSrcweir ******************************************************************/ 617cdf0e10cSrcweir bDefPointer = sal_False; 618cdf0e10cSrcweir mpWindow->SetPointer(Pointer(POINTER_FILL)); 619cdf0e10cSrcweir } 620cdf0e10cSrcweir } 621cdf0e10cSrcweir else 622cdf0e10cSrcweir { 623cdf0e10cSrcweir SdrHdl* pHdl = mpView->PickHandle(aPnt); 624cdf0e10cSrcweir 625cdf0e10cSrcweir if (SD_MOD()->GetWaterCan() && !pHdl) 626cdf0e10cSrcweir { 627cdf0e10cSrcweir /****************************************************************** 628cdf0e10cSrcweir * Giesskannenmodus 629cdf0e10cSrcweir ******************************************************************/ 630cdf0e10cSrcweir bDefPointer = sal_False; 631cdf0e10cSrcweir mpWindow->SetPointer(Pointer(POINTER_FILL)); 632cdf0e10cSrcweir } 633cdf0e10cSrcweir else if (!pHdl && 634cdf0e10cSrcweir mpViewShell->GetViewFrame()->HasChildWindow(SvxBmpMaskChildWindow::GetChildWindowId())) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir /****************************************************************** 637cdf0e10cSrcweir * Pipettenmodus 638cdf0e10cSrcweir ******************************************************************/ 639cdf0e10cSrcweir SvxBmpMask* pMask = (SvxBmpMask*) mpViewShell->GetViewFrame()->GetChildWindow(SvxBmpMaskChildWindow::GetChildWindowId())->GetWindow(); 640cdf0e10cSrcweir 641cdf0e10cSrcweir if (pMask && pMask->IsEyedropping()) 642cdf0e10cSrcweir { 643cdf0e10cSrcweir bDefPointer = sal_False; 644cdf0e10cSrcweir mpWindow->SetPointer(Pointer(POINTER_REFHAND)); 645cdf0e10cSrcweir } 646cdf0e10cSrcweir } 647cdf0e10cSrcweir else if (!mpView->IsAction()) 648cdf0e10cSrcweir { 649cdf0e10cSrcweir SdrObject* pObj = NULL; 650cdf0e10cSrcweir SdrPageView* pPV = NULL; 651cdf0e10cSrcweir SdrViewEvent aVEvt; 652cdf0e10cSrcweir SdrHitKind eHit = SDRHIT_NONE; 653cdf0e10cSrcweir SdrDragMode eDragMode = mpView->GetDragMode(); 654cdf0e10cSrcweir 655cdf0e10cSrcweir if (pMEvt) 656cdf0e10cSrcweir { 657cdf0e10cSrcweir eHit = mpView->PickAnything(*pMEvt, SDRMOUSEMOVE, aVEvt); 658cdf0e10cSrcweir } 659cdf0e10cSrcweir 660cdf0e10cSrcweir if ((eDragMode == SDRDRAG_ROTATE) && (eHit == SDRHIT_MARKEDOBJECT)) 661cdf0e10cSrcweir { 662cdf0e10cSrcweir // The goal of this request is show always the rotation-arrow for 3D-objects at rotation-modus 663cdf0e10cSrcweir // Independent of the settings at Extras->Optionen->Grafik "Objekte immer verschieben" 664cdf0e10cSrcweir // 2D-objects acquit in an other way. Otherwise, the rotation of 3d-objects around any axises 665cdf0e10cSrcweir // wouldn't be possible per default. 666cdf0e10cSrcweir const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 667cdf0e10cSrcweir SdrObject* pObject = rMarkList.GetMark(0)->GetMarkedSdrObj(); 668cdf0e10cSrcweir if ((pObject->ISA(E3dObject)) && (rMarkList.GetMarkCount() == 1)) 669cdf0e10cSrcweir { 670cdf0e10cSrcweir mpWindow->SetPointer(Pointer(POINTER_ROTATE)); 671cdf0e10cSrcweir bDefPointer = sal_False; // Otherwise it'll be calles Joes routine and the mousepointer will reconfigurate again 672cdf0e10cSrcweir } 673cdf0e10cSrcweir } 674cdf0e10cSrcweir 675cdf0e10cSrcweir if (eHit == SDRHIT_NONE) 676cdf0e10cSrcweir { 677cdf0e10cSrcweir // found nothing -> look after at the masterpage 678cdf0e10cSrcweir mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER); 679cdf0e10cSrcweir } 680cdf0e10cSrcweir else if (eHit == SDRHIT_UNMARKEDOBJECT) 681cdf0e10cSrcweir { 682cdf0e10cSrcweir pObj = aVEvt.pObj; 683cdf0e10cSrcweir } 684cdf0e10cSrcweir else if (eHit == SDRHIT_TEXTEDITOBJ && this->ISA(FuSelection)) 685cdf0e10cSrcweir { 686cdf0e10cSrcweir sal_uInt16 nSdrObjKind = aVEvt.pObj->GetObjIdentifier(); 687cdf0e10cSrcweir 688cdf0e10cSrcweir if ( nSdrObjKind != OBJ_TEXT && 689cdf0e10cSrcweir nSdrObjKind != OBJ_TITLETEXT && 690cdf0e10cSrcweir nSdrObjKind != OBJ_OUTLINETEXT && 691cdf0e10cSrcweir aVEvt.pObj->IsEmptyPresObj() ) 692cdf0e10cSrcweir { 693cdf0e10cSrcweir pObj = NULL; 694cdf0e10cSrcweir bDefPointer = sal_False; 695cdf0e10cSrcweir mpWindow->SetPointer(Pointer(POINTER_ARROW)); 696cdf0e10cSrcweir } 697cdf0e10cSrcweir } 698cdf0e10cSrcweir 699cdf0e10cSrcweir if (pObj && pMEvt && !pMEvt->IsMod2() && this->ISA(FuSelection)) 700cdf0e10cSrcweir { 701cdf0e10cSrcweir // Auf Animation oder ImageMap pruefen 702cdf0e10cSrcweir bDefPointer = !SetPointer(pObj, aPnt); 703cdf0e10cSrcweir 704cdf0e10cSrcweir if (bDefPointer && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dPolyScene))) 705cdf0e10cSrcweir { 706cdf0e10cSrcweir // In die Gruppe hineinschauen 707cdf0e10cSrcweir if (mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP)) 708cdf0e10cSrcweir bDefPointer = !SetPointer(pObj, aPnt); 709cdf0e10cSrcweir } 710cdf0e10cSrcweir } 711cdf0e10cSrcweir } 712cdf0e10cSrcweir } 713cdf0e10cSrcweir 714cdf0e10cSrcweir if (bDefPointer) 715cdf0e10cSrcweir { 716cdf0e10cSrcweir mpWindow->SetPointer(mpView->GetPreferedPointer( 717cdf0e10cSrcweir aPnt, mpWindow, nModifier, bLeftDown)); 718cdf0e10cSrcweir } 719cdf0e10cSrcweir } 720cdf0e10cSrcweir 721cdf0e10cSrcweir /************************************************************************* 722cdf0e10cSrcweir |* 723cdf0e10cSrcweir |* Set cursor for animaton or imagemap 724cdf0e10cSrcweir |* 725cdf0e10cSrcweir \************************************************************************/ 726cdf0e10cSrcweir 727cdf0e10cSrcweir sal_Bool FuDraw::SetPointer(SdrObject* pObj, const Point& rPos) 728cdf0e10cSrcweir { 729cdf0e10cSrcweir sal_Bool bSet = sal_False; 730cdf0e10cSrcweir 731cdf0e10cSrcweir sal_Bool bAnimationInfo = (!mpDocSh->ISA(GraphicDocShell) && 732cdf0e10cSrcweir mpDoc->GetAnimationInfo(pObj)) ? sal_True:sal_False; 733cdf0e10cSrcweir 734cdf0e10cSrcweir sal_Bool bImageMapInfo = sal_False; 735cdf0e10cSrcweir 736cdf0e10cSrcweir if (!bAnimationInfo) 737cdf0e10cSrcweir bImageMapInfo = mpDoc->GetIMapInfo(pObj) ? sal_True:sal_False; 738cdf0e10cSrcweir 739cdf0e10cSrcweir if (bAnimationInfo || bImageMapInfo) 740cdf0e10cSrcweir { 741cdf0e10cSrcweir const SetOfByte* pVisiLayer = &mpView->GetSdrPageView()->GetVisibleLayers(); 742cdf0e10cSrcweir sal_uInt16 nHitLog(sal_uInt16 (mpWindow->PixelToLogic(Size(HITPIX,0)).Width())); 743cdf0e10cSrcweir long n2HitLog(nHitLog * 2); 744cdf0e10cSrcweir Point aHitPosR(rPos); 745cdf0e10cSrcweir Point aHitPosL(rPos); 746cdf0e10cSrcweir Point aHitPosT(rPos); 747cdf0e10cSrcweir Point aHitPosB(rPos); 748cdf0e10cSrcweir 749cdf0e10cSrcweir aHitPosR.X() += n2HitLog; 750cdf0e10cSrcweir aHitPosL.X() -= n2HitLog; 751cdf0e10cSrcweir aHitPosT.Y() += n2HitLog; 752cdf0e10cSrcweir aHitPosB.Y() -= n2HitLog; 753cdf0e10cSrcweir 754cdf0e10cSrcweir if ( !pObj->IsClosedObj() || 755cdf0e10cSrcweir ( SdrObjectPrimitiveHit(*pObj, aHitPosR, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && 756cdf0e10cSrcweir SdrObjectPrimitiveHit(*pObj, aHitPosL, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && 757cdf0e10cSrcweir SdrObjectPrimitiveHit(*pObj, aHitPosT, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && 758cdf0e10cSrcweir SdrObjectPrimitiveHit(*pObj, aHitPosB, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false))) 759cdf0e10cSrcweir { 760cdf0e10cSrcweir /********************************************************** 761cdf0e10cSrcweir * hit inside the object (without margin) or open object 762cdf0e10cSrcweir ********************************************************/ 763cdf0e10cSrcweir 764cdf0e10cSrcweir if (bAnimationInfo) 765cdf0e10cSrcweir { 766cdf0e10cSrcweir /****************************************************** 767cdf0e10cSrcweir * Click-Action 768cdf0e10cSrcweir ******************************************************/ 769cdf0e10cSrcweir SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj); 770cdf0e10cSrcweir 771cdf0e10cSrcweir if ((mpView->ISA(DrawView) && 772cdf0e10cSrcweir (pInfo->meClickAction == presentation::ClickAction_BOOKMARK || 773cdf0e10cSrcweir pInfo->meClickAction == presentation::ClickAction_DOCUMENT || 774cdf0e10cSrcweir pInfo->meClickAction == presentation::ClickAction_PREVPAGE || 775cdf0e10cSrcweir pInfo->meClickAction == presentation::ClickAction_NEXTPAGE || 776cdf0e10cSrcweir pInfo->meClickAction == presentation::ClickAction_FIRSTPAGE || 777cdf0e10cSrcweir pInfo->meClickAction == presentation::ClickAction_LASTPAGE || 778cdf0e10cSrcweir pInfo->meClickAction == presentation::ClickAction_VERB || 779cdf0e10cSrcweir pInfo->meClickAction == presentation::ClickAction_PROGRAM || 780cdf0e10cSrcweir pInfo->meClickAction == presentation::ClickAction_MACRO || 781cdf0e10cSrcweir pInfo->meClickAction == presentation::ClickAction_SOUND)) 782cdf0e10cSrcweir || 783cdf0e10cSrcweir (mpView->ISA(DrawView) && 784cdf0e10cSrcweir SlideShow::IsRunning( mpViewShell->GetViewShellBase() ) && 785cdf0e10cSrcweir (pInfo->meClickAction == presentation::ClickAction_VANISH || 786cdf0e10cSrcweir pInfo->meClickAction == presentation::ClickAction_INVISIBLE || 787cdf0e10cSrcweir pInfo->meClickAction == presentation::ClickAction_STOPPRESENTATION || 788cdf0e10cSrcweir (pInfo->mbActive && 789cdf0e10cSrcweir ( pInfo->meEffect != presentation::AnimationEffect_NONE || 790cdf0e10cSrcweir pInfo->meTextEffect != presentation::AnimationEffect_NONE ))))) 791cdf0e10cSrcweir { 792cdf0e10cSrcweir // Animations-Objekt 793cdf0e10cSrcweir bSet = sal_True; 794cdf0e10cSrcweir mpWindow->SetPointer(Pointer(POINTER_REFHAND)); 795cdf0e10cSrcweir } 796cdf0e10cSrcweir } 797cdf0e10cSrcweir else if (bImageMapInfo && 798cdf0e10cSrcweir mpDoc->GetHitIMapObject(pObj, rPos, *mpWindow)) 799cdf0e10cSrcweir { 800cdf0e10cSrcweir /****************************************************** 801cdf0e10cSrcweir * ImageMap 802cdf0e10cSrcweir ******************************************************/ 803cdf0e10cSrcweir bSet = sal_True; 804cdf0e10cSrcweir mpWindow->SetPointer(Pointer(POINTER_REFHAND)); 805cdf0e10cSrcweir } 806cdf0e10cSrcweir } 807cdf0e10cSrcweir } 808cdf0e10cSrcweir 809cdf0e10cSrcweir return bSet; 810cdf0e10cSrcweir } 811cdf0e10cSrcweir 812cdf0e10cSrcweir 813cdf0e10cSrcweir 814cdf0e10cSrcweir /************************************************************************* 815cdf0e10cSrcweir |* 816cdf0e10cSrcweir |* Response of doubleclick 817cdf0e10cSrcweir |* 818cdf0e10cSrcweir \************************************************************************/ 819cdf0e10cSrcweir 820cdf0e10cSrcweir void FuDraw::DoubleClick(const MouseEvent& rMEvt) 821cdf0e10cSrcweir { 822cdf0e10cSrcweir sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() ); 823cdf0e10cSrcweir 824cdf0e10cSrcweir if ( mpView->AreObjectsMarked() ) 825cdf0e10cSrcweir { 826cdf0e10cSrcweir const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 827cdf0e10cSrcweir 828cdf0e10cSrcweir if (rMarkList.GetMarkCount() == 1) 829cdf0e10cSrcweir { 830cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(0); 831cdf0e10cSrcweir SdrObject* pObj = pMark->GetMarkedSdrObj(); 832cdf0e10cSrcweir 833cdf0e10cSrcweir sal_uInt32 nInv = pObj->GetObjInventor(); 834cdf0e10cSrcweir sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); 835cdf0e10cSrcweir 836cdf0e10cSrcweir if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2) 837cdf0e10cSrcweir { 838cdf0e10cSrcweir DrawDocShell* pDocSh = mpDoc->GetDocSh(); 839cdf0e10cSrcweir 840cdf0e10cSrcweir if ( !pDocSh->IsUIActive() ) 841cdf0e10cSrcweir { 842cdf0e10cSrcweir /********************************************************** 843cdf0e10cSrcweir * aktivate OLE-object 844cdf0e10cSrcweir **********************************************************/ 845cdf0e10cSrcweir //HMHmpView->HideMarkHdl(); 846cdf0e10cSrcweir mpViewShell->ActivateObject( (SdrOle2Obj*) pObj, 0); 847cdf0e10cSrcweir } 848cdf0e10cSrcweir } 849cdf0e10cSrcweir else if (nInv == SdrInventor && nSdrObjKind == OBJ_GRAF && pObj->IsEmptyPresObj() ) 850cdf0e10cSrcweir { 851cdf0e10cSrcweir mpViewShell->GetViewFrame()-> 852cdf0e10cSrcweir GetDispatcher()->Execute( SID_INSERT_GRAPHIC, 853cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD ); 854cdf0e10cSrcweir } 855cdf0e10cSrcweir else if ( ( pObj->ISA(SdrTextObj) || pObj->ISA(SdrObjGroup) ) && 856cdf0e10cSrcweir !SD_MOD()->GetWaterCan() && 857cdf0e10cSrcweir mpViewShell->GetFrameView()->IsDoubleClickTextEdit() && 858cdf0e10cSrcweir !mpDocSh->IsReadOnly()) 859cdf0e10cSrcweir { 860cdf0e10cSrcweir SfxUInt16Item aItem(SID_TEXTEDIT, 2); 861cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()-> 862cdf0e10cSrcweir Execute(SID_TEXTEDIT, SFX_CALLMODE_ASYNCHRON | 863cdf0e10cSrcweir SFX_CALLMODE_RECORD, &aItem, 0L); 864cdf0e10cSrcweir } 865cdf0e10cSrcweir else if (nInv == SdrInventor && nSdrObjKind == OBJ_GRUP) 866cdf0e10cSrcweir { 867cdf0e10cSrcweir // hit group -> select subobject 868cdf0e10cSrcweir mpView->UnMarkAll(); 869cdf0e10cSrcweir mpView->MarkObj(aMDPos, nHitLog, rMEvt.IsShift(), sal_True); 870cdf0e10cSrcweir } 871cdf0e10cSrcweir } 872cdf0e10cSrcweir } 873cdf0e10cSrcweir else 874cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD); 875cdf0e10cSrcweir } 876cdf0e10cSrcweir 877cdf0e10cSrcweir /************************************************************************* 878cdf0e10cSrcweir |* 879cdf0e10cSrcweir |* Help-event 880cdf0e10cSrcweir |* 881cdf0e10cSrcweir \************************************************************************/ 882cdf0e10cSrcweir 883cdf0e10cSrcweir sal_Bool FuDraw::RequestHelp(const HelpEvent& rHEvt) 884cdf0e10cSrcweir { 885cdf0e10cSrcweir sal_Bool bReturn = sal_False; 886cdf0e10cSrcweir 887cdf0e10cSrcweir if (Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled()) 888cdf0e10cSrcweir { 889cdf0e10cSrcweir SdrViewEvent aVEvt; 890cdf0e10cSrcweir 891cdf0e10cSrcweir MouseEvent aMEvt(mpWindow->GetPointerPosPixel(), 1, 0, MOUSE_LEFT); 892cdf0e10cSrcweir 893cdf0e10cSrcweir SdrHitKind eHit = mpView->PickAnything(aMEvt, SDRMOUSEBUTTONDOWN, aVEvt); 894cdf0e10cSrcweir 895cdf0e10cSrcweir SdrObject* pObj = aVEvt.pObj; 896cdf0e10cSrcweir 897cdf0e10cSrcweir if (eHit != SDRHIT_NONE && pObj != NULL) 898cdf0e10cSrcweir { 899cdf0e10cSrcweir Point aPosPixel = rHEvt.GetMousePosPixel(); 900cdf0e10cSrcweir 901cdf0e10cSrcweir bReturn = SetHelpText(pObj, aPosPixel, aVEvt); 902cdf0e10cSrcweir 903cdf0e10cSrcweir if (!bReturn && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dPolyScene))) 904cdf0e10cSrcweir { 905cdf0e10cSrcweir // In die Gruppe hineinschauen 906cdf0e10cSrcweir SdrPageView* pPV = NULL; 907cdf0e10cSrcweir 908cdf0e10cSrcweir Point aPos(mpWindow->PixelToLogic(mpWindow->ScreenToOutputPixel(aPosPixel))); 909cdf0e10cSrcweir 910cdf0e10cSrcweir if (mpView->PickObj(aPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP)) 911cdf0e10cSrcweir bReturn = SetHelpText(pObj, aPosPixel, aVEvt); 912cdf0e10cSrcweir } 913cdf0e10cSrcweir } 914cdf0e10cSrcweir } 915cdf0e10cSrcweir 916cdf0e10cSrcweir if (!bReturn) 917cdf0e10cSrcweir { 918cdf0e10cSrcweir bReturn = FuPoor::RequestHelp(rHEvt); 919cdf0e10cSrcweir } 920cdf0e10cSrcweir 921cdf0e10cSrcweir return(bReturn); 922cdf0e10cSrcweir } 923cdf0e10cSrcweir 924cdf0e10cSrcweir 925cdf0e10cSrcweir 926cdf0e10cSrcweir /************************************************************************* 927cdf0e10cSrcweir |* 928cdf0e10cSrcweir |* Command-event 929cdf0e10cSrcweir |* 930cdf0e10cSrcweir \************************************************************************/ 931cdf0e10cSrcweir 932cdf0e10cSrcweir sal_Bool FuDraw::SetHelpText(SdrObject* pObj, const Point& rPosPixel, const SdrViewEvent& rVEvt) 933cdf0e10cSrcweir { 934cdf0e10cSrcweir sal_Bool bSet = sal_False; 935cdf0e10cSrcweir String aHelpText; 936cdf0e10cSrcweir Point aPos(mpWindow->PixelToLogic(mpWindow->ScreenToOutputPixel(rPosPixel))); 937cdf0e10cSrcweir 938cdf0e10cSrcweir // URL fuer IMapObject unter Pointer ist Hilfetext 939cdf0e10cSrcweir if ( mpDoc->GetIMapInfo(pObj) ) 940cdf0e10cSrcweir { 941cdf0e10cSrcweir IMapObject* pIMapObj = mpDoc->GetHitIMapObject(pObj, aPos, *mpWindow ); 942cdf0e10cSrcweir 943cdf0e10cSrcweir if ( pIMapObj ) 944cdf0e10cSrcweir { 945cdf0e10cSrcweir // show name 946cdf0e10cSrcweir aHelpText = pIMapObj->GetAltText(); 947cdf0e10cSrcweir 948cdf0e10cSrcweir if (aHelpText.Len() == 0) 949cdf0e10cSrcweir { 950cdf0e10cSrcweir // show url if no name is available 951cdf0e10cSrcweir aHelpText = INetURLObject::decode( pIMapObj->GetURL(), '%', INetURLObject::DECODE_WITH_CHARSET ); 952cdf0e10cSrcweir } 953cdf0e10cSrcweir } 954cdf0e10cSrcweir } 955cdf0e10cSrcweir else if (!mpDocSh->ISA(GraphicDocShell) && mpDoc->GetAnimationInfo(pObj)) 956cdf0e10cSrcweir { 957cdf0e10cSrcweir SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj); 958cdf0e10cSrcweir 959cdf0e10cSrcweir switch (pInfo->meClickAction) 960cdf0e10cSrcweir { 961cdf0e10cSrcweir case presentation::ClickAction_PREVPAGE: 962cdf0e10cSrcweir { 963cdf0e10cSrcweir // jump to the prior page 964cdf0e10cSrcweir aHelpText = String(SdResId(STR_CLICK_ACTION_PREVPAGE)); 965cdf0e10cSrcweir } 966cdf0e10cSrcweir break; 967cdf0e10cSrcweir 968cdf0e10cSrcweir case presentation::ClickAction_NEXTPAGE: 969cdf0e10cSrcweir { 970cdf0e10cSrcweir // jump to the next page 971cdf0e10cSrcweir aHelpText = String(SdResId(STR_CLICK_ACTION_NEXTPAGE)); 972cdf0e10cSrcweir } 973cdf0e10cSrcweir break; 974cdf0e10cSrcweir 975cdf0e10cSrcweir case presentation::ClickAction_FIRSTPAGE: 976cdf0e10cSrcweir { 977cdf0e10cSrcweir // jump to the first page 978cdf0e10cSrcweir aHelpText = String(SdResId(STR_CLICK_ACTION_FIRSTPAGE)); 979cdf0e10cSrcweir } 980cdf0e10cSrcweir break; 981cdf0e10cSrcweir 982cdf0e10cSrcweir case presentation::ClickAction_LASTPAGE: 983cdf0e10cSrcweir { 984cdf0e10cSrcweir // jump to the last page 985cdf0e10cSrcweir aHelpText = String(SdResId(STR_CLICK_ACTION_LASTPAGE)); 986cdf0e10cSrcweir } 987cdf0e10cSrcweir break; 988cdf0e10cSrcweir 989cdf0e10cSrcweir case presentation::ClickAction_BOOKMARK: 990cdf0e10cSrcweir { 991cdf0e10cSrcweir // jump to object/page 992cdf0e10cSrcweir aHelpText = String(SdResId(STR_CLICK_ACTION_BOOKMARK)); 993cdf0e10cSrcweir aHelpText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); 994cdf0e10cSrcweir aHelpText.Append( String(INetURLObject::decode( pInfo->GetBookmark(), '%', INetURLObject::DECODE_WITH_CHARSET ) )); 995cdf0e10cSrcweir } 996cdf0e10cSrcweir break; 997cdf0e10cSrcweir 998cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT: 999cdf0e10cSrcweir { 1000cdf0e10cSrcweir // jump to document (object/page) 1001cdf0e10cSrcweir aHelpText = String(SdResId(STR_CLICK_ACTION_DOCUMENT)); 1002cdf0e10cSrcweir aHelpText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); 1003cdf0e10cSrcweir aHelpText.Append( String(INetURLObject::decode( pInfo->GetBookmark(), '%', INetURLObject::DECODE_WITH_CHARSET ) )); 1004cdf0e10cSrcweir } 1005cdf0e10cSrcweir break; 1006cdf0e10cSrcweir 1007cdf0e10cSrcweir case presentation::ClickAction_PROGRAM: 1008cdf0e10cSrcweir { 1009cdf0e10cSrcweir // execute program 1010cdf0e10cSrcweir aHelpText = String(SdResId(STR_CLICK_ACTION_PROGRAM)); 1011cdf0e10cSrcweir aHelpText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); 1012cdf0e10cSrcweir aHelpText.Append( String(INetURLObject::decode( pInfo->GetBookmark(), '%', INetURLObject::DECODE_WITH_CHARSET ) )); 1013cdf0e10cSrcweir } 1014cdf0e10cSrcweir break; 1015cdf0e10cSrcweir 1016cdf0e10cSrcweir case presentation::ClickAction_MACRO: 1017cdf0e10cSrcweir { 1018cdf0e10cSrcweir // execute program 1019cdf0e10cSrcweir aHelpText = String(SdResId(STR_CLICK_ACTION_MACRO)); 1020cdf0e10cSrcweir aHelpText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); 1021cdf0e10cSrcweir 1022cdf0e10cSrcweir if ( SfxApplication::IsXScriptURL( pInfo->GetBookmark() ) ) 1023cdf0e10cSrcweir { 1024cdf0e10cSrcweir aHelpText.Append( pInfo->GetBookmark() ); 1025cdf0e10cSrcweir } 1026cdf0e10cSrcweir else 1027cdf0e10cSrcweir { 1028cdf0e10cSrcweir String sBookmark( pInfo->GetBookmark() ); 1029cdf0e10cSrcweir sal_Unicode cToken = '.'; 1030cdf0e10cSrcweir aHelpText.Append( sBookmark.GetToken( 2, cToken ) ); 1031cdf0e10cSrcweir aHelpText.Append( cToken ); 1032cdf0e10cSrcweir aHelpText.Append( sBookmark.GetToken( 1, cToken ) ); 1033cdf0e10cSrcweir aHelpText.Append( cToken ); 1034cdf0e10cSrcweir aHelpText.Append( sBookmark.GetToken( 0, cToken ) ); 1035cdf0e10cSrcweir } 1036cdf0e10cSrcweir } 1037cdf0e10cSrcweir break; 1038cdf0e10cSrcweir 1039cdf0e10cSrcweir case presentation::ClickAction_SOUND: 1040cdf0e10cSrcweir { 1041cdf0e10cSrcweir // play-back sound 1042cdf0e10cSrcweir aHelpText = String(SdResId(STR_CLICK_ACTION_SOUND)); 1043cdf0e10cSrcweir } 1044cdf0e10cSrcweir break; 1045cdf0e10cSrcweir 1046cdf0e10cSrcweir case presentation::ClickAction_VERB: 1047cdf0e10cSrcweir { 1048cdf0e10cSrcweir // execute OLE-verb 1049cdf0e10cSrcweir aHelpText = String(SdResId(STR_CLICK_ACTION_VERB)); 1050cdf0e10cSrcweir } 1051cdf0e10cSrcweir break; 1052cdf0e10cSrcweir 1053cdf0e10cSrcweir case presentation::ClickAction_STOPPRESENTATION: 1054cdf0e10cSrcweir { 1055cdf0e10cSrcweir // quit presentation 1056cdf0e10cSrcweir aHelpText = String(SdResId(STR_CLICK_ACTION_STOPPRESENTATION)); 1057cdf0e10cSrcweir } 1058cdf0e10cSrcweir break; 1059cdf0e10cSrcweir default: 1060cdf0e10cSrcweir break; 1061cdf0e10cSrcweir } 1062cdf0e10cSrcweir } 1063cdf0e10cSrcweir else if (rVEvt.pURLField) 1064cdf0e10cSrcweir { 1065cdf0e10cSrcweir /************************************************************** 1066cdf0e10cSrcweir * URL-Field 1067cdf0e10cSrcweir **************************************************************/ 1068cdf0e10cSrcweir aHelpText = INetURLObject::decode( rVEvt.pURLField->GetURL(), '%', INetURLObject::DECODE_WITH_CHARSET ); 1069cdf0e10cSrcweir } 1070cdf0e10cSrcweir 1071cdf0e10cSrcweir if (aHelpText.Len()) 1072cdf0e10cSrcweir { 1073cdf0e10cSrcweir bSet = sal_True; 1074cdf0e10cSrcweir Rectangle aLogicPix = mpWindow->LogicToPixel(pObj->GetLogicRect()); 1075cdf0e10cSrcweir Rectangle aScreenRect(mpWindow->OutputToScreenPixel(aLogicPix.TopLeft()), 1076cdf0e10cSrcweir mpWindow->OutputToScreenPixel(aLogicPix.BottomRight())); 1077cdf0e10cSrcweir 1078cdf0e10cSrcweir if (Help::IsBalloonHelpEnabled()) 1079cdf0e10cSrcweir Help::ShowBalloon( (Window*)mpWindow, rPosPixel, aScreenRect, aHelpText); 1080cdf0e10cSrcweir else if (Help::IsQuickHelpEnabled()) 1081cdf0e10cSrcweir Help::ShowQuickHelp( (Window*)mpWindow, aScreenRect, aHelpText); 1082cdf0e10cSrcweir } 1083cdf0e10cSrcweir 1084cdf0e10cSrcweir return bSet; 1085cdf0e10cSrcweir } 1086cdf0e10cSrcweir 1087cdf0e10cSrcweir 1088cdf0e10cSrcweir /** is called when the currenct function should be aborted. <p> 1089cdf0e10cSrcweir This is used when a function gets a KEY_ESCAPE but can also 1090cdf0e10cSrcweir be called directly. 1091cdf0e10cSrcweir 1092cdf0e10cSrcweir @returns true if a active function was aborted 1093cdf0e10cSrcweir */ 1094cdf0e10cSrcweir bool FuDraw::cancel() 1095cdf0e10cSrcweir { 1096cdf0e10cSrcweir bool bReturn = false; 1097cdf0e10cSrcweir 1098cdf0e10cSrcweir if ( mpView->IsAction() ) 1099cdf0e10cSrcweir { 1100cdf0e10cSrcweir mpView->BrkAction(); 1101cdf0e10cSrcweir bReturn = true; 1102cdf0e10cSrcweir } 1103cdf0e10cSrcweir else if ( mpView->IsTextEdit() ) 1104cdf0e10cSrcweir { 1105cdf0e10cSrcweir mpView->SdrEndTextEdit(); 1106cdf0e10cSrcweir bReturn = true; 1107cdf0e10cSrcweir 1108cdf0e10cSrcweir SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings(); 1109cdf0e10cSrcweir rBindings.Invalidate( SID_PARASPACE_INCREASE ); 1110cdf0e10cSrcweir rBindings.Invalidate( SID_PARASPACE_DECREASE ); 1111cdf0e10cSrcweir } 1112cdf0e10cSrcweir else if ( mpView->AreObjectsMarked() ) 1113cdf0e10cSrcweir { 1114cdf0e10cSrcweir // #97016# II 1115cdf0e10cSrcweir const SdrHdlList& rHdlList = mpView->GetHdlList(); 1116cdf0e10cSrcweir SdrHdl* pHdl = rHdlList.GetFocusHdl(); 1117cdf0e10cSrcweir 1118cdf0e10cSrcweir if(pHdl) 1119cdf0e10cSrcweir { 1120cdf0e10cSrcweir ((SdrHdlList&)rHdlList).ResetFocusHdl(); 1121cdf0e10cSrcweir } 1122cdf0e10cSrcweir else 1123cdf0e10cSrcweir { 1124cdf0e10cSrcweir mpView->UnmarkAll(); 1125cdf0e10cSrcweir } 1126cdf0e10cSrcweir 1127cdf0e10cSrcweir // Switch to FuSelect. 1128cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()->Execute( 1129cdf0e10cSrcweir SID_OBJECT_SELECT, 1130cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD); 1131cdf0e10cSrcweir 1132cdf0e10cSrcweir bReturn = true; 1133cdf0e10cSrcweir } 1134cdf0e10cSrcweir 1135cdf0e10cSrcweir return bReturn; 1136cdf0e10cSrcweir } 1137cdf0e10cSrcweir 1138cdf0e10cSrcweir } // end of namespace sd 1139