1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_svx.hxx" 26 #include <editeng/eeitem.hxx> 27 28 #include "svx/svdstr.hrc" // Namen aus der Resource 29 #include "svx/svdglob.hxx" // StringCache 30 #include <svx/svdpagv.hxx> 31 #include <svx/svdmrkv.hxx> 32 #include <svx/svdedxv.hxx> 33 #include <svx/svdobj.hxx> 34 #include <svx/svdopath.hxx> // fuer GetContext 35 #include <svx/svdograf.hxx> // fuer GetContext 36 #include <svx/svdomedia.hxx> // fuer GetContext 37 #include <svx/svdetc.hxx> // Fuer SdrEngineDefaults 38 39 #ifdef DBG_UTIL 40 #include <svdibrow.hxx> 41 #endif 42 43 #include "svx/svdoutl.hxx" 44 #include "svx/svdview.hxx" 45 #include "editeng/editview.hxx" // fuer GetField 46 #include "editeng/flditem.hxx" // fuer URLField 47 #include "svx/obj3d.hxx" 48 #include "svx/svddrgmt.hxx" 49 #include "svx/svdoutl.hxx" 50 #include "svx/svdotable.hxx" 51 #include <tools/tenccvt.hxx> 52 #include <svx/sdr/overlay/overlaypolypolygon.hxx> 53 #include <svx/sdr/overlay/overlaymanager.hxx> 54 #include <svx/sdrpaintwindow.hxx> 55 #include <svx/sdrpagewindow.hxx> 56 #include <svx/sdrhittesthelper.hxx> 57 58 //////////////////////////////////////////////////////////////////////////////////////////////////// 59 60 SdrViewEvent::SdrViewEvent() 61 : pHdl(NULL), 62 pObj(NULL), 63 pRootObj(NULL), 64 pPV(NULL), 65 pURLField(NULL), 66 eHit(SDRHIT_NONE), 67 eEvent(SDREVENT_NONE), 68 eHdlKind(HDL_MOVE), 69 eEndCreateCmd(SDRCREATE_NEXTPOINT), 70 nMouseClicks(0), 71 nMouseMode(0), 72 nMouseCode(0), 73 nHlplIdx(0), 74 nGlueId(0), 75 bMouseDown(sal_False), 76 bMouseUp(sal_False), 77 bDoubleHdlSize(sal_False), 78 bIsAction(sal_False), 79 bIsTextEdit(sal_False), 80 bTextEditHit(sal_False), 81 bAddMark(sal_False), 82 bUnmark(sal_False), 83 bPrevNextMark(sal_False), 84 bMarkPrev(sal_False), 85 bInsPointNewObj(sal_False), 86 bDragWithCopy(sal_False), 87 bCaptureMouse(sal_False), 88 bReleaseMouse(sal_False) 89 { 90 } 91 92 SdrViewEvent::~SdrViewEvent() 93 { 94 } 95 96 //////////////////////////////////////////////////////////////////////////////////////////////////// 97 // helper class for all D&D overlays 98 99 void SdrDropMarkerOverlay::ImplCreateOverlays(const SdrView& rView, const basegfx::B2DPolyPolygon& rPolyPolygon) 100 { 101 for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++) 102 { 103 SdrPaintWindow* pCandidate = rView.GetPaintWindow(a); 104 ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager(); 105 106 if(pTargetOverlay) 107 { 108 ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped( 109 rPolyPolygon); 110 pTargetOverlay->add(*pNew); 111 maObjects.append(*pNew); 112 } 113 } 114 } 115 116 SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject) 117 { 118 ImplCreateOverlays(rView, rObject.TakeXorPoly()); 119 } 120 121 SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const Rectangle& rRectangle) 122 { 123 basegfx::B2DPolygon aB2DPolygon; 124 aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Top())); 125 aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Top())); 126 aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Bottom())); 127 aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Bottom())); 128 aB2DPolygon.setClosed(true); 129 130 basegfx::B2DPolyPolygon aB2DPolyPolygon; 131 aB2DPolyPolygon.append(aB2DPolygon); 132 133 ImplCreateOverlays(rView, aB2DPolyPolygon); 134 } 135 136 SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd) 137 { 138 basegfx::B2DPolygon aB2DPolygon; 139 aB2DPolygon.append(basegfx::B2DPoint(rStart.X(), rStart.Y())); 140 aB2DPolygon.append(basegfx::B2DPoint(rEnd.X(), rEnd.Y())); 141 aB2DPolygon.setClosed(true); 142 143 basegfx::B2DPolyPolygon aB2DPolyPolygon; 144 aB2DPolyPolygon.append(aB2DPolygon); 145 146 ImplCreateOverlays(rView, aB2DPolyPolygon); 147 } 148 149 SdrDropMarkerOverlay::~SdrDropMarkerOverlay() 150 { 151 // The OverlayObjects are cleared using the destructor of OverlayObjectList. 152 // That destructor calls clear() at the list which removes all objects from the 153 // OverlayManager and deletes them. 154 } 155 156 //////////////////////////////////////////////////////////////////////////////////////////////////// 157 //////////////////////////////////////////////////////////////////////////////////////////////////// 158 // 159 // @@ @@ @@ @@@@@ @@ @@ 160 // @@ @@ @@ @@ @@ @@ 161 // @@ @@ @@ @@ @@ @ @@ 162 // @@@@@ @@ @@@@ @@@@@@@ 163 // @@@ @@ @@ @@@@@@@ 164 // @@@ @@ @@ @@@ @@@ 165 // @ @@ @@@@@ @@ @@ 166 // 167 //////////////////////////////////////////////////////////////////////////////////////////////////// 168 //////////////////////////////////////////////////////////////////////////////////////////////////// 169 170 TYPEINIT1(SdrView,SdrCreateView); 171 172 SdrView::SdrView(SdrModel* pModel1, OutputDevice* pOut) 173 : SdrCreateView(pModel1,pOut), 174 bNoExtendedMouseDispatcher(sal_False), 175 bNoExtendedKeyDispatcher(sal_False), 176 bNoExtendedCommandDispatcher(sal_False), 177 mbMasterPagePaintCaching(sal_False) 178 { 179 bTextEditOnObjectsWithoutTextIfTextTool=sal_False; 180 181 maAccessibilityOptions.AddListener(this); 182 183 onAccessibilityOptionsChanged(); 184 } 185 186 SdrView::~SdrView() 187 { 188 maAccessibilityOptions.RemoveListener(this); 189 } 190 191 sal_Bool SdrView::KeyInput(const KeyEvent& rKEvt, Window* pWin) 192 { 193 SetActualWin(pWin); 194 sal_Bool bRet=SdrCreateView::KeyInput(rKEvt,pWin); 195 if (!bRet && !IsExtendedKeyInputDispatcherEnabled()) { 196 bRet=sal_True; 197 switch (rKEvt.GetKeyCode().GetFullFunction()) { 198 case KEYFUNC_CUT : Cut(); break; 199 case KEYFUNC_COPY : Yank(); break; 200 case KEYFUNC_PASTE : Paste(pWin); break; 201 case KEYFUNC_DELETE: DeleteMarked(); break; 202 case KEYFUNC_UNDO: pMod->Undo(); break; 203 case KEYFUNC_REDO: pMod->Redo(); break; 204 case KEYFUNC_REPEAT: pMod->Repeat(*this); break; 205 default: { 206 switch (rKEvt.GetKeyCode().GetFullCode()) { 207 case KEY_ESCAPE: { 208 if (IsTextEdit()) SdrEndTextEdit(); 209 if (IsAction()) BrkAction(); 210 if (pWin!=NULL) pWin->ReleaseMouse(); 211 } break; 212 case KEY_DELETE: DeleteMarked(); break; 213 case KEY_CUT: case KEY_DELETE+KEY_SHIFT: Cut(); break; 214 case KEY_COPY: case KEY_INSERT+KEY_MOD1: Yank(); break; 215 case KEY_PASTE: case KEY_INSERT+KEY_SHIFT: Paste(pWin); break; 216 case KEY_UNDO: case KEY_BACKSPACE+KEY_MOD2: pMod->Undo(); break; 217 case KEY_BACKSPACE+KEY_MOD2+KEY_SHIFT: pMod->Redo(); break; 218 case KEY_REPEAT: case KEY_BACKSPACE+KEY_MOD2+KEY_MOD1: pMod->Repeat(*this); break; 219 case KEY_MOD1+KEY_A: MarkAll(); break; 220 default: bRet=sal_False; 221 } // switch 222 } 223 } // switch 224 if (bRet && pWin!=NULL) { 225 pWin->SetPointer(GetPreferedPointer( 226 pWin->PixelToLogic(pWin->ScreenToOutputPixel( pWin->GetPointerPosPixel() ) ), 227 pWin, 228 rKEvt.GetKeyCode().GetModifier())); 229 } 230 } 231 return bRet; 232 } 233 234 sal_Bool SdrView::MouseButtonDown(const MouseEvent& rMEvt, Window* pWin) 235 { 236 SetActualWin(pWin); 237 if (rMEvt.IsLeft()) aDragStat.SetMouseDown(sal_True); 238 sal_Bool bRet=SdrCreateView::MouseButtonDown(rMEvt,pWin); 239 if (!bRet && !IsExtendedMouseEventDispatcherEnabled()) { 240 SdrViewEvent aVEvt; 241 PickAnything(rMEvt,SDRMOUSEBUTTONDOWN,aVEvt); 242 bRet=DoMouseEvent(aVEvt); 243 } 244 return bRet; 245 } 246 247 sal_Bool SdrView::MouseButtonUp(const MouseEvent& rMEvt, Window* pWin) 248 { 249 SetActualWin(pWin); 250 if (rMEvt.IsLeft()) aDragStat.SetMouseDown(sal_False); 251 sal_Bool bAction=IsAction(); 252 sal_Bool bRet=!bAction && SdrCreateView::MouseButtonUp(rMEvt,pWin); 253 if (!bRet && !IsExtendedMouseEventDispatcherEnabled()) { 254 SdrViewEvent aVEvt; 255 PickAnything(rMEvt,SDRMOUSEBUTTONUP,aVEvt); 256 bRet=DoMouseEvent(aVEvt); 257 } 258 return bRet; 259 } 260 261 sal_Bool SdrView::MouseMove(const MouseEvent& rMEvt, Window* pWin) 262 { 263 SetActualWin(pWin); 264 aDragStat.SetMouseDown(rMEvt.IsLeft()); 265 sal_Bool bRet=SdrCreateView::MouseMove(rMEvt,pWin); 266 if (!IsExtendedMouseEventDispatcherEnabled() && !IsTextEditInSelectionMode()) { 267 SdrViewEvent aVEvt; 268 PickAnything(rMEvt,SDRMOUSEMOVE,aVEvt); 269 if (DoMouseEvent(aVEvt)) bRet=sal_True; 270 } 271 272 // #87792# Removed code which did let the mouse snap on object 273 // points 274 275 return bRet; 276 } 277 278 sal_Bool SdrView::Command(const CommandEvent& rCEvt, Window* pWin) 279 { 280 SetActualWin(pWin); 281 sal_Bool bRet=SdrCreateView::Command(rCEvt,pWin); 282 return bRet; 283 } 284 285 /* new interface src537 */ 286 sal_Bool SdrView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const 287 { 288 return SdrCreateView::GetAttributes(rTargetSet, bOnlyHardAttr); 289 } 290 291 SfxStyleSheet* SdrView::GetStyleSheet() const 292 { 293 //sal_Bool bOk=sal_False; 294 return SdrCreateView::GetStyleSheet(); //bOk); 295 } 296 297 SdrHitKind SdrView::PickAnything(const MouseEvent& rMEvt, sal_uInt16 nEventKind, SdrViewEvent& rVEvt) const 298 { 299 rVEvt.bMouseDown=nEventKind==SDRMOUSEBUTTONDOWN; 300 rVEvt.bMouseUp=nEventKind==SDRMOUSEBUTTONUP; 301 rVEvt.nMouseClicks=rMEvt.GetClicks(); 302 rVEvt.nMouseMode=rMEvt.GetMode(); 303 rVEvt.nMouseCode=rMEvt.GetButtons() | rMEvt.GetModifier(); 304 const OutputDevice* pOut=pActualOutDev; 305 if (pOut==NULL) 306 { 307 pOut = GetFirstOutputDevice(); 308 //pOut=GetWin(0); 309 } 310 Point aPnt(rMEvt.GetPosPixel()); 311 if (pOut!=NULL) aPnt=pOut->PixelToLogic(aPnt); 312 rVEvt.aLogicPos=aPnt; 313 return PickAnything(aPnt,rVEvt); 314 } 315 316 // Mit der Maus draggen (Move) 317 // Beispiel beim erzeugen eines Rechtecks. MouseDown muss ohne 318 // ModKey erfolgen, weil sonst i.d.R. Markieren forciert wird (s.u.) 319 // Drueckt man dann beim MouseMove gleichzeitig Shift, Ctrl, und Alt, 320 // so erzeugt man ein zentrisches Quadrat ohne Fang. 321 // Die Doppelbelegung von Ortho und Shift stellt i.d.R. kein Problem dar, 322 // da sich beides meisst gegenseitig ausschliesst. Einzig Shear (das beim 323 // Verzerren, nicht dass beim Drehen) beruecksichtigt beides gleichzeitig. 324 // Dass muss der Anwender erstmal noch umschiffen (z.B. mit einer Hilfslinie). 325 #define MODKEY_NoSnap bCtrl /* Fang temporaer aus */ 326 #define MODKEY_Ortho bShift /* na eben ortho */ 327 #define MODKEY_Center bAlt /* Zentrisch erzeugen/resizen */ 328 #define MODKEY_AngleSnap bShift 329 #define MODKEY_CopyDrag bCtrl /* Draggen mit kopieren */ 330 331 // irgendwo hinklicken (MouseDown) 332 #define MODKEY_PolyPoly bAlt /* Neues Poly bei InsPt und bei Create */ 333 #define MODKEY_MultiMark bShift /* MarkObj ohne vorher UnmarkAll */ 334 #define MODKEY_Unmark bAlt /* Unmark durch Rahmenaufziehen */ 335 #define MODKEY_ForceMark bCtrl /* Rahmenaufziehen erzwingen, auch wenn Obj an MausPos */ 336 #define MODKEY_DeepMark bAlt /* MarkNextObj */ 337 #define MODKEY_DeepBackw bShift /* MarkNextObj rueckwaerts */ 338 339 SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) const 340 { 341 const OutputDevice* pOut=pActualOutDev; 342 if (pOut==NULL) 343 { 344 pOut = GetFirstOutputDevice(); 345 //pOut=GetWin(0); 346 } 347 348 // #i73628# Use a non-changeable copy of he logic pos 349 const Point aLocalLogicPosition(rLogicPos); 350 351 sal_Bool bEditMode=IsEditMode(); 352 sal_Bool bPointMode=bEditMode && HasMarkablePoints(); 353 sal_Bool bGluePointMode=IsGluePointEditMode(); 354 sal_Bool bInsPolyPt=bPointMode && IsInsObjPointMode() && IsInsObjPointPossible(); 355 sal_Bool bInsGluePt=bGluePointMode && IsInsGluePointMode() && IsInsGluePointPossible(); 356 sal_Bool bIsTextEdit=IsTextEdit(); 357 sal_Bool bTextEditHit=IsTextEditHit(aLocalLogicPosition,0/*nHitTolLog*/); 358 sal_Bool bTextEditSel=IsTextEditInSelectionMode(); 359 sal_Bool bShift=(rVEvt.nMouseCode & KEY_SHIFT) !=0; 360 sal_Bool bCtrl=(rVEvt.nMouseCode & KEY_MOD1) !=0; 361 sal_Bool bAlt=(rVEvt.nMouseCode & KEY_MOD2) !=0; 362 SdrHitKind eHit=SDRHIT_NONE; 363 SdrHdl* pHdl=pOut!=NULL && !bTextEditSel ? PickHandle(aLocalLogicPosition) : NULL; 364 SdrPageView* pPV=NULL; 365 SdrObject* pObj=NULL; 366 SdrObject* pHitObj=NULL; 367 sal_uInt16 nHitPassNum=0; 368 sal_uInt16 nHlplIdx=0; 369 sal_uInt16 nGlueId=0; 370 sal_Bool bUnmarkedObjHit=sal_False; 371 if (bTextEditHit || bTextEditSel) 372 { 373 eHit=SDRHIT_TEXTEDIT; 374 bTextEditHit=sal_True; 375 } 376 else if (pHdl!=NULL) 377 { 378 eHit=SDRHIT_HANDLE; // Handle getroffen hat hoechste Prioritaet 379 } 380 else if (bEditMode && IsHlplVisible() && IsHlplFront() && pOut!=NULL && PickHelpLine(aLocalLogicPosition,nHitTolLog,*pOut,nHlplIdx,pPV)) 381 { 382 eHit=SDRHIT_HELPLINE; // Hilfslinie im Vordergrund getroffen zum verschieben 383 } 384 else if (bGluePointMode && PickGluePoint(aLocalLogicPosition,pObj,nGlueId,pPV)) 385 { 386 eHit=SDRHIT_GLUEPOINT; // nichtmarkierter Klebepunkt getroffen 387 } 388 else if (PickObj(aLocalLogicPosition,nHitTolLog,pHitObj,pPV,SDRSEARCH_DEEP|SDRSEARCH_MARKED,&pObj,NULL,&nHitPassNum)) 389 { 390 eHit=SDRHIT_MARKEDOBJECT; 391 ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( pObj ); 392 if( pTableObj ) 393 { 394 sal_Int32 nX = 0, nY = 0; 395 switch( pTableObj->CheckTableHit( aLocalLogicPosition, nX, nY, 0 ) ) 396 { 397 case sdr::table::SDRTABLEHIT_CELL: 398 eHit = SDRHIT_CELL; 399 break; 400 case sdr::table::SDRTABLEHIT_CELLTEXTAREA: 401 eHit = SDRHIT_TEXTEDITOBJ; 402 break; 403 default: 404 break; 405 } 406 } 407 } 408 else if (PickObj(aLocalLogicPosition,nHitTolLog,pHitObj,pPV,SDRSEARCH_DEEP|/*SDRSEARCH_TESTMARKABLE|*/SDRSEARCH_ALSOONMASTER|SDRSEARCH_WHOLEPAGE,&pObj,NULL,&nHitPassNum)) 409 { 410 // MasterPages und WholePage fuer Macro und URL 411 eHit=SDRHIT_UNMARKEDOBJECT; 412 ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( pObj ); 413 if( pTableObj ) 414 { 415 sal_Int32 nX = 0, nY = 0; 416 switch( pTableObj->CheckTableHit( aLocalLogicPosition, nX, nY, 0 ) ) 417 { 418 case sdr::table::SDRTABLEHIT_CELL: 419 eHit = SDRHIT_CELL; 420 break; 421 case sdr::table::SDRTABLEHIT_CELLTEXTAREA: 422 eHit = SDRHIT_TEXTEDITOBJ; 423 break; 424 default: 425 break; 426 } 427 } 428 bUnmarkedObjHit=sal_True; 429 } 430 else if (bEditMode && IsHlplVisible() && !IsHlplFront() && pOut!=NULL && PickHelpLine(aLocalLogicPosition,nHitTolLog,*pOut,nHlplIdx,pPV)) 431 { 432 eHit=SDRHIT_HELPLINE; // Hilfslinie im Vordergrund getroffen zum verschieben 433 } 434 if (IsMacroMode() && eHit==SDRHIT_UNMARKEDOBJECT) 435 { 436 bool bRoot=pObj->HasMacro(); 437 sal_Bool bDeep=pObj!=pHitObj && pHitObj->HasMacro(); 438 sal_Bool bMid=sal_False; // Gruppierte Gruppe mit Macro getroffen? 439 SdrObject* pMidObj=NULL; 440 if (pObj!=pHitObj) 441 { 442 SdrObject* pObjTmp=NULL; 443 pObjTmp=pHitObj->GetUpGroup(); 444 if (pObjTmp==pObj) pObjTmp=NULL; 445 while (pObjTmp!=NULL) 446 { 447 if (pObjTmp->HasMacro()) 448 { 449 bMid=sal_True; 450 pMidObj=pObjTmp; 451 } 452 pObjTmp=pObjTmp->GetUpGroup(); 453 if (pObjTmp==pObj) pObjTmp=NULL; 454 } 455 } 456 457 if (bDeep || bMid || bRoot) 458 { 459 SdrObjMacroHitRec aHitRec; 460 aHitRec.aPos=aLocalLogicPosition; 461 aHitRec.aDownPos=aLocalLogicPosition; 462 aHitRec.nTol=nHitTolLog; 463 aHitRec.pVisiLayer=&pPV->GetVisibleLayers(); 464 aHitRec.pPageView=pPV; 465 if (bDeep) bDeep=pHitObj->IsMacroHit(aHitRec); 466 if (bMid ) bMid =pMidObj->IsMacroHit(aHitRec); 467 if (bRoot) bRoot=pObj->IsMacroHit(aHitRec); 468 if (bRoot || bMid || bDeep) 469 { 470 // Prio: 1.Root, 2.Mid, 3.Deep 471 rVEvt.pRootObj=pObj; 472 if (!bRoot) pObj=pMidObj; 473 if (!bRoot && !bMid) pObj=pHitObj; 474 eHit=SDRHIT_MACRO; 475 } 476 } 477 } 478 // auf URL-Field checken 479 if (IsMacroMode() && eHit==SDRHIT_UNMARKEDOBJECT) 480 { 481 SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,pHitObj); 482 if (pTextObj!=NULL && pTextObj->HasText()) 483 { 484 bool bTEHit(pPV && 485 SdrObjectPrimitiveHit(*pTextObj, aLocalLogicPosition, 0, *pPV, &pPV->GetVisibleLayers(), true)); 486 487 if (bTEHit) 488 { 489 Rectangle aTextRect; 490 Rectangle aAnchor; 491 SdrOutliner* pOutliner = &pTextObj->ImpGetDrawOutliner(); 492 if( pTextObj->GetModel() ) 493 pOutliner = &pTextObj->GetModel()->GetHitTestOutliner(); 494 495 pTextObj->TakeTextRect( *pOutliner, aTextRect, sal_False, &aAnchor, sal_False ); 496 497 // #i73628# Use a text-relative position for hit test in hit test outliner 498 Point aTemporaryTextRelativePosition(aLocalLogicPosition - aTextRect.TopLeft()); 499 500 // FitToSize berueksichtigen 501 SdrFitToSizeType eFit=pTextObj->GetFitToSize(); 502 sal_Bool bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); 503 if (bFitToSize) { 504 Fraction aX(aTextRect.GetWidth()-1,aAnchor.GetWidth()-1); 505 Fraction aY(aTextRect.GetHeight()-1,aAnchor.GetHeight()-1); 506 ResizePoint(aTemporaryTextRelativePosition,Point(),aX,aY); 507 } 508 // Drehung berueksichtigen 509 const GeoStat& rGeo=pTextObj->GetGeoStat(); 510 if (rGeo.nDrehWink!=0) RotatePoint(aTemporaryTextRelativePosition,Point(),-rGeo.nSin,rGeo.nCos); // -sin fuer Unrotate 511 // Laufschrift berueksichtigen fehlt noch ... 512 if(pActualOutDev && pActualOutDev->GetOutDevType() == OUTDEV_WINDOW) 513 { 514 OutlinerView aOLV(pOutliner, (Window*)pActualOutDev); 515 const EditView& aEV=aOLV.GetEditView(); 516 const SvxFieldItem* pItem=aEV.GetField(aTemporaryTextRelativePosition); 517 if (pItem!=NULL) { 518 const SvxFieldData* pFld=pItem->GetField(); 519 const SvxURLField* pURL=PTR_CAST(SvxURLField,pFld); 520 if (pURL!=NULL) { 521 eHit=SDRHIT_URLFIELD; 522 rVEvt.pURLField=pURL; 523 } 524 } 525 } 526 } 527 } 528 } 529 530 if (nHitPassNum==SDRSEARCHPASS_DIRECT && 531 (eHit==SDRHIT_MARKEDOBJECT || eHit==SDRHIT_UNMARKEDOBJECT) && 532 (IsTextTool() || (IsEditMode() && IsQuickTextEditMode())) && pHitObj->HasTextEdit()) 533 { 534 // Ringsum die TextEditArea ein Rand zum Selektieren ohne Textedit 535 Rectangle aBoundRect(pHitObj->GetCurrentBoundRect()); 536 537 // #105130# Force to SnapRect when Fontwork 538 if(pHitObj->ISA(SdrTextObj) && ((SdrTextObj*)pHitObj)->IsFontwork()) 539 { 540 aBoundRect = pHitObj->GetSnapRect(); 541 } 542 543 // #105130# Old test for hit on BoundRect is completely wrong 544 // and never worked, doing it new here. 545 sal_Int32 nTolerance(nHitTolLog); 546 sal_Bool bBoundRectHit(sal_False); 547 548 if(pOut) 549 { 550 nTolerance = pOut->PixelToLogic(Size(2, 0)).Width(); 551 } 552 553 if( (aLocalLogicPosition.X() >= aBoundRect.Left() - nTolerance && aLocalLogicPosition.X() <= aBoundRect.Left() + nTolerance) 554 || (aLocalLogicPosition.X() >= aBoundRect.Right() - nTolerance && aLocalLogicPosition.X() <= aBoundRect.Right() + nTolerance) 555 || (aLocalLogicPosition.Y() >= aBoundRect.Top() - nTolerance && aLocalLogicPosition.Y() <= aBoundRect.Top() + nTolerance) 556 || (aLocalLogicPosition.Y() >= aBoundRect.Bottom() - nTolerance && aLocalLogicPosition.Y() <= aBoundRect.Bottom() + nTolerance)) 557 { 558 bBoundRectHit = sal_True; 559 } 560 561 if(!bBoundRectHit) 562 { 563 bool bTEHit(pPV && 564 SdrObjectPrimitiveHit(*pHitObj, aLocalLogicPosition, 0, *pPV, &pPV->GetVisibleLayers(), true)); 565 566 // TextEdit an Objekten im gesperrten Layer 567 if (pPV->GetLockedLayers().IsSet(pHitObj->GetLayer())) 568 { 569 bTEHit=sal_False; 570 } 571 572 if (bTEHit) 573 { 574 rVEvt.pRootObj=pObj; 575 pObj=pHitObj; 576 eHit=SDRHIT_TEXTEDITOBJ; 577 } 578 } 579 } 580 if (nHitPassNum!=SDRSEARCHPASS_DIRECT && eHit==SDRHIT_UNMARKEDOBJECT) { 581 eHit=SDRHIT_NONE; 582 pObj=NULL; 583 pPV=NULL; 584 } 585 sal_Bool bMouseLeft=(rVEvt.nMouseCode&MOUSE_LEFT)!=0; 586 sal_Bool bMouseRight=(rVEvt.nMouseCode&MOUSE_RIGHT)!=0; 587 sal_Bool bMouseDown=rVEvt.bMouseDown; 588 sal_Bool bMouseUp=rVEvt.bMouseUp; 589 SdrEventKind eEvent=SDREVENT_NONE; 590 sal_Bool bIsAction=IsAction(); 591 592 if (bIsAction) 593 { 594 if (bMouseDown) 595 { 596 if (bMouseRight) eEvent=SDREVENT_BCKACTION; 597 } 598 else if (bMouseUp) 599 { 600 if (bMouseLeft) 601 { 602 eEvent=SDREVENT_ENDACTION; 603 if (IsDragObj()) 604 { 605 eEvent=SDREVENT_ENDDRAG; 606 rVEvt.bDragWithCopy=MODKEY_CopyDrag; 607 } 608 else if (IsCreateObj() || IsInsObjPoint()) 609 { 610 eEvent=IsCreateObj() ? SDREVENT_ENDCREATE : SDREVENT_ENDINSOBJPOINT; 611 rVEvt.eEndCreateCmd=SDRCREATE_NEXTPOINT; 612 if (MODKEY_PolyPoly) rVEvt.eEndCreateCmd=SDRCREATE_NEXTOBJECT; 613 if (rVEvt.nMouseClicks>1) rVEvt.eEndCreateCmd=SDRCREATE_FORCEEND; 614 } 615 else if (IsMarking()) 616 { 617 eEvent=SDREVENT_ENDMARK; 618 if (!aDragStat.IsMinMoved()) 619 { 620 eEvent=SDREVENT_BRKMARK; 621 rVEvt.bAddMark=MODKEY_MultiMark; 622 } 623 } 624 } 625 } 626 else 627 { 628 eEvent=SDREVENT_MOVACTION; 629 } 630 } 631 else if (eHit==SDRHIT_TEXTEDIT) 632 { 633 eEvent=SDREVENT_TEXTEDIT; 634 } 635 else if (bMouseDown && bMouseLeft) 636 { 637 if (rVEvt.nMouseClicks==2 && rVEvt.nMouseCode==MOUSE_LEFT && pObj!=NULL && pHitObj!=NULL && pHitObj->HasTextEdit() && eHit==SDRHIT_MARKEDOBJECT) 638 { 639 rVEvt.pRootObj=pObj; 640 pObj=pHitObj; 641 eEvent=SDREVENT_BEGTEXTEDIT; 642 } 643 else if (MODKEY_ForceMark && eHit!=SDRHIT_URLFIELD) 644 { 645 eEvent=SDREVENT_BEGMARK; // AddMark,Unmark */ 646 } 647 else if (eHit==SDRHIT_HELPLINE) 648 { 649 eEvent=SDREVENT_BEGDRAGHELPLINE; // nix weiter 650 } 651 else if (eHit==SDRHIT_GLUEPOINT) 652 { 653 eEvent=SDREVENT_MARKGLUEPOINT; // AddMark+Drag 654 rVEvt.bAddMark=MODKEY_MultiMark || MODKEY_DeepMark; // falls bei Deep nicht getroffen 655 } 656 else if (eHit==SDRHIT_HANDLE) 657 { 658 eEvent=SDREVENT_BEGDRAGOBJ; // Mark+Drag,AddMark+Drag,DeepMark+Drag,Unmark 659 sal_Bool bGlue=pHdl->GetKind()==HDL_GLUE; 660 sal_Bool bPoly=!bGlue && IsPointMarkable(*pHdl); 661 sal_Bool bMarked=bGlue || bPoly && pHdl->IsSelected(); 662 if (bGlue || bPoly) 663 { 664 eEvent=bGlue ? SDREVENT_MARKGLUEPOINT : SDREVENT_MARKPOINT; 665 if (MODKEY_DeepMark) 666 { 667 rVEvt.bAddMark=sal_True; 668 rVEvt.bPrevNextMark=sal_True; 669 rVEvt.bMarkPrev=MODKEY_DeepBackw; 670 } 671 else if (MODKEY_MultiMark) 672 { 673 rVEvt.bAddMark=sal_True; 674 rVEvt.bUnmark=bMarked; // Toggle 675 if (bGlue) 676 { 677 pObj=pHdl->GetObj(); 678 nGlueId=(sal_uInt16)pHdl->GetObjHdlNum(); 679 } 680 } 681 else if (bMarked) 682 { 683 eEvent=SDREVENT_BEGDRAGOBJ; // MarkState nicht aendern, nur Drag 684 } 685 } 686 } 687 else if (bInsPolyPt && (MODKEY_PolyPoly || (!MODKEY_MultiMark && !MODKEY_DeepMark))) 688 { 689 eEvent=SDREVENT_BEGINSOBJPOINT; 690 rVEvt.bInsPointNewObj=MODKEY_PolyPoly; 691 } 692 else if (bInsGluePt && !MODKEY_MultiMark && !MODKEY_DeepMark) 693 { 694 eEvent=SDREVENT_BEGINSGLUEPOINT; 695 } 696 else if (eHit==SDRHIT_TEXTEDITOBJ) 697 { 698 eEvent=SDREVENT_BEGTEXTEDIT; // AddMark+Drag,DeepMark+Drag,Unmark 699 if (MODKEY_MultiMark || MODKEY_DeepMark) 700 { // falls bei Deep nicht getroffen 701 eEvent=SDREVENT_MARKOBJ; 702 } 703 } 704 else if (eHit==SDRHIT_MACRO) 705 { 706 eEvent=SDREVENT_BEGMACROOBJ; // AddMark+Drag 707 if (MODKEY_MultiMark || MODKEY_DeepMark) 708 { // falls bei Deep nicht getroffen 709 eEvent=SDREVENT_MARKOBJ; 710 } 711 } 712 else if (eHit==SDRHIT_URLFIELD) 713 { 714 eEvent=SDREVENT_EXECUTEURL; // AddMark+Drag 715 if (MODKEY_MultiMark || MODKEY_DeepMark) 716 { // falls bei Deep nicht getroffen 717 eEvent=SDREVENT_MARKOBJ; 718 } 719 } 720 else if (eHit==SDRHIT_MARKEDOBJECT) 721 { 722 eEvent=SDREVENT_BEGDRAGOBJ; // DeepMark+Drag,Unmark 723 724 if (MODKEY_MultiMark || MODKEY_DeepMark) 725 { // falls bei Deep nicht getroffen 726 eEvent=SDREVENT_MARKOBJ; 727 } 728 } 729 else if (IsCreateMode()) 730 { 731 eEvent=SDREVENT_BEGCREATEOBJ; // Nix weiter 732 } 733 else if (eHit==SDRHIT_UNMARKEDOBJECT) 734 { 735 eEvent=SDREVENT_MARKOBJ; // AddMark+Drag 736 } 737 else 738 { 739 eEvent=SDREVENT_BEGMARK; 740 } 741 742 if (eEvent==SDREVENT_MARKOBJ) 743 { 744 rVEvt.bAddMark=MODKEY_MultiMark || MODKEY_DeepMark; // falls bei Deep nicht getroffen 745 rVEvt.bPrevNextMark=MODKEY_DeepMark; 746 rVEvt.bMarkPrev=MODKEY_DeepMark && MODKEY_DeepBackw; 747 } 748 if (eEvent==SDREVENT_BEGMARK) 749 { 750 rVEvt.bAddMark=MODKEY_MultiMark; 751 rVEvt.bUnmark=MODKEY_Unmark; 752 } 753 } 754 rVEvt.bIsAction=bIsAction; 755 rVEvt.bIsTextEdit=bIsTextEdit; 756 rVEvt.bTextEditHit=bTextEditHit; 757 rVEvt.aLogicPos=aLocalLogicPosition; 758 rVEvt.pHdl=pHdl; 759 rVEvt.pObj=pObj; 760 if(rVEvt.pRootObj==NULL) 761 rVEvt.pRootObj=pObj; 762 rVEvt.pPV=pPV; 763 rVEvt.nHlplIdx=nHlplIdx; 764 rVEvt.nGlueId=nGlueId; 765 rVEvt.eHit=eHit; 766 rVEvt.eEvent=eEvent; 767 rVEvt.bCaptureMouse=bMouseLeft && bMouseDown && eEvent!=SDREVENT_NONE; 768 rVEvt.bReleaseMouse=bMouseLeft && bMouseUp; 769 #ifdef DGB_UTIL 770 if (rVEvt.pRootObj!=NULL) { 771 if (rVEvt.pRootObj->GetObjList()!=rVEvt.pPV->GetObjList()) { 772 DBG_ERROR("SdrView::PickAnything(): pRootObj->GetObjList()!=pPV->GetObjList() !"); 773 } 774 } 775 #endif 776 return eHit; 777 } 778 779 sal_Bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt) 780 { 781 sal_Bool bRet=sal_False; 782 SdrHitKind eHit=rVEvt.eHit; 783 Point aLogicPos(rVEvt.aLogicPos); 784 785 sal_Bool bShift=(rVEvt.nMouseCode & KEY_SHIFT) !=0; 786 sal_Bool bCtrl=(rVEvt.nMouseCode & KEY_MOD1) !=0; 787 sal_Bool bAlt=(rVEvt.nMouseCode & KEY_MOD2) !=0; 788 sal_Bool bMouseLeft=(rVEvt.nMouseCode&MOUSE_LEFT)!=0; 789 //sal_Bool bMouseRight=(rVEvt.nMouseCode&MOUSE_RIGHT)!=0; 790 sal_Bool bMouseDown=rVEvt.bMouseDown; 791 sal_Bool bMouseUp=rVEvt.bMouseUp; 792 if (bMouseDown) { 793 if (bMouseLeft) aDragStat.SetMouseDown(sal_True); 794 } else if (bMouseUp) { 795 if (bMouseLeft) aDragStat.SetMouseDown(sal_False); 796 } else { // ansonsten MoueMove 797 aDragStat.SetMouseDown(bMouseLeft); 798 } 799 800 #ifdef MODKEY_NoSnap 801 SetSnapEnabled(!MODKEY_NoSnap); 802 #endif 803 #ifdef MODKEY_Ortho 804 SetOrtho(MODKEY_Ortho!=IsOrthoDesired()); 805 #endif 806 #ifdef MODKEY_BigOrtho 807 SetBigOrtho(MODKEY_BigOrtho); 808 #endif 809 #ifdef MODKEY_AngleSnap 810 SetAngleSnapEnabled(MODKEY_AngleSnap); 811 #endif 812 #ifdef MODKEY_CopyDrag 813 SetDragWithCopy(MODKEY_CopyDrag); 814 #endif 815 #ifdef MODKEY_Center 816 SetCreate1stPointAsCenter(MODKEY_Center); 817 SetResizeAtCenter(MODKEY_Center); 818 SetCrookAtCenter(MODKEY_Center); 819 #endif 820 if (bMouseLeft && bMouseDown && rVEvt.bIsTextEdit && (eHit==SDRHIT_UNMARKEDOBJECT || eHit==SDRHIT_NONE)) { 821 SdrEndTextEdit(); // Danebengeklickt, Ende mit Edit 822 // pHdl ist dann ungueltig. Sollte aber egal sein, wein pHdl==NULL 823 // sein muesste (wg. eHit). 824 } 825 switch (rVEvt.eEvent) { 826 case SDREVENT_NONE: bRet=sal_False; break; 827 case SDREVENT_TEXTEDIT: bRet=sal_False; break; // Events an die OutlinerView werden hier nicht beruecksichtigt 828 case SDREVENT_MOVACTION: MovAction(aLogicPos); bRet=sal_True; break; 829 case SDREVENT_ENDACTION: EndAction(); bRet=sal_True; break; 830 case SDREVENT_BCKACTION: BckAction(); bRet=sal_True; break; 831 case SDREVENT_BRKACTION: BrkAction(); bRet=sal_True; break; 832 case SDREVENT_ENDMARK : EndAction(); bRet=sal_True; break; 833 case SDREVENT_BRKMARK : { 834 BrkAction(); 835 if (!MarkObj(aLogicPos,nHitTolLog,rVEvt.bAddMark)) { 836 // Kein Obj getroffen. Dann werden zuerst 837 // - Markierte Klebepunkte deselektiert 838 // - dann ggf. selektierte Polygonpunkte 839 // - und ansonsten Objekte 840 if (!rVEvt.bAddMark) UnmarkAll(); 841 } 842 bRet=sal_True; 843 } break; 844 case SDREVENT_ENDCREATE: { // ggf. MarkObj 845 SdrCreateCmd eCmd=SDRCREATE_NEXTPOINT; 846 if (MODKEY_PolyPoly) eCmd=SDRCREATE_NEXTOBJECT; 847 if (rVEvt.nMouseClicks>1) eCmd=SDRCREATE_FORCEEND; 848 if (!EndCreateObj(eCmd)) { // Event fuer Create nicht ausgewerten? -> Markieren 849 if (eHit==SDRHIT_UNMARKEDOBJECT || eHit==SDRHIT_TEXTEDIT) { 850 MarkObj(rVEvt.pRootObj,rVEvt.pPV); 851 if (eHit==SDRHIT_TEXTEDIT) 852 { 853 sal_Bool bRet2(pActualOutDev && OUTDEV_WINDOW == pActualOutDev->GetOutDevType() && 854 SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, (Window*)pActualOutDev, sal_False, (SdrOutliner*)0L)); 855 856 if(bRet2) 857 { 858 MouseEvent aMEvt(pActualOutDev->LogicToPixel(aLogicPos), 859 1,rVEvt.nMouseMode,rVEvt.nMouseCode,rVEvt.nMouseCode); 860 861 OutlinerView* pOLV=GetTextEditOutlinerView(); 862 if (pOLV!=NULL) { 863 pOLV->MouseButtonDown(aMEvt); // Event an den Outliner, aber ohne Doppelklick 864 pOLV->MouseButtonUp(aMEvt); // Event an den Outliner, aber ohne Doppelklick 865 } 866 } 867 } 868 bRet=sal_True; // Obj markiert und ggf. TextEdit gestartet 869 } else bRet=sal_False; // Create abgebrochen, sonst nix weiter. 870 } else bRet=sal_True; // EndCreate mit sal_True returniert 871 } break; 872 case SDREVENT_ENDDRAG: { 873 bRet=EndDragObj(IsDragWithCopy()); 874 ForceMarkedObjToAnotherPage(); // Undo+Klammerung fehlt noch !!! 875 } break; 876 case SDREVENT_MARKOBJ: { // + ggf. BegDrag 877 if (!rVEvt.bAddMark) UnmarkAllObj(); 878 sal_Bool bUnmark=rVEvt.bUnmark; 879 if (rVEvt.bPrevNextMark) { 880 bRet=MarkNextObj(aLogicPos,nHitTolLog,rVEvt.bMarkPrev); 881 } else { 882 SortMarkedObjects(); 883 sal_uIntPtr nAnz0=GetMarkedObjectCount(); 884 bRet=MarkObj(aLogicPos,nHitTolLog,rVEvt.bAddMark); 885 SortMarkedObjects(); 886 sal_uIntPtr nAnz1=GetMarkedObjectCount(); 887 bUnmark=nAnz1<nAnz0; 888 } 889 if (!bUnmark) { 890 BegDragObj(aLogicPos,NULL,(SdrHdl*)NULL,nMinMovLog); 891 bRet=sal_True; 892 } 893 } break; 894 case SDREVENT_MARKPOINT: { // + ggf. BegDrag 895 if (!rVEvt.bAddMark) UnmarkAllPoints(); 896 if (rVEvt.bPrevNextMark) { 897 bRet=MarkNextPoint(aLogicPos,rVEvt.bMarkPrev); 898 } else { 899 bRet=MarkPoint(*rVEvt.pHdl,rVEvt.bUnmark); 900 } 901 if (!rVEvt.bUnmark && !rVEvt.bPrevNextMark) { 902 BegDragObj(aLogicPos,NULL,rVEvt.pHdl,nMinMovLog); 903 bRet=sal_True; 904 } 905 } break; 906 case SDREVENT_MARKGLUEPOINT: { // + ggf. BegDrag 907 if (!rVEvt.bAddMark) UnmarkAllGluePoints(); 908 if (rVEvt.bPrevNextMark) { 909 bRet=MarkNextGluePoint(aLogicPos,rVEvt.bMarkPrev); 910 } else { 911 bRet=MarkGluePoint(rVEvt.pObj,rVEvt.nGlueId,rVEvt.pPV,rVEvt.bUnmark); 912 } 913 if (!rVEvt.bUnmark && !rVEvt.bPrevNextMark) { 914 SdrHdl* pHdl=GetGluePointHdl(rVEvt.pObj,rVEvt.nGlueId); 915 BegDragObj(aLogicPos,NULL,pHdl,nMinMovLog); 916 bRet=sal_True; 917 } 918 } break; 919 case SDREVENT_BEGMARK: bRet=BegMark(aLogicPos,rVEvt.bAddMark,rVEvt.bUnmark); break; 920 case SDREVENT_BEGINSOBJPOINT: bRet = BegInsObjPoint(aLogicPos, MODKEY_PolyPoly); break; 921 case SDREVENT_ENDINSOBJPOINT: { 922 SdrCreateCmd eCmd=SDRCREATE_NEXTPOINT; 923 if (MODKEY_PolyPoly) eCmd=SDRCREATE_NEXTOBJECT; 924 if (rVEvt.nMouseClicks>1) eCmd=SDRCREATE_FORCEEND; 925 EndInsObjPoint(eCmd); 926 bRet=sal_True; 927 } break; 928 case SDREVENT_BEGINSGLUEPOINT: bRet=BegInsGluePoint(aLogicPos); break; 929 case SDREVENT_BEGDRAGHELPLINE: bRet=BegDragHelpLine(rVEvt.nHlplIdx,rVEvt.pPV); break; 930 case SDREVENT_BEGDRAGOBJ: bRet=BegDragObj(aLogicPos,NULL,rVEvt.pHdl,nMinMovLog); break; 931 case SDREVENT_BEGCREATEOBJ: { 932 if (nAktInvent==SdrInventor && nAktIdent==OBJ_CAPTION) { 933 long nHgt=SdrEngineDefaults::GetFontHeight(); 934 bRet=BegCreateCaptionObj(aLogicPos,Size(5*nHgt,2*nHgt)); 935 } else bRet=BegCreateObj(aLogicPos); 936 } break; 937 case SDREVENT_BEGMACROOBJ: bRet=BegMacroObj(aLogicPos,nHitTolLog,rVEvt.pObj,rVEvt.pPV,(Window*)pActualOutDev); break; 938 case SDREVENT_BEGTEXTEDIT: { 939 if (!IsObjMarked(rVEvt.pObj)) { 940 UnmarkAllObj(); 941 MarkObj(rVEvt.pRootObj,rVEvt.pPV); 942 } 943 944 bRet = pActualOutDev && OUTDEV_WINDOW == pActualOutDev->GetOutDevType()&& 945 SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, (Window*)pActualOutDev, sal_False, (SdrOutliner*)0L); 946 947 if(bRet) 948 { 949 MouseEvent aMEvt(pActualOutDev->LogicToPixel(aLogicPos), 950 1,rVEvt.nMouseMode,rVEvt.nMouseCode,rVEvt.nMouseCode); 951 OutlinerView* pOLV=GetTextEditOutlinerView(); 952 if (pOLV!=NULL) pOLV->MouseButtonDown(aMEvt); // Event an den Outliner, aber ohne Doppelklick 953 } 954 } break; 955 default: break; 956 } // switch 957 if (bRet && pActualOutDev!=NULL && pActualOutDev->GetOutDevType()==OUTDEV_WINDOW) { 958 Window* pWin=(Window*)pActualOutDev; 959 // Maus links gedrueckt? 960 sal_Bool bLeftDown=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && rVEvt.bMouseDown; 961 // Maus links losgelassen? 962 sal_Bool bLeftUp=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && rVEvt.bMouseUp; 963 // Maus links gedrueckt oder gehalten? 964 sal_Bool bLeftDown1=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && !rVEvt.bMouseUp; 965 pWin->SetPointer(GetPreferedPointer(rVEvt.aLogicPos,pWin, 966 rVEvt.nMouseCode & (KEY_SHIFT|KEY_MOD1|KEY_MOD2),bLeftDown1)); 967 sal_Bool bAction=IsAction(); 968 if (bLeftDown && bAction) pWin->CaptureMouse(); 969 else if (bLeftUp || (rVEvt.bIsAction && !bAction)) pWin->ReleaseMouse(); 970 } 971 return bRet; 972 } 973 #include <editeng/outlobj.hxx> 974 975 Pointer SdrView::GetPreferedPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nModifier, sal_Bool bLeftDown) const 976 { 977 // Actions 978 if (IsCreateObj()) 979 { 980 return pAktCreate->GetCreatePointer(); 981 } 982 if (mpCurrentSdrDragMethod) 983 { 984 if ((IsDraggingPoints() || IsDraggingGluePoints()) && IsMouseHideWhileDraggingPoints()) 985 return Pointer(POINTER_NULL); 986 987 return mpCurrentSdrDragMethod->GetSdrDragPointer(); 988 } 989 if (IsMarkObj() || IsMarkPoints() || IsMarkGluePoints() || IsEncirclement() || IsSetPageOrg()) return Pointer(POINTER_ARROW); 990 if (IsDragHelpLine()) return GetDraggedHelpLinePointer(); 991 if (IsMacroObj()) { 992 SdrObjMacroHitRec aHitRec; 993 aHitRec.aPos=pOut->LogicToPixel(rMousePos); 994 aHitRec.aDownPos=aMacroDownPos; 995 aHitRec.nTol=nMacroTol; 996 aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers(); 997 aHitRec.pPageView=pMacroPV; 998 aHitRec.pOut=pMacroWin; 999 aHitRec.bDown=bMacroDown; 1000 return pMacroObj->GetMacroPointer(aHitRec); 1001 } 1002 //sal_uInt16 nTol=nHitTolLog; 1003 // TextEdit, ObjEdit, Macro 1004 if (IsTextEdit() && (IsTextEditInSelectionMode() || IsTextEditHit(rMousePos,0/*nTol*/))) 1005 { 1006 if(!pOut || IsTextEditInSelectionMode()) 1007 { 1008 if(pTextEditOutliner->IsVertical()) 1009 return Pointer(POINTER_TEXT_VERTICAL); 1010 else 1011 return Pointer(POINTER_TEXT); 1012 } 1013 // hier muss besser der Outliner was liefern: 1014 Point aPos(pOut->LogicToPixel(rMousePos)); 1015 Pointer aPointer(pTextEditOutlinerView->GetPointer(aPos)); 1016 if (aPointer==POINTER_ARROW) 1017 { 1018 if(pTextEditOutliner->IsVertical()) 1019 aPointer = POINTER_TEXT_VERTICAL; 1020 else 1021 aPointer = POINTER_TEXT; 1022 } 1023 return aPointer; 1024 } 1025 1026 SdrViewEvent aVEvt; 1027 aVEvt.nMouseCode=(nModifier&(KEY_SHIFT|KEY_MOD1|KEY_MOD2))|MOUSE_LEFT; // um zu sehen, was bei MouseLeftDown passieren wuerde 1028 aVEvt.bMouseDown=!bLeftDown; // Was waere wenn ... 1029 aVEvt.bMouseUp=bLeftDown; // Was waere wenn ... 1030 if (pOut!=NULL) 1031 ((SdrView*)this)->SetActualWin(pOut); 1032 SdrHitKind eHit=PickAnything(rMousePos,aVEvt); 1033 SdrEventKind eEvent=aVEvt.eEvent; 1034 switch (eEvent) 1035 { 1036 case SDREVENT_BEGCREATEOBJ: 1037 return aAktCreatePointer; 1038 case SDREVENT_MARKOBJ: 1039 case SDREVENT_BEGMARK: 1040 return Pointer(POINTER_ARROW); 1041 case SDREVENT_MARKPOINT: 1042 case SDREVENT_MARKGLUEPOINT: 1043 return Pointer(POINTER_MOVEPOINT); 1044 case SDREVENT_BEGINSOBJPOINT: 1045 case SDREVENT_BEGINSGLUEPOINT: 1046 return Pointer(POINTER_CROSS); 1047 case SDREVENT_EXECUTEURL: 1048 return Pointer(POINTER_REFHAND); 1049 case SDREVENT_BEGMACROOBJ: 1050 { 1051 SdrObjMacroHitRec aHitRec; 1052 aHitRec.aPos=aVEvt.aLogicPos; 1053 aHitRec.aDownPos=aHitRec.aPos; 1054 aHitRec.nTol=nHitTolLog; 1055 aHitRec.pVisiLayer=&aVEvt.pPV->GetVisibleLayers(); 1056 aHitRec.pPageView=aVEvt.pPV; 1057 aHitRec.pOut=(OutputDevice*)pOut; 1058 return aVEvt.pObj->GetMacroPointer(aHitRec); 1059 } 1060 default: break; 1061 } // switch 1062 1063 switch(eHit) 1064 { 1065 case SDRHIT_CELL: 1066 return Pointer(POINTER_ARROW); 1067 case SDRHIT_HELPLINE : 1068 return aVEvt.pPV->GetHelpLines()[aVEvt.nHlplIdx].GetPointer(); 1069 case SDRHIT_GLUEPOINT: 1070 return Pointer(POINTER_MOVEPOINT); 1071 case SDRHIT_TEXTEDIT : 1072 case SDRHIT_TEXTEDITOBJ: 1073 { 1074 SdrTextObj* pText = dynamic_cast< SdrTextObj* >( aVEvt.pObj ); 1075 if(pText && pText->HasText()) 1076 { 1077 OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject(); 1078 if(pParaObj && pParaObj->IsVertical()) 1079 return Pointer(POINTER_TEXT_VERTICAL); 1080 } 1081 return Pointer(POINTER_TEXT); 1082 } 1083 default: break; 1084 } 1085 1086 sal_Bool bMarkHit=eHit==SDRHIT_MARKEDOBJECT; 1087 SdrHdl* pHdl=aVEvt.pHdl; 1088 // Nun die Pointer fuer Dragging checken 1089 if (pHdl!=NULL || bMarkHit) { 1090 SdrHdlKind eHdl= pHdl!=NULL ? pHdl->GetKind() : HDL_MOVE; 1091 sal_Bool bCorner=pHdl!=NULL && pHdl->IsCornerHdl(); 1092 sal_Bool bVertex=pHdl!=NULL && pHdl->IsVertexHdl(); 1093 sal_Bool bMov=eHdl==HDL_MOVE; 1094 if (bMov && (eDragMode==SDRDRAG_MOVE || eDragMode==SDRDRAG_RESIZE || bMarkedHitMovesAlways)) { 1095 if (!IsMoveAllowed()) return Pointer(POINTER_ARROW); // weil Doppelklick oder Drag&Drop moeglich 1096 return Pointer(POINTER_MOVE); 1097 } 1098 switch (eDragMode) { 1099 case SDRDRAG_ROTATE: { 1100 if ((bCorner || bMov) && !IsRotateAllowed(sal_True)) 1101 return Pointer(POINTER_NOTALLOWED); 1102 1103 // Sind 3D-Objekte selektiert? 1104 sal_Bool b3DObjSelected = sal_False; 1105 #ifndef SVX_LIGHT 1106 for (sal_uInt32 a=0; !b3DObjSelected && a<GetMarkedObjectCount(); a++) { 1107 SdrObject* pObj = GetMarkedObjectByIndex(a); 1108 if(pObj && pObj->ISA(E3dObject)) 1109 b3DObjSelected = sal_True; 1110 } 1111 #endif 1112 // Falls es um ein 3D-Objekt geht, muss trotz !IsShearAllowed 1113 // weitergemacht werden, da es sich um eine Rotation statt um 1114 // einen Shear handelt 1115 if (bVertex && !IsShearAllowed() && !b3DObjSelected) 1116 return Pointer(POINTER_NOTALLOWED); 1117 if (bMov) 1118 return Pointer(POINTER_ROTATE); 1119 } break; 1120 case SDRDRAG_SHEAR: case SDRDRAG_DISTORT: { 1121 if (bCorner) { 1122 if (!IsDistortAllowed(sal_True) && !IsDistortAllowed(sal_False)) return Pointer(POINTER_NOTALLOWED); 1123 else return Pointer(POINTER_REFHAND); 1124 } 1125 if (bVertex && !IsShearAllowed()) return Pointer(POINTER_NOTALLOWED); 1126 if (bMov) { 1127 if (!IsMoveAllowed()) return Pointer(POINTER_ARROW); // weil Doppelklick oder Drag&Drop moeglich 1128 return Pointer(POINTER_MOVE); 1129 } 1130 } break; 1131 case SDRDRAG_MIRROR: { 1132 if (bCorner || bVertex || bMov) { 1133 SdrHdl* pH1=aHdl.GetHdl(HDL_REF1); 1134 SdrHdl* pH2=aHdl.GetHdl(HDL_REF2); 1135 sal_Bool b90=sal_False; 1136 sal_Bool b45=sal_False; 1137 Point aDif; 1138 if (pH1!=NULL && pH2!=NULL) { 1139 aDif=pH2->GetPos()-pH1->GetPos(); 1140 b90=(aDif.X()==0) || aDif.Y()==0; 1141 b45=b90 || (Abs(aDif.X())==Abs(aDif.Y())); 1142 } 1143 sal_Bool bNo=sal_False; 1144 if (!IsMirrorAllowed(sal_True,sal_True)) bNo=sal_True; // Spiegeln ueberhaupt nicht erlaubt 1145 if (!IsMirrorAllowed(sal_False,sal_False) && !b45) bNo=sal_True; // freies Spiegeln nicht erlaubt 1146 if (!IsMirrorAllowed(sal_True,sal_False) && !b90) bNo=sal_True; // Spiegeln hor/ver erlaubt 1147 if (bNo) return Pointer(POINTER_NOTALLOWED); 1148 if (b90) { 1149 return Pointer(POINTER_MIRROR); 1150 } 1151 return Pointer(POINTER_MIRROR); 1152 } 1153 } break; 1154 1155 case SDRDRAG_TRANSPARENCE: 1156 { 1157 if(!IsTransparenceAllowed()) 1158 return Pointer(POINTER_NOTALLOWED); 1159 1160 return Pointer(POINTER_REFHAND); 1161 } 1162 1163 case SDRDRAG_GRADIENT: 1164 { 1165 if(!IsGradientAllowed()) 1166 return Pointer(POINTER_NOTALLOWED); 1167 1168 return Pointer(POINTER_REFHAND); 1169 } 1170 1171 case SDRDRAG_CROOK: { 1172 if (bCorner || bVertex || bMov) { 1173 if (!IsCrookAllowed(sal_True) && !IsCrookAllowed(sal_False)) return Pointer(POINTER_NOTALLOWED); 1174 return Pointer(POINTER_CROOK); 1175 } 1176 } 1177 1178 case SDRDRAG_CROP: 1179 { 1180 return Pointer(POINTER_CROP); 1181 } 1182 1183 default: { 1184 if ((bCorner || bVertex) && !IsResizeAllowed(sal_True)) return Pointer(POINTER_NOTALLOWED); 1185 } 1186 } 1187 if (pHdl!=NULL) return pHdl->GetPointer(); 1188 if (bMov) { 1189 if (!IsMoveAllowed()) return Pointer(POINTER_ARROW); // weil Doppelklick oder Drag&Drop moeglich 1190 return Pointer(POINTER_MOVE); 1191 } 1192 } 1193 if (eEditMode==SDREDITMODE_CREATE) return aAktCreatePointer; 1194 return Pointer(POINTER_ARROW); 1195 } 1196 1197 XubString SdrView::GetStatusText() 1198 { 1199 XubString aStr; 1200 XubString aName; 1201 1202 aStr.AppendAscii("nix"); 1203 1204 if (pAktCreate!=NULL) 1205 { 1206 aStr=pAktCreate->getSpecialDragComment(aDragStat); 1207 1208 if(!aStr.Len()) 1209 { 1210 pAktCreate->TakeObjNameSingul(aName); 1211 aStr = ImpGetResStr(STR_ViewCreateObj); 1212 } 1213 } 1214 else if (mpCurrentSdrDragMethod) 1215 { 1216 if (bInsPolyPoint || IsInsertGluePoint()) 1217 { 1218 aStr=aInsPointUndoStr; 1219 } 1220 else 1221 { 1222 if (aDragStat.IsMinMoved()) 1223 { 1224 OSL_TRACE("SdrView::GetStatusText(%lx) %lx\n", this, mpCurrentSdrDragMethod); 1225 mpCurrentSdrDragMethod->TakeSdrDragComment(aStr); 1226 } 1227 } 1228 } 1229 else if(IsMarkObj()) 1230 { 1231 if(AreObjectsMarked()) 1232 { 1233 aStr = ImpGetResStr(STR_ViewMarkMoreObjs); 1234 } 1235 else 1236 { 1237 aStr = ImpGetResStr(STR_ViewMarkObjs); 1238 } 1239 } 1240 else if(IsMarkPoints()) 1241 { 1242 if(HasMarkedPoints()) 1243 { 1244 aStr = ImpGetResStr(STR_ViewMarkMorePoints); 1245 } 1246 else 1247 { 1248 aStr = ImpGetResStr(STR_ViewMarkPoints); 1249 } 1250 } else if (IsMarkGluePoints()) 1251 { 1252 if(HasMarkedGluePoints()) 1253 { 1254 aStr = ImpGetResStr(STR_ViewMarkMoreGluePoints); 1255 } 1256 else 1257 { 1258 aStr = ImpGetResStr(STR_ViewMarkGluePoints); 1259 } 1260 } 1261 else if (IsTextEdit() && pTextEditOutlinerView!=NULL) { 1262 aStr=ImpGetResStr(STR_ViewTextEdit); // "TextEdit - Zeile y Spalte x"; 1263 ESelection aSel(pTextEditOutlinerView->GetSelection()); 1264 long nPar=aSel.nEndPara,nLin=0,nCol=aSel.nEndPos; 1265 if (aSel.nEndPara>0) { 1266 for (sal_uInt16 nParaNum=0; nParaNum<aSel.nEndPara; nParaNum++) { 1267 nLin+=pTextEditOutliner->GetLineCount(nParaNum); 1268 } 1269 } 1270 // Noch 'ne kleine Unschoenheit: 1271 // Am Ende einer Zeile eines mehrzeiligen Absatzes wird die Position 1272 // der naechsten Zeile des selben Absatzes angezeigt, so es eine solche 1273 // gibt. 1274 sal_uInt16 nParaLine=0; 1275 sal_uIntPtr nParaLineAnz=pTextEditOutliner->GetLineCount(aSel.nEndPara); 1276 sal_Bool bBrk=sal_False; 1277 while (!bBrk) { 1278 sal_uInt16 nLen=pTextEditOutliner->GetLineLen(aSel.nEndPara,nParaLine); 1279 sal_Bool bLastLine=(nParaLine==nParaLineAnz-1); 1280 if (nCol>nLen || (!bLastLine && nCol==nLen)) { 1281 nCol-=nLen; 1282 nLin++; 1283 nParaLine++; 1284 } else bBrk=sal_True; 1285 if (nLen==0) bBrk=sal_True; // Sicherheitshalber 1286 } 1287 1288 aStr.SearchAndReplaceAscii("%1", UniString::CreateFromInt32(nPar + 1)); 1289 aStr.SearchAndReplaceAscii("%2", UniString::CreateFromInt32(nLin + 1)); 1290 aStr.SearchAndReplaceAscii("%3", UniString::CreateFromInt32(nCol + 1)); 1291 1292 #ifdef DBG_UTIL 1293 aStr += UniString( RTL_CONSTASCII_USTRINGPARAM( ", Level " ) ); 1294 aStr += UniString::CreateFromInt32( pTextEditOutliner->GetDepth( aSel.nEndPara ) ); 1295 #endif 1296 } 1297 1298 if(aStr.EqualsAscii("nix")) 1299 { 1300 if (AreObjectsMarked()) { 1301 ImpTakeDescriptionStr(STR_ViewMarked,aStr); 1302 if (IsGluePointEditMode()) { 1303 if (HasMarkedGluePoints()) { 1304 ImpTakeDescriptionStr(STR_ViewMarked,aStr,0,IMPSDR_GLUEPOINTSDESCRIPTION); 1305 } 1306 } else { 1307 if (HasMarkedPoints()) { 1308 ImpTakeDescriptionStr(STR_ViewMarked,aStr,0,IMPSDR_POINTSDESCRIPTION); 1309 } 1310 } 1311 } else { 1312 aStr.Erase(); 1313 } 1314 } 1315 else if(aName.Len()) 1316 { 1317 aStr.SearchAndReplaceAscii("%1", aName); 1318 } 1319 1320 if(aStr.Len()) 1321 { 1322 // ersten Buchstaben gross schreiben 1323 String aTmpStr(aStr.Copy(0, 1)); 1324 aTmpStr.ToUpperAscii(); 1325 aStr.Replace(0, 1, aTmpStr); 1326 } 1327 return aStr; 1328 } 1329 1330 SdrViewContext SdrView::GetContext() const 1331 { 1332 if( IsGluePointEditMode() ) 1333 return SDRCONTEXT_GLUEPOINTEDIT; 1334 1335 const sal_uIntPtr nMarkAnz = GetMarkedObjectCount(); 1336 1337 if( HasMarkablePoints() && !IsFrameHandles() ) 1338 { 1339 sal_Bool bPath=sal_True; 1340 for( sal_uIntPtr nMarkNum = 0; nMarkNum < nMarkAnz && bPath; nMarkNum++ ) 1341 if (!GetMarkedObjectByIndex(nMarkNum)->ISA(SdrPathObj)) 1342 bPath=sal_False; 1343 1344 if( bPath ) 1345 return SDRCONTEXT_POINTEDIT; 1346 } 1347 1348 if( GetMarkedObjectCount() ) 1349 { 1350 sal_Bool bGraf = sal_True, bMedia = sal_True, bTable = sal_True; 1351 1352 for( sal_uIntPtr nMarkNum = 0; nMarkNum < nMarkAnz && ( bGraf || bMedia ); nMarkNum++ ) 1353 { 1354 const SdrObject* pMarkObj = GetMarkedObjectByIndex( nMarkNum ); 1355 DBG_ASSERT( pMarkObj, "SdrView::GetContext(), null pointer in mark list!" ); 1356 1357 if( !pMarkObj ) 1358 continue; 1359 1360 if( !pMarkObj->ISA( SdrGrafObj ) ) 1361 bGraf = sal_False; 1362 1363 if( !pMarkObj->ISA( SdrMediaObj ) ) 1364 bMedia = sal_False; 1365 1366 if( !pMarkObj->ISA( ::sdr::table::SdrTableObj ) ) 1367 bTable = sal_False; 1368 } 1369 1370 if( bGraf ) 1371 return SDRCONTEXT_GRAPHIC; 1372 else if( bMedia ) 1373 return SDRCONTEXT_MEDIA; 1374 else if( bTable ) 1375 return SDRCONTEXT_TABLE; 1376 } 1377 1378 return SDRCONTEXT_STANDARD; 1379 } 1380 1381 void SdrView::MarkAll() 1382 { 1383 if (IsTextEdit()) { 1384 GetTextEditOutlinerView()->SetSelection(ESelection(0,0,0xFFFF,0xFFFF)); 1385 #ifdef DBG_UTIL 1386 if (pItemBrowser!=NULL) pItemBrowser->SetDirty(); 1387 #endif 1388 } else if (IsGluePointEditMode()) MarkAllGluePoints(); 1389 else if (HasMarkablePoints()) MarkAllPoints(); 1390 else MarkAllObj(); 1391 } 1392 1393 void SdrView::UnmarkAll() 1394 { 1395 if (IsTextEdit()) { 1396 ESelection eSel=GetTextEditOutlinerView()->GetSelection(); 1397 eSel.nStartPara=eSel.nEndPara; 1398 eSel.nStartPos=eSel.nEndPos; 1399 GetTextEditOutlinerView()->SetSelection(eSel); 1400 #ifdef DBG_UTIL 1401 if (pItemBrowser!=NULL) pItemBrowser->SetDirty(); 1402 #endif 1403 } else if (HasMarkedGluePoints()) UnmarkAllGluePoints(); 1404 else if (HasMarkedPoints()) UnmarkAllPoints(); // ! Marked statt Markable ! 1405 else UnmarkAllObj(); 1406 } 1407 1408 sal_Bool SdrView::IsAllMarked() const 1409 { 1410 if (IsTextEdit()) { 1411 return ImpIsTextEditAllSelected(); 1412 } 1413 if (IsGluePointEditMode()) { 1414 sal_uIntPtr nAnz=GetMarkableGluePointCount(); 1415 return nAnz!=0 && nAnz==GetMarkedGluePointCount(); 1416 } 1417 if (HasMarkedPoints()) { 1418 sal_uIntPtr nAnz=GetMarkablePointCount(); 1419 return nAnz!=0 && nAnz==GetMarkedPointCount(); 1420 } 1421 sal_uIntPtr nAnz=GetMarkableObjCount(); 1422 return nAnz!=0 && nAnz == GetMarkedObjectCount(); 1423 } 1424 1425 sal_Bool SdrView::IsMarkPossible() const 1426 { 1427 if(IsTextEdit()) 1428 { 1429 return SdrTextObj::HasTextImpl( pTextEditOutliner ); 1430 } 1431 1432 if(IsGluePointEditMode()) 1433 { 1434 return HasMarkableGluePoints(); 1435 } 1436 1437 if(HasMarkedPoints()) 1438 { 1439 return HasMarkablePoints(); 1440 } 1441 1442 return HasMarkableObj(); 1443 } 1444 1445 sal_Bool SdrView::IsAllMarkPrevNextPossible() const 1446 { 1447 if (IsTextEdit()) { 1448 return sal_False; 1449 } 1450 if (IsGluePointEditMode()) { 1451 return HasMarkableGluePoints(); 1452 } 1453 if (HasMarkedPoints()) { 1454 return HasMarkablePoints(); 1455 } 1456 return HasMarkableObj(); 1457 } 1458 1459 sal_Bool SdrView::MarkNext(sal_Bool bPrev) 1460 { 1461 if (IsTextEdit()) { 1462 return sal_False; 1463 } 1464 if (IsGluePointEditMode() && HasMarkedGluePoints()) { 1465 return MarkNextGluePoint(bPrev); 1466 } 1467 if (HasMarkedPoints()) { 1468 return MarkNextPoint(bPrev); 1469 } 1470 return MarkNextObj(bPrev); 1471 } 1472 1473 sal_Bool SdrView::MarkNext(const Point& rPnt, sal_Bool bPrev) 1474 { 1475 if (IsTextEdit()) { 1476 return sal_False; 1477 } 1478 if (IsGluePointEditMode() && HasMarkedGluePoints()) { 1479 //return MarkNextGluePoint(rPnt,bPrev); fehlende Implementation !!! 1480 } 1481 if (HasMarkedPoints()) { 1482 //return MarkNextPoint(rPnt,bPrev); fehlende Implementation !!! 1483 } 1484 return MarkNextObj(rPnt,-2,bPrev); 1485 } 1486 1487 const Rectangle& SdrView::GetMarkedRect() const 1488 { 1489 if (IsGluePointEditMode() && HasMarkedGluePoints()) { 1490 return GetMarkedGluePointsRect(); 1491 } 1492 if (HasMarkedPoints()) { 1493 return GetMarkedPointsRect(); 1494 } 1495 return GetMarkedObjRect(); 1496 } 1497 1498 void SdrView::SetMarkedRect(const Rectangle& rRect) 1499 { 1500 if (IsGluePointEditMode() && HasMarkedGluePoints()) { 1501 //SetMarkedGluePointsRect(rRect); fehlende Implementation !!! 1502 } else if (HasMarkedPoints()) { 1503 //SetMarkedPointsRect(rRect); fehlende Implementation !!! 1504 } else SetMarkedObjRect(rRect); 1505 } 1506 1507 void SdrView::DeleteMarked() 1508 { 1509 if (IsTextEdit()) 1510 { 1511 SdrObjEditView::KeyInput(KeyEvent(0,KeyCode(KEYFUNC_DELETE)),pTextEditWin); 1512 } 1513 else 1514 { 1515 if( mxSelectionController.is() && mxSelectionController->DeleteMarked() ) 1516 { 1517 // action already performed by current selection controller, do nothing 1518 } 1519 else if (IsGluePointEditMode() && HasMarkedGluePoints()) 1520 { 1521 DeleteMarkedGluePoints(); 1522 } 1523 else if (GetContext()==SDRCONTEXT_POINTEDIT && HasMarkedPoints()) 1524 { 1525 DeleteMarkedPoints(); 1526 } 1527 else 1528 { 1529 DeleteMarkedObj(); 1530 } 1531 } 1532 } 1533 1534 sal_Bool SdrView::BegMark(const Point& rPnt, sal_Bool bAddMark, sal_Bool bUnmark) 1535 { 1536 if (bUnmark) bAddMark=sal_True; 1537 if (IsGluePointEditMode()) { 1538 if (!bAddMark) UnmarkAllGluePoints(); 1539 return BegMarkGluePoints(rPnt,bUnmark); 1540 } else if (HasMarkablePoints()) { 1541 if (!bAddMark) UnmarkAllPoints(); 1542 return BegMarkPoints(rPnt,bUnmark); 1543 } else { 1544 if (!bAddMark) UnmarkAllObj(); 1545 return BegMarkObj(rPnt,bUnmark); 1546 } 1547 } 1548 1549 sal_Bool SdrView::IsDeleteMarkedPossible() const 1550 { 1551 if (IsReadOnly()) return sal_False; 1552 if (IsTextEdit()) return sal_True; 1553 if (IsGluePointEditMode() && HasMarkedGluePoints()) return sal_True; 1554 if (HasMarkedPoints()) return sal_True; 1555 return IsDeleteMarkedObjPossible(); 1556 } 1557 1558 void SdrView::ConfigurationChanged( ::utl::ConfigurationBroadcaster*p, sal_uInt32 nHint) 1559 { 1560 onAccessibilityOptionsChanged(); 1561 SdrCreateView::ConfigurationChanged(p, nHint); 1562 } 1563 1564 SvtAccessibilityOptions& SdrView::getAccessibilityOptions() 1565 { 1566 return maAccessibilityOptions; 1567 } 1568 1569 /** method is called whenever the global SvtAccessibilityOptions is changed */ 1570 void SdrView::onAccessibilityOptionsChanged() 1571 { 1572 } 1573 1574 void SdrView::SetMasterPagePaintCaching(sal_Bool bOn) 1575 { 1576 if(mbMasterPagePaintCaching != bOn) 1577 { 1578 mbMasterPagePaintCaching = bOn; 1579 1580 // reset at all SdrPageWindow's 1581 SdrPageView* pPageView = GetSdrPageView(); 1582 1583 if(pPageView) 1584 { 1585 for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++) 1586 { 1587 SdrPageWindow* pPageWindow = pPageView->GetPageWindow(b); 1588 DBG_ASSERT(pPageWindow, "SdrView::SetMasterPagePaintCaching: Corrupt SdrPageWindow list (!)"); 1589 1590 // force deletion of ObjectContact, so at re-display all VOCs 1591 // will be re-created with updated flag setting 1592 pPageWindow->ResetObjectContact(); 1593 } 1594 1595 // force redraw of this view 1596 pPageView->InvalidateAllWin(); 1597 } 1598 } 1599 } 1600 // eof 1601