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 27 #include <svx/svdmrkv.hxx> 28 #include <svx/svdetc.hxx> 29 #include <svx/svdoedge.hxx> 30 #include "svx/svdglob.hxx" 31 #include "svx/svditext.hxx" 32 #include <svx/svdview.hxx> 33 #include <svx/svdpagv.hxx> 34 #include <svx/svdpage.hxx> 35 #include "svddrgm1.hxx" 36 37 #ifdef DBG_UTIL 38 #include <svdibrow.hxx> 39 #endif 40 41 #include <svx/svdoole2.hxx> 42 #include <svx/xgrad.hxx> 43 #include <svx/xflgrit.hxx> 44 #include "gradtrns.hxx" 45 #include <svx/xflftrit.hxx> 46 #include <svx/dialmgr.hxx> 47 #include "svx/svdstr.hrc" 48 #include <svx/svdundo.hxx> 49 #include <svx/svdopath.hxx> 50 #include <svx/scene3d.hxx> 51 #include <svx/svdovirt.hxx> 52 #include <svx/sdr/overlay/overlayrollingrectangle.hxx> 53 #include <svx/sdr/overlay/overlaymanager.hxx> 54 #include <svx/sdrpaintwindow.hxx> 55 #include <svx/sdrpagewindow.hxx> 56 #include <svx/sdrhittesthelper.hxx> 57 #include <svx/svdocapt.hxx> 58 #include <svx/svdograf.hxx> 59 60 //////////////////////////////////////////////////////////////////////////////////////////////////// 61 // predefines 62 63 class SdrUnoControlList; 64 65 //////////////////////////////////////////////////////////////////////////////////////////////////// 66 // #114409#-3 Migrate Marking of Objects, Points and GluePoints 67 68 class ImplMarkingOverlay 69 { 70 // The OverlayObjects 71 ::sdr::overlay::OverlayObjectList maObjects; 72 73 // The remembered second position in logical coodinates 74 basegfx::B2DPoint maSecondPosition; 75 76 // bitfield 77 // A flag to remember if the action is for unmarking. 78 unsigned mbUnmarking : 1; 79 80 public: 81 ImplMarkingOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos, sal_Bool bUnmarking = sal_False); 82 ~ImplMarkingOverlay(); 83 84 void SetSecondPosition(const basegfx::B2DPoint& rNewPosition); 85 sal_Bool IsUnmarking() const { return mbUnmarking; } 86 }; 87 88 ImplMarkingOverlay::ImplMarkingOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos, sal_Bool bUnmarking) 89 : maSecondPosition(rStartPos), 90 mbUnmarking(bUnmarking) 91 { 92 for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++) 93 { 94 SdrPaintWindow* pCandidate = rView.GetPaintWindow(a); 95 ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager(); 96 97 if(pTargetOverlay) 98 { 99 ::sdr::overlay::OverlayRollingRectangleStriped* pNew = new ::sdr::overlay::OverlayRollingRectangleStriped( 100 rStartPos, rStartPos, false); 101 pTargetOverlay->add(*pNew); 102 maObjects.append(*pNew); 103 } 104 } 105 } 106 107 ImplMarkingOverlay::~ImplMarkingOverlay() 108 { 109 // The OverlayObjects are cleared using the destructor of OverlayObjectList. 110 // That destructor calls clear() at the list which removes all objects from the 111 // OverlayManager and deletes them. 112 } 113 114 void ImplMarkingOverlay::SetSecondPosition(const basegfx::B2DPoint& rNewPosition) 115 { 116 if(rNewPosition != maSecondPosition) 117 { 118 // apply to OverlayObjects 119 for(sal_uInt32 a(0L); a < maObjects.count(); a++) 120 { 121 ::sdr::overlay::OverlayRollingRectangleStriped& rCandidate = (::sdr::overlay::OverlayRollingRectangleStriped&)maObjects.getOverlayObject(a); 122 rCandidate.setSecondPosition(rNewPosition); 123 } 124 125 // remember new position 126 maSecondPosition = rNewPosition; 127 } 128 } 129 130 //////////////////////////////////////////////////////////////////////////////////////////////////// 131 //////////////////////////////////////////////////////////////////////////////////////////////////// 132 // 133 // @@ @@ @@@@ @@@@@ @@ @@ @@ @@ @@ @@@@@ @@ @@ 134 // @@@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ 135 // @@@@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@ 136 // @@@@@@@ @@@@@@ @@@@@ @@@@ @@@@@ @@ @@@@ @@@@@@@ 137 // @@ @ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@ 138 // @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@ 139 // @@ @@ @@ @@ @@ @@ @@ @@ @ @@ @@@@@ @@ @@ 140 // 141 //////////////////////////////////////////////////////////////////////////////////////////////////// 142 //////////////////////////////////////////////////////////////////////////////////////////////////// 143 144 void SdrMarkView::ImpClearVars() 145 { 146 eDragMode=SDRDRAG_MOVE; 147 //HMHbHdlShown=sal_False; 148 bRefHdlShownOnly=sal_False; 149 eEditMode=SDREDITMODE_EDIT; 150 eEditMode0=SDREDITMODE_EDIT; 151 bDesignMode=sal_False; 152 pMarkedObj=NULL; 153 pMarkedPV=NULL; 154 bForceFrameHandles=sal_False; 155 bPlusHdlAlways=sal_False; 156 nFrameHandlesLimit=50; 157 bInsPolyPoint=sal_False; 158 mnInsPointNum = 0L; 159 bMarkedObjRectDirty=sal_False; 160 bMarkedPointsRectsDirty=sal_False; 161 mbMarkHandlesHidden = false; 162 bMrkPntDirty=sal_False; 163 bMarkHdlWhenTextEdit=sal_False; 164 bMarkableObjCountDirty=sal_False; // noch nicht implementiert 165 nMarkableObjCount=0; // noch nicht implementiert 166 167 // #114409#-3 Migrate selections 168 BrkMarkObj(); 169 BrkMarkPoints(); 170 BrkMarkGluePoints(); 171 } 172 173 SdrMarkView::SdrMarkView(SdrModel* pModel1, OutputDevice* pOut) 174 : SdrSnapView(pModel1,pOut), 175 mpMarkObjOverlay(0L), 176 mpMarkPointsOverlay(0L), 177 mpMarkGluePointsOverlay(0L), 178 aHdl(this), 179 mpSdrViewSelection(new sdr::ViewSelection()) 180 { 181 ImpClearVars(); 182 StartListening(*pModel1); 183 } 184 185 SdrMarkView::~SdrMarkView() 186 { 187 // #114409#-3 Migrate selections 188 BrkMarkObj(); 189 BrkMarkPoints(); 190 BrkMarkGluePoints(); 191 delete mpSdrViewSelection; 192 } 193 194 void __EXPORT SdrMarkView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) 195 { 196 SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint); 197 if (pSdrHint!=NULL) 198 { 199 SdrHintKind eKind=pSdrHint->GetKind(); 200 201 if (eKind==HINT_OBJCHG || eKind==HINT_OBJINSERTED || eKind==HINT_OBJREMOVED) 202 { 203 bMarkedObjRectDirty=sal_True; 204 bMarkedPointsRectsDirty=sal_True; 205 } 206 /* removed for now since this breaks existing code who iterates over the mark list and sequentially replaces objects 207 if( eKind==HINT_OBJREMOVED && IsObjMarked( const_cast<SdrObject*>(pSdrHint->GetObject()) ) ) 208 { 209 MarkObj( const_cast<SdrObject*>(pSdrHint->GetObject()), GetSdrPageView(), sal_True ); 210 } 211 */ 212 } 213 SdrSnapView::Notify(rBC,rHint); 214 } 215 216 void SdrMarkView::ModelHasChanged() 217 { 218 SdrPaintView::ModelHasChanged(); 219 GetMarkedObjectListWriteAccess().SetNameDirty(); 220 bMarkedObjRectDirty=sal_True; 221 bMarkedPointsRectsDirty=sal_True; 222 // Es sind beispielsweise Obj markiert und maMarkedObjectListist Sorted. 223 // In einer anderen View 2 wird die ObjOrder veraendert 224 // (z.B. MovToTop()). Dann ist Neusortieren der MarkList erforderlich. 225 GetMarkedObjectListWriteAccess().SetUnsorted(); 226 SortMarkedObjects(); 227 bMrkPntDirty=sal_True; 228 UndirtyMrkPnt(); 229 SdrView* pV=(SdrView*)this; 230 if (pV!=NULL && !pV->IsDragObj() && !pV->IsInsObjPoint()) { // an dieser Stelle habe ich ein ziemliches Problem !!! 231 AdjustMarkHdl(); 232 } 233 } 234 235 //////////////////////////////////////////////////////////////////////////////////////////////////// 236 237 sal_Bool SdrMarkView::IsAction() const 238 { 239 return SdrSnapView::IsAction() || IsMarkObj() || IsMarkPoints() || IsMarkGluePoints(); 240 } 241 242 void SdrMarkView::MovAction(const Point& rPnt) 243 { 244 SdrSnapView::MovAction(rPnt); 245 246 if(IsMarkObj()) 247 { 248 MovMarkObj(rPnt); 249 } 250 else if(IsMarkPoints()) 251 { 252 MovMarkPoints(rPnt); 253 } 254 else if(IsMarkGluePoints()) 255 { 256 MovMarkGluePoints(rPnt); 257 } 258 } 259 260 void SdrMarkView::EndAction() 261 { 262 if(IsMarkObj()) 263 { 264 EndMarkObj(); 265 } 266 else if(IsMarkPoints()) 267 { 268 EndMarkPoints(); 269 } 270 else if(IsMarkGluePoints()) 271 { 272 EndMarkGluePoints(); 273 } 274 275 SdrSnapView::EndAction(); 276 } 277 278 void SdrMarkView::BckAction() 279 { 280 SdrSnapView::BckAction(); 281 BrkMarkObj(); 282 BrkMarkPoints(); 283 BrkMarkGluePoints(); 284 } 285 286 void SdrMarkView::BrkAction() 287 { 288 SdrSnapView::BrkAction(); 289 BrkMarkObj(); 290 BrkMarkPoints(); 291 BrkMarkGluePoints(); 292 } 293 294 void SdrMarkView::TakeActionRect(Rectangle& rRect) const 295 { 296 if(IsMarkObj() || IsMarkPoints() || IsMarkGluePoints()) 297 { 298 rRect = Rectangle(aDragStat.GetStart(), aDragStat.GetNow()); 299 } 300 else 301 { 302 SdrSnapView::TakeActionRect(rRect); 303 } 304 } 305 306 //////////////////////////////////////////////////////////////////////////////////////////////////// 307 308 void SdrMarkView::ClearPageView() 309 { 310 UnmarkAllObj(); 311 SdrSnapView::ClearPageView(); 312 } 313 314 void SdrMarkView::HideSdrPage() 315 { 316 bool bMrkChg(false); 317 //HMHbool bVis(false); 318 319 if(mpPageView) 320 { 321 // break all creation actions when hiding page (#75081#) 322 BrkAction(); 323 //HMHbVis = IsMarkHdlShown(); 324 325 //HMHif(bVis) 326 //HMH{ 327 //HMH HideMarkHdl(); 328 //HMH} 329 330 // Alle Markierungen dieser Seite verwerfen 331 bMrkChg = GetMarkedObjectListWriteAccess().DeletePageView(*mpPageView); 332 } 333 334 SdrSnapView::HideSdrPage(); 335 336 if(bMrkChg) 337 { 338 MarkListHasChanged(); 339 AdjustMarkHdl(); 340 } 341 342 //HMHif(bVis) 343 //HMH{ 344 //HMH ShowMarkHdl(); 345 //HMH} 346 } 347 348 //////////////////////////////////////////////////////////////////////////////////////////////////// 349 350 sal_Bool SdrMarkView::BegMarkObj(const Point& rPnt, sal_Bool bUnmark) 351 { 352 BrkAction(); 353 354 DBG_ASSERT(0L == mpMarkObjOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkObjOverlay (!)"); 355 basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y()); 356 mpMarkObjOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark); 357 358 aDragStat.Reset(rPnt); 359 aDragStat.NextPoint(); 360 aDragStat.SetMinMove(nMinMovLog); 361 362 return sal_True; 363 } 364 365 void SdrMarkView::MovMarkObj(const Point& rPnt) 366 { 367 if(IsMarkObj() && aDragStat.CheckMinMoved(rPnt)) 368 { 369 aDragStat.NextMove(rPnt); 370 DBG_ASSERT(mpMarkObjOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)"); 371 basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y()); 372 mpMarkObjOverlay->SetSecondPosition(aNewPos); 373 } 374 } 375 376 sal_Bool SdrMarkView::EndMarkObj() 377 { 378 sal_Bool bRetval(sal_False); 379 380 if(IsMarkObj()) 381 { 382 if(aDragStat.IsMinMoved()) 383 { 384 Rectangle aRect(aDragStat.GetStart(), aDragStat.GetNow()); 385 aRect.Justify(); 386 MarkObj(aRect, mpMarkObjOverlay->IsUnmarking()); 387 bRetval = sal_True; 388 } 389 390 // cleanup 391 BrkMarkObj(); 392 } 393 394 return bRetval; 395 } 396 397 void SdrMarkView::BrkMarkObj() 398 { 399 if(IsMarkObj()) 400 { 401 DBG_ASSERT(mpMarkObjOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)"); 402 delete mpMarkObjOverlay; 403 mpMarkObjOverlay = 0L; 404 } 405 } 406 407 //////////////////////////////////////////////////////////////////////////////////////////////////// 408 409 sal_Bool SdrMarkView::BegMarkPoints(const Point& rPnt, sal_Bool bUnmark) 410 { 411 if(HasMarkablePoints()) 412 { 413 BrkAction(); 414 415 DBG_ASSERT(0L == mpMarkPointsOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkPointsOverlay (!)"); 416 basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y()); 417 mpMarkPointsOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark); 418 419 aDragStat.Reset(rPnt); 420 aDragStat.NextPoint(); 421 aDragStat.SetMinMove(nMinMovLog); 422 423 return sal_True; 424 } 425 426 return sal_False; 427 } 428 429 void SdrMarkView::MovMarkPoints(const Point& rPnt) 430 { 431 if(IsMarkPoints() && aDragStat.CheckMinMoved(rPnt)) 432 { 433 aDragStat.NextMove(rPnt); 434 435 DBG_ASSERT(mpMarkPointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)"); 436 basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y()); 437 mpMarkPointsOverlay->SetSecondPosition(aNewPos); 438 } 439 } 440 441 sal_Bool SdrMarkView::EndMarkPoints() 442 { 443 sal_Bool bRetval(sal_False); 444 445 if(IsMarkPoints()) 446 { 447 if(aDragStat.IsMinMoved()) 448 { 449 Rectangle aRect(aDragStat.GetStart(), aDragStat.GetNow()); 450 aRect.Justify(); 451 MarkPoints(aRect, mpMarkPointsOverlay->IsUnmarking()); 452 453 bRetval = sal_True; 454 } 455 456 // cleanup 457 BrkMarkPoints(); 458 } 459 460 return bRetval; 461 } 462 463 void SdrMarkView::BrkMarkPoints() 464 { 465 if(IsMarkPoints()) 466 { 467 DBG_ASSERT(mpMarkPointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)"); 468 delete mpMarkPointsOverlay; 469 mpMarkPointsOverlay = 0L; 470 } 471 } 472 473 //////////////////////////////////////////////////////////////////////////////////////////////////// 474 475 sal_Bool SdrMarkView::BegMarkGluePoints(const Point& rPnt, sal_Bool bUnmark) 476 { 477 if(HasMarkableGluePoints()) 478 { 479 BrkAction(); 480 481 DBG_ASSERT(0L == mpMarkGluePointsOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkGluePointsOverlay (!)"); 482 basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y()); 483 mpMarkGluePointsOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark); 484 485 aDragStat.Reset(rPnt); 486 aDragStat.NextPoint(); 487 aDragStat.SetMinMove(nMinMovLog); 488 489 return sal_True; 490 } 491 492 return sal_False; 493 } 494 495 void SdrMarkView::MovMarkGluePoints(const Point& rPnt) 496 { 497 if(IsMarkGluePoints() && aDragStat.CheckMinMoved(rPnt)) 498 { 499 aDragStat.NextMove(rPnt); 500 501 DBG_ASSERT(mpMarkGluePointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)"); 502 basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y()); 503 mpMarkGluePointsOverlay->SetSecondPosition(aNewPos); 504 } 505 } 506 507 sal_Bool SdrMarkView::EndMarkGluePoints() 508 { 509 sal_Bool bRetval(sal_False); 510 511 if(IsMarkGluePoints()) 512 { 513 if(aDragStat.IsMinMoved()) 514 { 515 Rectangle aRect(aDragStat.GetStart(),aDragStat.GetNow()); 516 aRect.Justify(); 517 MarkGluePoints(&aRect, mpMarkGluePointsOverlay->IsUnmarking()); 518 519 bRetval = sal_True; 520 } 521 522 // cleanup 523 BrkMarkGluePoints(); 524 } 525 526 return bRetval; 527 } 528 529 void SdrMarkView::BrkMarkGluePoints() 530 { 531 if(IsMarkGluePoints()) 532 { 533 DBG_ASSERT(mpMarkGluePointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)"); 534 delete mpMarkGluePointsOverlay; 535 mpMarkGluePointsOverlay = 0L; 536 } 537 } 538 539 sal_Bool SdrMarkView::HasMarkableObj() const 540 { 541 sal_uIntPtr nCount=0; 542 543 SdrPageView* pPV = GetSdrPageView(); 544 if(pPV) 545 { 546 SdrObjList* pOL=pPV->GetObjList(); 547 sal_uIntPtr nObjAnz=pOL->GetObjCount(); 548 for (sal_uIntPtr nObjNum=0; nObjNum<nObjAnz && nCount==0; nObjNum++) { 549 SdrObject* pObj=pOL->GetObj(nObjNum); 550 if (IsObjMarkable(pObj,pPV)) { 551 nCount++; 552 } 553 } 554 } 555 return nCount!=0; 556 } 557 558 sal_uIntPtr SdrMarkView::GetMarkableObjCount() const 559 { 560 sal_uIntPtr nCount=0; 561 SdrPageView* pPV = GetSdrPageView(); 562 563 if(pPV) 564 { 565 SdrObjList* pOL=pPV->GetObjList(); 566 sal_uIntPtr nObjAnz=pOL->GetObjCount(); 567 for (sal_uIntPtr nObjNum=0; nObjNum<nObjAnz; nObjNum++) { 568 SdrObject* pObj=pOL->GetObj(nObjNum); 569 if (IsObjMarkable(pObj,pPV)) { 570 nCount++; 571 } 572 } 573 } 574 return nCount; 575 } 576 577 //HMHvoid SdrMarkView::ImpShowMarkHdl(bool /*bNoRefHdl*/) 578 //HMH{ 579 //HMH bNoRefHdl=sal_False; // geht leider erstmal nicht anders 580 //HMH if (!bHdlShown) { 581 //HMH bRefHdlShownOnly=sal_False; 582 //HMH bHdlShown=sal_True; 583 //HMH } 584 //HMH} 585 586 //HMHvoid SdrMarkView::ShowMarkHdl(bool /*bNoRefHdl*/) 587 //HMH{ 588 //HMH bNoRefHdl=sal_False; // geht leider erstmal nicht anders 589 //HMH ImpShowMarkHdl(bNoRefHdl); 590 //HMH} 591 592 593 //HMHvoid SdrMarkView::HideMarkHdl(bool /*bNoRefHdl*/) 594 //HMH{ 595 //HMH bNoRefHdl=sal_False; // geht leider erstmal nicht anders 596 //HMH if (bHdlShown) { 597 //HMH bRefHdlShownOnly=bNoRefHdl; 598 //HMH bHdlShown=sal_False; 599 //HMH } 600 //HMH} 601 602 void SdrMarkView::hideMarkHandles() 603 { 604 if(!mbMarkHandlesHidden) 605 { 606 mbMarkHandlesHidden = true; 607 AdjustMarkHdl(); 608 } 609 } 610 611 void SdrMarkView::showMarkHandles() 612 { 613 if(mbMarkHandlesHidden) 614 { 615 mbMarkHandlesHidden = false; 616 AdjustMarkHdl(); 617 } 618 } 619 620 sal_Bool SdrMarkView::ImpIsFrameHandles() const 621 { 622 sal_uIntPtr nMarkAnz=GetMarkedObjectCount(); 623 sal_Bool bFrmHdl=nMarkAnz>nFrameHandlesLimit || bForceFrameHandles; 624 sal_Bool bStdDrag=eDragMode==SDRDRAG_MOVE; 625 if (nMarkAnz==1 && bStdDrag && bFrmHdl) 626 { 627 const SdrObject* pObj=GetMarkedObjectByIndex(0); 628 if (pObj->GetObjInventor()==SdrInventor) 629 { 630 sal_uInt16 nIdent=pObj->GetObjIdentifier(); 631 if (nIdent==OBJ_LINE || nIdent==OBJ_EDGE || nIdent==OBJ_CAPTION || nIdent==OBJ_MEASURE || nIdent==OBJ_CUSTOMSHAPE || nIdent==OBJ_TABLE ) 632 { 633 bFrmHdl=sal_False; 634 } 635 } 636 } 637 if (!bStdDrag && !bFrmHdl) { 638 // Grundsaetzlich erstmal alle anderen Dragmodi nur mit FrameHandles 639 bFrmHdl=sal_True; 640 if (eDragMode==SDRDRAG_ROTATE) { 641 // bei Rotate ObjOwn-Drag, wenn mind. 1 PolyObj 642 for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && bFrmHdl; nMarkNum++) { 643 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum); 644 const SdrObject* pObj=pM->GetMarkedSdrObj(); 645 bFrmHdl=!pObj->IsPolyObj(); 646 } 647 } 648 } 649 if (!bFrmHdl) { 650 // FrameHandles, wenn wenigstens 1 Obj kein SpecialDrag kann 651 for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && !bFrmHdl; nMarkNum++) { 652 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum); 653 const SdrObject* pObj=pM->GetMarkedSdrObj(); 654 bFrmHdl=!pObj->hasSpecialDrag(); 655 } 656 } 657 return bFrmHdl; 658 } 659 660 void SdrMarkView::SetMarkHandles() 661 { 662 // #105722# remember old focus handle values to search for it again 663 const SdrHdl* pSaveOldFocusHdl = aHdl.GetFocusHdl(); 664 sal_Bool bSaveOldFocus(sal_False); 665 sal_uInt32 nSavePolyNum(0L), nSavePointNum(0L); 666 SdrHdlKind eSaveKind(HDL_MOVE); 667 SdrObject* pSaveObj = NULL; 668 669 if(pSaveOldFocusHdl 670 && pSaveOldFocusHdl->GetObj() 671 && pSaveOldFocusHdl->GetObj()->ISA(SdrPathObj) 672 && (pSaveOldFocusHdl->GetKind() == HDL_POLY || pSaveOldFocusHdl->GetKind() == HDL_BWGT)) 673 { 674 bSaveOldFocus = sal_True; 675 nSavePolyNum = pSaveOldFocusHdl->GetPolyNum(); 676 nSavePointNum = pSaveOldFocusHdl->GetPointNum(); 677 pSaveObj = pSaveOldFocusHdl->GetObj(); 678 eSaveKind = pSaveOldFocusHdl->GetKind(); 679 } 680 681 // delete/clear all handles. This will always be done, even with areMarkHandlesHidden() 682 aHdl.Clear(); 683 aHdl.SetRotateShear(eDragMode==SDRDRAG_ROTATE); 684 aHdl.SetDistortShear(eDragMode==SDRDRAG_SHEAR); 685 pMarkedObj=NULL; 686 pMarkedPV=NULL; 687 688 // are handles enabled at all? Create only then 689 if(!areMarkHandlesHidden()) 690 { 691 sal_uIntPtr nMarkAnz=GetMarkedObjectCount(); 692 sal_Bool bStdDrag=eDragMode==SDRDRAG_MOVE; 693 sal_Bool bSingleTextObjMark=sal_False; 694 695 if (nMarkAnz==1) 696 { 697 pMarkedObj=GetMarkedObjectByIndex(0); 698 bSingleTextObjMark = 699 pMarkedObj && 700 pMarkedObj->ISA(SdrTextObj) && 701 static_cast<SdrTextObj*>(pMarkedObj)->IsTextFrame(); 702 } 703 704 sal_Bool bFrmHdl=ImpIsFrameHandles(); 705 706 if (nMarkAnz>0) 707 { 708 pMarkedPV=GetSdrPageViewOfMarkedByIndex(0); 709 710 for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && (pMarkedPV!=NULL || !bFrmHdl); nMarkNum++) 711 { 712 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum); 713 714 if (pMarkedPV!=pM->GetPageView()) 715 { 716 pMarkedPV=NULL; 717 } 718 } 719 } 720 721 // #122142# for captions in TextEdit, force to FrameHdls to get the special text selection 722 if(!bFrmHdl && pMarkedObj && bSingleTextObjMark && dynamic_cast< SdrCaptionObj* >(pMarkedObj)) 723 { 724 bFrmHdl = true; 725 } 726 727 if (bFrmHdl) 728 { 729 Rectangle aRect(GetMarkedObjRect()); 730 731 // #i33755# 732 const sal_Bool bHideHandlesWhenInTextEdit( 733 ((SdrView*)this)->IsTextEdit() 734 && pMarkedObj 735 && pMarkedObj->ISA(SdrTextObj) 736 && ((SdrTextObj*)pMarkedObj)->IsInEditMode()); 737 738 // #i118524# if inplace activated OLE is selected, 739 // suppress handles 740 bool bHideHandlesWhenOleActive(false); 741 const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pMarkedObj); 742 743 if(pSdrOle2Obj && (pSdrOle2Obj->isInplaceActive() || pSdrOle2Obj->isUiActive())) 744 { 745 bHideHandlesWhenOleActive = true; 746 } 747 748 if(!aRect.IsEmpty() && !bHideHandlesWhenInTextEdit && !bHideHandlesWhenOleActive) 749 { // sonst nix gefunden 750 if( bSingleTextObjMark ) 751 { 752 const sal_uIntPtr nSiz0=aHdl.GetHdlCount(); 753 pMarkedObj->AddToHdlList(aHdl); 754 const sal_uIntPtr nSiz1=aHdl.GetHdlCount(); 755 for (sal_uIntPtr i=nSiz0; i<nSiz1; i++) 756 { 757 SdrHdl* pHdl=aHdl.GetHdl(i); 758 pHdl->SetObj(pMarkedObj); 759 pHdl->SetPageView(pMarkedPV); 760 pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0)); 761 } 762 } 763 else if( eDragMode==SDRDRAG_CROP ) 764 { 765 const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pMarkedObj); 766 767 if(pSdrGrafObj) 768 { 769 const SdrGrafCropItem& rCrop = static_cast< const SdrGrafCropItem& >(pSdrGrafObj->GetMergedItem(SDRATTR_GRAFCROP)); 770 771 if(rCrop.GetLeft() || rCrop.GetTop() || rCrop.GetRight() ||rCrop.GetBottom()) 772 { 773 basegfx::B2DHomMatrix aMatrix; 774 basegfx::B2DPolyPolygon aPolyPolygon; 775 776 pSdrGrafObj->TRGetBaseGeometry(aMatrix, aPolyPolygon); 777 778 // decompose to have current translate and scale 779 basegfx::B2DVector aScale, aTranslate; 780 double fRotate, fShearX; 781 782 aMatrix.decompose(aScale, aTranslate, fRotate, fShearX); 783 784 if(!aScale.equalZero()) 785 { 786 // get crop scale 787 const basegfx::B2DVector aCropScaleFactor( 788 pSdrGrafObj->GetGraphicObject().calculateCropScaling( 789 aScale.getX(), 790 aScale.getY(), 791 rCrop.GetLeft(), 792 rCrop.GetTop(), 793 rCrop.GetRight(), 794 rCrop.GetBottom())); 795 796 // apply crop scale 797 const double fCropLeft(rCrop.GetLeft() * aCropScaleFactor.getX()); 798 const double fCropTop(rCrop.GetTop() * aCropScaleFactor.getY()); 799 const double fCropRight(rCrop.GetRight() * aCropScaleFactor.getX()); 800 const double fCropBottom(rCrop.GetBottom() * aCropScaleFactor.getY()); 801 802 aHdl.AddHdl( 803 new SdrCropViewHdl( 804 aMatrix, 805 pSdrGrafObj->GetGraphicObject().GetGraphic(), 806 fCropLeft, 807 fCropTop, 808 fCropRight, 809 fCropBottom, 810 pSdrGrafObj->IsMirrored())); 811 } 812 } 813 } 814 815 aHdl.AddHdl(new SdrCropHdl(aRect.TopLeft() ,HDL_UPLFT)); 816 aHdl.AddHdl(new SdrCropHdl(aRect.TopCenter() ,HDL_UPPER)); 817 aHdl.AddHdl(new SdrCropHdl(aRect.TopRight() ,HDL_UPRGT)); 818 aHdl.AddHdl(new SdrCropHdl(aRect.LeftCenter() ,HDL_LEFT )); 819 aHdl.AddHdl(new SdrCropHdl(aRect.RightCenter() ,HDL_RIGHT)); 820 aHdl.AddHdl(new SdrCropHdl(aRect.BottomLeft() ,HDL_LWLFT)); 821 aHdl.AddHdl(new SdrCropHdl(aRect.BottomCenter(),HDL_LOWER)); 822 aHdl.AddHdl(new SdrCropHdl(aRect.BottomRight() ,HDL_LWRGT)); 823 } 824 else 825 { 826 sal_Bool bWdt0=aRect.Left()==aRect.Right(); 827 sal_Bool bHgt0=aRect.Top()==aRect.Bottom(); 828 if (bWdt0 && bHgt0) 829 { 830 aHdl.AddHdl(new SdrHdl(aRect.TopLeft(),HDL_UPLFT)); 831 } 832 else if (!bStdDrag && (bWdt0 || bHgt0)) 833 { 834 aHdl.AddHdl(new SdrHdl(aRect.TopLeft() ,HDL_UPLFT)); 835 aHdl.AddHdl(new SdrHdl(aRect.BottomRight(),HDL_LWRGT)); 836 } 837 else 838 { 839 if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopLeft() ,HDL_UPLFT)); 840 if ( !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopCenter() ,HDL_UPPER)); 841 if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopRight() ,HDL_UPRGT)); 842 if (!bWdt0 ) aHdl.AddHdl(new SdrHdl(aRect.LeftCenter() ,HDL_LEFT )); 843 if (!bWdt0 ) aHdl.AddHdl(new SdrHdl(aRect.RightCenter() ,HDL_RIGHT)); 844 if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomLeft() ,HDL_LWLFT)); 845 if ( !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomCenter(),HDL_LOWER)); 846 if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomRight() ,HDL_LWRGT)); 847 } 848 } 849 } 850 } 851 else 852 { 853 for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) 854 { 855 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum); 856 SdrObject* pObj=pM->GetMarkedSdrObj(); 857 SdrPageView* pPV=pM->GetPageView(); 858 const sal_uIntPtr nSiz0=aHdl.GetHdlCount(); 859 pObj->AddToHdlList(aHdl); 860 const sal_uIntPtr nSiz1=aHdl.GetHdlCount(); 861 bool bPoly=pObj->IsPolyObj(); 862 const SdrUShortCont* pMrkPnts=pM->GetMarkedPoints(); 863 for (sal_uIntPtr i=nSiz0; i<nSiz1; i++) 864 { 865 SdrHdl* pHdl=aHdl.GetHdl(i); 866 pHdl->SetObj(pObj); 867 pHdl->SetPageView(pPV); 868 pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0)); 869 if (bPoly) 870 { 871 sal_Bool bSelected=pMrkPnts!=NULL && pMrkPnts->Exist(sal_uInt16(i-nSiz0)); 872 pHdl->SetSelected(bSelected); 873 //sal_Bool bPlus=bPlusHdlAlways; 874 if (bPlusHdlAlways || bSelected) 875 { 876 sal_uInt32 nPlusAnz=pObj->GetPlusHdlCount(*pHdl); 877 for (sal_uInt32 nPlusNum=0; nPlusNum<nPlusAnz; nPlusNum++) 878 { 879 SdrHdl* pPlusHdl=pObj->GetPlusHdl(*pHdl,nPlusNum); 880 if (pPlusHdl!=NULL) 881 { 882 pPlusHdl->SetObj(pObj); 883 pPlusHdl->SetPageView(pPV); 884 pPlusHdl->SetPlusHdl(sal_True); 885 aHdl.AddHdl(pPlusHdl); 886 } 887 } 888 } 889 } 890 } 891 } // for nMarkNum 892 } // if bFrmHdl else 893 894 // GluePoint-Handles 895 for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) 896 { 897 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum); 898 SdrObject* pObj=pM->GetMarkedSdrObj(); 899 SdrPageView* pPV=pM->GetPageView(); 900 const SdrUShortCont* pMrkGlue=pM->GetMarkedGluePoints(); 901 if (pMrkGlue!=NULL) 902 { 903 const SdrGluePointList* pGPL=pObj->GetGluePointList(); 904 if (pGPL!=NULL) 905 { 906 //sal_uInt16 nGlueAnz=pGPL->GetCount(); 907 sal_uInt16 nAnz=(sal_uInt16)pMrkGlue->GetCount(); 908 for (sal_uInt16 nNum=0; nNum<nAnz; nNum++) 909 { 910 sal_uInt16 nId=pMrkGlue->GetObject(nNum); 911 //nNum changed to nNumGP because already used in for loop 912 sal_uInt16 nNumGP=pGPL->FindGluePoint(nId); 913 if (nNumGP!=SDRGLUEPOINT_NOTFOUND) 914 { 915 const SdrGluePoint& rGP=(*pGPL)[nNumGP]; 916 Point aPos(rGP.GetAbsolutePos(*pObj)); 917 SdrHdl* pGlueHdl=new SdrHdl(aPos,HDL_GLUE); 918 pGlueHdl->SetObj(pObj); 919 pGlueHdl->SetPageView(pPV); 920 pGlueHdl->SetObjHdlNum(nId); 921 aHdl.AddHdl(pGlueHdl); 922 } 923 } 924 } 925 } 926 } 927 928 // Drehpunkt/Spiegelachse 929 AddDragModeHdl(eDragMode); 930 931 // sort handles 932 aHdl.Sort(); 933 934 // add custom handles (used by other apps, e.g. AnchorPos) 935 AddCustomHdl(); 936 937 // #105722# try to restore focus handle index from remembered values 938 if(bSaveOldFocus) 939 { 940 for(sal_uInt32 a(0); a < aHdl.GetHdlCount(); a++) 941 { 942 SdrHdl* pCandidate = aHdl.GetHdl(a); 943 944 if(pCandidate->GetObj() 945 && pCandidate->GetObj() == pSaveObj 946 && pCandidate->GetKind() == eSaveKind 947 && pCandidate->GetPolyNum() == nSavePolyNum 948 && pCandidate->GetPointNum() == nSavePointNum) 949 { 950 aHdl.SetFocusHdl(pCandidate); 951 break; 952 } 953 } 954 } 955 } 956 } 957 958 void SdrMarkView::AddCustomHdl() 959 { 960 // add custom handles (used by other apps, e.g. AnchorPos) 961 } 962 963 void SdrMarkView::SetDragMode(SdrDragMode eMode) 964 { 965 SdrDragMode eMode0=eDragMode; 966 eDragMode=eMode; 967 if (eDragMode==SDRDRAG_RESIZE) eDragMode=SDRDRAG_MOVE; 968 if (eDragMode!=eMode0) { 969 //HMHBOOL bVis=IsMarkHdlShown(); 970 //HMHif (bVis) HideMarkHdl(); 971 ForceRefToMarked(); 972 SetMarkHandles(); 973 //HMHif (bVis) ShowMarkHdl(); 974 { 975 if (AreObjectsMarked()) MarkListHasChanged(); 976 } 977 } 978 } 979 980 void SdrMarkView::AddDragModeHdl(SdrDragMode eMode) 981 { 982 switch(eMode) 983 { 984 case SDRDRAG_ROTATE: 985 { 986 // add rotation center 987 SdrHdl* pHdl = new SdrHdl(aRef1, HDL_REF1); 988 989 aHdl.AddHdl(pHdl); 990 991 break; 992 } 993 case SDRDRAG_MIRROR: 994 { 995 // add mirror axis 996 SdrHdl* pHdl3 = new SdrHdl(aRef2, HDL_REF2); 997 SdrHdl* pHdl2 = new SdrHdl(aRef1, HDL_REF1); 998 SdrHdl* pHdl1 = new SdrHdlLine(*pHdl2, *pHdl3, HDL_MIRX); 999 1000 pHdl1->SetObjHdlNum(1); // fuer Sortierung 1001 pHdl2->SetObjHdlNum(2); // fuer Sortierung 1002 pHdl3->SetObjHdlNum(3); // fuer Sortierung 1003 1004 aHdl.AddHdl(pHdl1); // Linie als erstes, damit als letztes im HitTest 1005 aHdl.AddHdl(pHdl2); 1006 aHdl.AddHdl(pHdl3); 1007 1008 break; 1009 } 1010 case SDRDRAG_TRANSPARENCE: 1011 { 1012 // add interactive transparence handle 1013 sal_uIntPtr nMarkAnz = GetMarkedObjectCount(); 1014 if(nMarkAnz == 1) 1015 { 1016 SdrObject* pObj = GetMarkedObjectByIndex(0); 1017 SdrModel* pModel = GetModel(); 1018 const SfxItemSet& rSet = pObj->GetMergedItemSet(); 1019 1020 if(SFX_ITEM_SET != rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, sal_False)) 1021 { 1022 // add this item, it's not yet there 1023 XFillFloatTransparenceItem aNewItem( 1024 (const XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE)); 1025 XGradient aGrad = aNewItem.GetGradientValue(); 1026 1027 aNewItem.SetEnabled(sal_True); 1028 aGrad.SetStartIntens(100); 1029 aGrad.SetEndIntens(100); 1030 aNewItem.SetGradientValue(aGrad); 1031 1032 // add undo to allow user to take back this step 1033 if( pModel->IsUndoEnabled() ) 1034 { 1035 pModel->BegUndo(SVX_RESSTR(SIP_XA_FILLTRANSPARENCE)); 1036 pModel->AddUndo(pModel->GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); 1037 pModel->EndUndo(); 1038 } 1039 1040 //pObj->SetItemAndBroadcast(aNewItem); 1041 SfxItemSet aNewSet(pModel->GetItemPool()); 1042 aNewSet.Put(aNewItem); 1043 pObj->SetMergedItemSetAndBroadcast(aNewSet); 1044 } 1045 1046 // set values and transform to vector set 1047 GradTransformer aGradTransformer; 1048 GradTransVector aGradTransVector; 1049 GradTransGradient aGradTransGradient; 1050 1051 aGradTransGradient.aGradient = ((XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE)).GetGradientValue(); 1052 aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, pObj); 1053 1054 // build handles 1055 const Point aTmpPos1(basegfx::fround(aGradTransVector.maPositionA.getX()), basegfx::fround(aGradTransVector.maPositionA.getY())); 1056 const Point aTmpPos2(basegfx::fround(aGradTransVector.maPositionB.getX()), basegfx::fround(aGradTransVector.maPositionB.getY())); 1057 SdrHdlColor* pColHdl1 = new SdrHdlColor(aTmpPos1, aGradTransVector.aCol1, SDR_HANDLE_COLOR_SIZE_NORMAL, sal_True); 1058 SdrHdlColor* pColHdl2 = new SdrHdlColor(aTmpPos2, aGradTransVector.aCol2, SDR_HANDLE_COLOR_SIZE_NORMAL, sal_True); 1059 SdrHdlGradient* pGradHdl = new SdrHdlGradient(aTmpPos1, aTmpPos2, sal_False); 1060 DBG_ASSERT(pColHdl1 && pColHdl2 && pGradHdl, "Got not all necessary handles!!"); 1061 1062 // link them 1063 pGradHdl->SetColorHandles(pColHdl1, pColHdl2); 1064 pGradHdl->SetObj(pObj); 1065 pColHdl1->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl)); 1066 pColHdl2->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl)); 1067 1068 // insert them 1069 aHdl.AddHdl(pColHdl1); 1070 aHdl.AddHdl(pColHdl2); 1071 aHdl.AddHdl(pGradHdl); 1072 } 1073 break; 1074 } 1075 case SDRDRAG_GRADIENT: 1076 { 1077 // add interactive gradient handle 1078 sal_uIntPtr nMarkAnz = GetMarkedObjectCount(); 1079 if(nMarkAnz == 1) 1080 { 1081 SdrObject* pObj = GetMarkedObjectByIndex(0); 1082 const SfxItemSet& rSet = pObj->GetMergedItemSet(); 1083 XFillStyle eFillStyle = ((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue(); 1084 1085 if(eFillStyle == XFILL_GRADIENT) 1086 { 1087 // set values and transform to vector set 1088 GradTransformer aGradTransformer; 1089 GradTransVector aGradTransVector; 1090 GradTransGradient aGradTransGradient; 1091 Size aHdlSize(15, 15); 1092 1093 aGradTransGradient.aGradient = ((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetGradientValue(); 1094 aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, pObj); 1095 1096 // build handles 1097 const Point aTmpPos1(basegfx::fround(aGradTransVector.maPositionA.getX()), basegfx::fround(aGradTransVector.maPositionA.getY())); 1098 const Point aTmpPos2(basegfx::fround(aGradTransVector.maPositionB.getX()), basegfx::fround(aGradTransVector.maPositionB.getY())); 1099 SdrHdlColor* pColHdl1 = new SdrHdlColor(aTmpPos1, aGradTransVector.aCol1, aHdlSize, sal_False); 1100 SdrHdlColor* pColHdl2 = new SdrHdlColor(aTmpPos2, aGradTransVector.aCol2, aHdlSize, sal_False); 1101 SdrHdlGradient* pGradHdl = new SdrHdlGradient(aTmpPos1, aTmpPos2, sal_True); 1102 DBG_ASSERT(pColHdl1 && pColHdl2 && pGradHdl, "Got not all necessary handles!!"); 1103 1104 // link them 1105 pGradHdl->SetColorHandles(pColHdl1, pColHdl2); 1106 pGradHdl->SetObj(pObj); 1107 pColHdl1->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl)); 1108 pColHdl2->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl)); 1109 1110 // insert them 1111 aHdl.AddHdl(pColHdl1); 1112 aHdl.AddHdl(pColHdl2); 1113 aHdl.AddHdl(pGradHdl); 1114 } 1115 } 1116 break; 1117 } 1118 case SDRDRAG_CROP: 1119 { 1120 // todo 1121 break; 1122 } 1123 default: break; 1124 } 1125 } 1126 1127 /** handle mouse over effects for handles */ 1128 sal_Bool SdrMarkView::MouseMove(const MouseEvent& rMEvt, Window* pWin) 1129 { 1130 if(aHdl.GetHdlCount()) 1131 { 1132 SdrHdl* pMouseOverHdl = 0; 1133 if( !rMEvt.IsLeaveWindow() && pWin ) 1134 { 1135 Point aMDPos( pWin->PixelToLogic( rMEvt.GetPosPixel() ) ); 1136 pMouseOverHdl = PickHandle(aMDPos); 1137 } 1138 1139 // notify last mouse over handle that he lost the mouse 1140 const sal_uIntPtr nHdlCount = aHdl.GetHdlCount(); 1141 1142 for(sal_uIntPtr nHdl = 0; nHdl < nHdlCount; nHdl++ ) 1143 { 1144 SdrHdl* pCurrentHdl = GetHdl(nHdl); 1145 if( pCurrentHdl->mbMouseOver ) 1146 { 1147 if( pCurrentHdl != pMouseOverHdl ) 1148 { 1149 pCurrentHdl->mbMouseOver = false; 1150 pCurrentHdl->onMouseLeave(); 1151 } 1152 break; 1153 } 1154 } 1155 1156 // notify current mouse over handle 1157 if( pMouseOverHdl /* && !pMouseOverHdl->mbMouseOver */ ) 1158 { 1159 pMouseOverHdl->mbMouseOver = true; 1160 pMouseOverHdl->onMouseEnter(rMEvt); 1161 } 1162 } 1163 return SdrSnapView::MouseMove(rMEvt, pWin); 1164 } 1165 1166 void SdrMarkView::ForceRefToMarked() 1167 { 1168 switch(eDragMode) 1169 { 1170 case SDRDRAG_ROTATE: 1171 { 1172 Rectangle aR(GetMarkedObjRect()); 1173 aRef1 = aR.Center(); 1174 1175 break; 1176 } 1177 1178 case SDRDRAG_MIRROR: 1179 { 1180 // Erstmal die laenge der Spiegelachsenlinie berechnen 1181 long nOutMin=0; 1182 long nOutMax=0; 1183 long nMinLen=0; 1184 long nObjDst=0; 1185 long nOutHgt=0; 1186 OutputDevice* pOut=GetFirstOutputDevice(); 1187 //OutputDevice* pOut=GetWin(0); 1188 if (pOut!=NULL) { 1189 // Mindestlaenge 50 Pixel 1190 nMinLen=pOut->PixelToLogic(Size(0,50)).Height(); 1191 // 20 Pixel fuer RefPt-Abstand vom Obj 1192 nObjDst=pOut->PixelToLogic(Size(0,20)).Height(); 1193 // MinY/MaxY 1194 // Abstand zum Rand = Mindestlaenge = 10 Pixel 1195 long nDst=pOut->PixelToLogic(Size(0,10)).Height(); 1196 nOutMin=-pOut->GetMapMode().GetOrigin().Y(); 1197 nOutMax=pOut->GetOutputSize().Height()-1+nOutMin; 1198 nOutMin+=nDst; 1199 nOutMax-=nDst; 1200 // Absolute Mindestlaenge jedoch 10 Pixel 1201 if (nOutMax-nOutMin<nDst) { 1202 nOutMin+=nOutMax+1; 1203 nOutMin/=2; 1204 nOutMin-=(nDst+1)/2; 1205 nOutMax=nOutMin+nDst; 1206 } 1207 nOutHgt=nOutMax-nOutMin; 1208 // Sonst Mindestlaenge = 1/4 OutHgt 1209 long nTemp=nOutHgt/4; 1210 if (nTemp>nMinLen) nMinLen=nTemp; 1211 } 1212 1213 Rectangle aR(GetMarkedObjBoundRect()); 1214 Point aCenter(aR.Center()); 1215 long nMarkHgt=aR.GetHeight()-1; 1216 long nHgt=nMarkHgt+nObjDst*2; // 20 Pixel obej und unten ueberstehend 1217 if (nHgt<nMinLen) nHgt=nMinLen; // Mindestlaenge 50 Pixel bzw. 1/4 OutHgt 1218 1219 long nY1=aCenter.Y()-(nHgt+1)/2; 1220 long nY2=nY1+nHgt; 1221 1222 if (pOut!=NULL && nMinLen>nOutHgt) nMinLen=nOutHgt; // evtl. noch etwas verkuerzen 1223 1224 if (pOut!=NULL) { // nun vollstaendig in den sichtbaren Bereich schieben 1225 if (nY1<nOutMin) { 1226 nY1=nOutMin; 1227 if (nY2<nY1+nMinLen) nY2=nY1+nMinLen; 1228 } 1229 if (nY2>nOutMax) { 1230 nY2=nOutMax; 1231 if (nY1>nY2-nMinLen) nY1=nY2-nMinLen; 1232 } 1233 } 1234 1235 aRef1.X()=aCenter.X(); 1236 aRef1.Y()=nY1; 1237 aRef2.X()=aCenter.X(); 1238 aRef2.Y()=nY2; 1239 1240 break; 1241 } 1242 1243 case SDRDRAG_TRANSPARENCE: 1244 case SDRDRAG_GRADIENT: 1245 case SDRDRAG_CROP: 1246 { 1247 Rectangle aRect(GetMarkedObjBoundRect()); 1248 aRef1 = aRect.TopLeft(); 1249 aRef2 = aRect.BottomRight(); 1250 break; 1251 } 1252 default: break; 1253 } 1254 } 1255 1256 void SdrMarkView::SetRef1(const Point& rPt) 1257 { 1258 if(eDragMode == SDRDRAG_ROTATE || eDragMode == SDRDRAG_MIRROR) 1259 { 1260 aRef1 = rPt; 1261 SdrHdl* pH = aHdl.GetHdl(HDL_REF1); 1262 if(pH) 1263 pH->SetPos(rPt); 1264 //HMHShowMarkHdl(); 1265 } 1266 } 1267 1268 void SdrMarkView::SetRef2(const Point& rPt) 1269 { 1270 if(eDragMode == SDRDRAG_MIRROR) 1271 { 1272 aRef2 = rPt; 1273 SdrHdl* pH = aHdl.GetHdl(HDL_REF2); 1274 if(pH) 1275 pH->SetPos(rPt); 1276 //HMHShowMarkHdl(); 1277 } 1278 } 1279 1280 void SdrMarkView::CheckMarked() 1281 { 1282 for (sal_uIntPtr nm=GetMarkedObjectCount(); nm>0;) { 1283 nm--; 1284 SdrMark* pM=GetSdrMarkByIndex(nm); 1285 SdrObject* pObj=pM->GetMarkedSdrObj(); 1286 SdrPageView* pPV=pM->GetPageView(); 1287 SdrLayerID nLay=pObj->GetLayer(); 1288 sal_Bool bRaus=!pObj->IsInserted(); // Obj geloescht? 1289 if (!pObj->Is3DObj()) { 1290 bRaus=bRaus || pObj->GetPage()!=pPV->GetPage(); // Obj ploetzlich in anderer Page oder Group 1291 } 1292 bRaus=bRaus || pPV->GetLockedLayers().IsSet(nLay) || // Layer gesperrt? 1293 !pPV->GetVisibleLayers().IsSet(nLay); // Layer nicht sichtbar? 1294 1295 if( !bRaus ) 1296 bRaus = !pObj->IsVisible(); // not visible objects can not be marked 1297 1298 if (!bRaus) { 1299 // Joe am 9.3.1997: Gruppierte Objekten koennen nun auch 1300 // markiert werden. Nach EnterGroup muessen aber die Objekte 1301 // der hoeheren Ebene deselektiert werden. 1302 const SdrObjList* pOOL=pObj->GetObjList(); 1303 const SdrObjList* pVOL=pPV->GetObjList(); 1304 while (pOOL!=NULL && pOOL!=pVOL) { 1305 pOOL=pOOL->GetUpList(); 1306 } 1307 bRaus=pOOL!=pVOL; 1308 } 1309 1310 if (bRaus) 1311 { 1312 GetMarkedObjectListWriteAccess().DeleteMark(nm); 1313 } 1314 else 1315 { 1316 if (!IsGluePointEditMode()) { // Markierte GluePoints nur im GlueEditMode 1317 SdrUShortCont* pPts=pM->GetMarkedGluePoints(); 1318 if (pPts!=NULL && pPts->GetCount()!=0) { 1319 pPts->Clear(); 1320 } 1321 } 1322 } 1323 } 1324 1325 // #97995# at least reset the remembered BoundRect to prevent handle 1326 // generation if bForceFrameHandles is TRUE. 1327 bMarkedObjRectDirty = sal_True; 1328 } 1329 1330 void SdrMarkView::SetMarkRects() 1331 { 1332 SdrPageView* pPV = GetSdrPageView(); 1333 1334 if(pPV) 1335 { 1336 pPV->SetHasMarkedObj(GetSnapRectFromMarkedObjects(pPV, pPV->MarkSnap())); 1337 GetBoundRectFromMarkedObjects(pPV, pPV->MarkBound()); 1338 } 1339 } 1340 1341 void SdrMarkView::SetFrameHandles(sal_Bool bOn) 1342 { 1343 if (bOn!=bForceFrameHandles) { 1344 sal_Bool bOld=ImpIsFrameHandles(); 1345 bForceFrameHandles=bOn; 1346 sal_Bool bNew=ImpIsFrameHandles(); 1347 if (bNew!=bOld) { 1348 AdjustMarkHdl(); //HMHTRUE); 1349 MarkListHasChanged(); 1350 } 1351 } 1352 } 1353 1354 void SdrMarkView::SetEditMode(SdrViewEditMode eMode) 1355 { 1356 if (eMode!=eEditMode) { 1357 sal_Bool bGlue0=eEditMode==SDREDITMODE_GLUEPOINTEDIT; 1358 sal_Bool bEdge0=((SdrCreateView*)this)->IsEdgeTool(); 1359 eEditMode0=eEditMode; 1360 eEditMode=eMode; 1361 sal_Bool bGlue1=eEditMode==SDREDITMODE_GLUEPOINTEDIT; 1362 sal_Bool bEdge1=((SdrCreateView*)this)->IsEdgeTool(); 1363 // etwas Aufwand um Flackern zu verhindern beim Umschalten 1364 // zwischen GlueEdit und EdgeTool 1365 if (bGlue1 && !bGlue0) ImpSetGlueVisible2(bGlue1); 1366 if (bEdge1!=bEdge0) ImpSetGlueVisible3(bEdge1); 1367 if (!bGlue1 && bGlue0) ImpSetGlueVisible2(bGlue1); 1368 if (bGlue0 && !bGlue1) UnmarkAllGluePoints(); 1369 } 1370 } 1371 1372 //////////////////////////////////////////////////////////////////////////////////////////////////// 1373 1374 sal_Bool SdrMarkView::IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const 1375 { 1376 if (pObj) 1377 { 1378 if (pObj->IsMarkProtect() || 1379 (!bDesignMode && pObj->IsUnoObj())) 1380 { 1381 // Objekt nicht selektierbar oder 1382 // SdrUnoObj nicht im DesignMode 1383 return sal_False; 1384 } 1385 } 1386 return pPV!=NULL ? pPV->IsObjMarkable(pObj) : sal_True; 1387 } 1388 1389 sal_Bool SdrMarkView::IsMarkedObjHit(const Point& rPnt, short nTol) const 1390 { 1391 sal_Bool bRet=sal_False; 1392 nTol=ImpGetHitTolLogic(nTol,NULL); 1393 Point aPt(rPnt); 1394 for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount() && !bRet; nm++) { 1395 SdrMark* pM=GetSdrMarkByIndex(nm); 1396 bRet = 0 != CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0,0); 1397 } 1398 return bRet; 1399 } 1400 1401 SdrHdl* SdrMarkView::PickHandle(const Point& rPnt, sal_uIntPtr nOptions, SdrHdl* pHdl0) const 1402 { 1403 if (bSomeObjChgdFlag) { // ggf. Handles neu berechnen lassen! 1404 FlushComeBackTimer(); 1405 } 1406 sal_Bool bBack=(nOptions & SDRSEARCH_BACKWARD) !=0; 1407 sal_Bool bNext=(nOptions & SDRSEARCH_NEXT) !=0; 1408 Point aPt(rPnt); 1409 return aHdl.IsHdlListHit(aPt,bBack,bNext,pHdl0); 1410 } 1411 1412 sal_Bool SdrMarkView::MarkObj(const Point& rPnt, short nTol, sal_Bool bToggle, sal_Bool bDeep) 1413 { 1414 SdrObject* pObj; 1415 SdrPageView* pPV; 1416 nTol=ImpGetHitTolLogic(nTol,NULL); 1417 sal_uIntPtr nOptions=SDRSEARCH_PICKMARKABLE; 1418 if (bDeep) nOptions=nOptions|SDRSEARCH_DEEP; 1419 sal_Bool bRet=PickObj(rPnt,(sal_uInt16)nTol,pObj,pPV,nOptions); 1420 if (bRet) { 1421 sal_Bool bUnmark=bToggle && IsObjMarked(pObj); 1422 MarkObj(pObj,pPV,bUnmark); 1423 } 1424 return bRet; 1425 } 1426 1427 sal_Bool SdrMarkView::MarkNextObj(sal_Bool bPrev) 1428 { 1429 SdrPageView* pPageView = GetSdrPageView(); 1430 1431 if(!pPageView) 1432 { 1433 return sal_False; 1434 } 1435 1436 SortMarkedObjects(); 1437 sal_uIntPtr nMarkAnz=GetMarkedObjectCount(); 1438 sal_uIntPtr nChgMarkNum = ULONG_MAX; // Nummer des zu ersetzenden MarkEntries 1439 sal_uIntPtr nSearchObjNum = bPrev ? 0 : ULONG_MAX; 1440 if (nMarkAnz!=0) { 1441 nChgMarkNum=bPrev ? 0 : sal_uIntPtr(nMarkAnz-1); 1442 SdrMark* pM=GetSdrMarkByIndex(nChgMarkNum); 1443 OSL_ASSERT(pM!=NULL); 1444 if (pM->GetMarkedSdrObj() != NULL) 1445 nSearchObjNum = pM->GetMarkedSdrObj()->GetNavigationPosition(); 1446 } 1447 1448 SdrObject* pMarkObj=NULL; 1449 SdrObjList* pSearchObjList=pPageView->GetObjList(); 1450 sal_uIntPtr nObjAnz=pSearchObjList->GetObjCount(); 1451 if (nObjAnz!=0) { 1452 if (nSearchObjNum>nObjAnz) nSearchObjNum=nObjAnz; 1453 while (pMarkObj==NULL && ((!bPrev && nSearchObjNum>0) || (bPrev && nSearchObjNum<nObjAnz))) 1454 { 1455 if (!bPrev) 1456 nSearchObjNum--; 1457 SdrObject* pSearchObj = pSearchObjList->GetObjectForNavigationPosition(nSearchObjNum); 1458 if (IsObjMarkable(pSearchObj,pPageView)) 1459 { 1460 if (TryToFindMarkedObject(pSearchObj)==CONTAINER_ENTRY_NOTFOUND) 1461 { 1462 pMarkObj=pSearchObj; 1463 } 1464 } 1465 if (bPrev) nSearchObjNum++; 1466 } 1467 } 1468 1469 if(!pMarkObj) 1470 { 1471 return sal_False; 1472 } 1473 1474 if (nChgMarkNum!=ULONG_MAX) 1475 { 1476 GetMarkedObjectListWriteAccess().DeleteMark(nChgMarkNum); 1477 } 1478 MarkObj(pMarkObj,pPageView); // ruft auch MarkListHasChanged(), AdjustMarkHdl() 1479 return sal_True; 1480 } 1481 1482 sal_Bool SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, sal_Bool bPrev) 1483 { 1484 SortMarkedObjects(); 1485 nTol=ImpGetHitTolLogic(nTol,NULL); 1486 Point aPt(rPnt); 1487 SdrMark* pTopMarkHit=NULL; 1488 SdrMark* pBtmMarkHit=NULL; 1489 sal_uIntPtr nTopMarkHit=0; 1490 sal_uIntPtr nBtmMarkHit=0; 1491 // oberstes der markierten Objekte suchen, das von rPnt getroffen wird 1492 sal_uIntPtr nMarkAnz=GetMarkedObjectCount(); 1493 sal_uIntPtr nm=0; 1494 for (nm=nMarkAnz; nm>0 && pTopMarkHit==NULL;) { 1495 nm--; 1496 SdrMark* pM=GetSdrMarkByIndex(nm); 1497 if(CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0,0)) 1498 { 1499 pTopMarkHit=pM; 1500 nTopMarkHit=nm; 1501 } 1502 } 1503 // Nichts gefunden, dann ganz normal ein Obj markieren. 1504 if (pTopMarkHit==NULL) return MarkObj(rPnt,sal_uInt16(nTol),sal_False); 1505 1506 SdrObject* pTopObjHit=pTopMarkHit->GetMarkedSdrObj(); 1507 SdrObjList* pObjList=pTopObjHit->GetObjList(); 1508 SdrPageView* pPV=pTopMarkHit->GetPageView(); 1509 // unterstes der markierten Objekte suchen, das von rPnt getroffen wird 1510 // und auf der gleichen PageView liegt wie pTopMarkHit 1511 for (nm=0; nm<nMarkAnz && pBtmMarkHit==NULL; nm++) { 1512 SdrMark* pM=GetSdrMarkByIndex(nm); 1513 SdrPageView* pPV2=pM->GetPageView(); 1514 if (pPV2==pPV && CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pPV2,0,0)) 1515 { 1516 pBtmMarkHit=pM; 1517 nBtmMarkHit=nm; 1518 } 1519 } 1520 if (pBtmMarkHit==NULL) { pBtmMarkHit=pTopMarkHit; nBtmMarkHit=nTopMarkHit; } 1521 SdrObject* pBtmObjHit=pBtmMarkHit->GetMarkedSdrObj(); 1522 sal_uIntPtr nObjAnz=pObjList->GetObjCount(); 1523 1524 // #110988# 1525 //sal_uIntPtr nSearchBeg=bPrev ? pBtmObjHit->GetOrdNum()+1 : pTopObjHit->GetOrdNum(); 1526 sal_uInt32 nSearchBeg; 1527 E3dScene* pScene = NULL; 1528 SdrObject* pObjHit = (bPrev) ? pBtmObjHit : pTopObjHit; 1529 sal_Bool bRemap = pObjHit->ISA(E3dCompoundObject) 1530 ? ((E3dCompoundObject*)pObjHit)->IsAOrdNumRemapCandidate(pScene) 1531 : sal_False; 1532 1533 if(bPrev) 1534 { 1535 sal_uInt32 nOrdNumBtm(pBtmObjHit->GetOrdNum()); 1536 1537 if(bRemap) 1538 { 1539 nOrdNumBtm = pScene->RemapOrdNum(nOrdNumBtm); 1540 } 1541 1542 nSearchBeg = nOrdNumBtm + 1; 1543 } 1544 else 1545 { 1546 sal_uInt32 nOrdNumTop(pTopObjHit->GetOrdNum()); 1547 1548 if(bRemap) 1549 { 1550 nOrdNumTop = pScene->RemapOrdNum(nOrdNumTop); 1551 } 1552 1553 nSearchBeg = nOrdNumTop; 1554 } 1555 1556 sal_uIntPtr no=nSearchBeg; 1557 SdrObject* pFndObj=NULL; 1558 //SdrObject* pAktObj=NULL; 1559 while (pFndObj==NULL && ((!bPrev && no>0) || (bPrev && no<nObjAnz))) { 1560 if (!bPrev) no--; 1561 SdrObject* pObj; 1562 1563 if(bRemap) 1564 { 1565 pObj = pObjList->GetObj(pScene->RemapOrdNum(no)); 1566 } 1567 else 1568 { 1569 pObj = pObjList->GetObj(no); 1570 } 1571 1572 if (CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pObj,pPV,SDRSEARCH_TESTMARKABLE,0)) 1573 { 1574 if (TryToFindMarkedObject(pObj)==CONTAINER_ENTRY_NOTFOUND) { 1575 pFndObj=pObj; 1576 } else { 1577 // hier wg. Performance ggf. noch no auf Top bzw. auf Btm stellen 1578 } 1579 } 1580 if (bPrev) no++; 1581 } 1582 if (pFndObj!=NULL) 1583 { 1584 GetMarkedObjectListWriteAccess().DeleteMark(bPrev?nBtmMarkHit:nTopMarkHit); 1585 GetMarkedObjectListWriteAccess().InsertEntry(SdrMark(pFndObj,pPV)); 1586 MarkListHasChanged(); 1587 AdjustMarkHdl(); //HMHTRUE); 1588 } 1589 return pFndObj!=NULL; 1590 } 1591 1592 sal_Bool SdrMarkView::MarkObj(const Rectangle& rRect, sal_Bool bUnmark) 1593 { 1594 sal_Bool bFnd=sal_False; 1595 Rectangle aR(rRect); 1596 SdrObject* pObj; 1597 SdrObjList* pObjList; 1598 BrkAction(); 1599 SdrPageView* pPV = GetSdrPageView(); 1600 1601 if(pPV) 1602 { 1603 pObjList=pPV->GetObjList(); 1604 Rectangle aFrm1(aR); 1605 sal_uIntPtr nObjAnz=pObjList->GetObjCount(); 1606 for (sal_uIntPtr nO=0; nO<nObjAnz; nO++) { 1607 pObj=pObjList->GetObj(nO); 1608 Rectangle aRect(pObj->GetCurrentBoundRect()); 1609 if (aFrm1.IsInside(aRect)) { 1610 if (!bUnmark) { 1611 if (IsObjMarkable(pObj,pPV)) 1612 { 1613 GetMarkedObjectListWriteAccess().InsertEntry(SdrMark(pObj,pPV)); 1614 bFnd=sal_True; 1615 } 1616 } else { 1617 sal_uIntPtr nPos=TryToFindMarkedObject(pObj); 1618 if (nPos!=CONTAINER_ENTRY_NOTFOUND) 1619 { 1620 GetMarkedObjectListWriteAccess().DeleteMark(nPos); 1621 bFnd=sal_True; 1622 } 1623 } 1624 } 1625 } 1626 } 1627 if (bFnd) { 1628 SortMarkedObjects(); 1629 MarkListHasChanged(); 1630 AdjustMarkHdl(); //HMHTRUE); 1631 //HMHShowMarkHdl(); 1632 } 1633 return bFnd; 1634 } 1635 1636 void SdrMarkView::MarkObj(SdrObject* pObj, SdrPageView* pPV, sal_Bool bUnmark, sal_Bool bImpNoSetMarkHdl) 1637 { 1638 if (pObj!=NULL && pPV!=NULL && IsObjMarkable(pObj, pPV)) { 1639 BrkAction(); 1640 if (!bUnmark) 1641 { 1642 GetMarkedObjectListWriteAccess().InsertEntry(SdrMark(pObj,pPV)); 1643 } 1644 else 1645 { 1646 sal_uIntPtr nPos=TryToFindMarkedObject(pObj); 1647 if (nPos!=CONTAINER_ENTRY_NOTFOUND) 1648 { 1649 GetMarkedObjectListWriteAccess().DeleteMark(nPos); 1650 } 1651 } 1652 if (!bImpNoSetMarkHdl) { 1653 MarkListHasChanged(); 1654 AdjustMarkHdl(); //HMHTRUE); 1655 //HMHif (!bSomeObjChgdFlag) { 1656 // ShowMarkHdl kommt sonst mit dem AfterPaintTimer 1657 //HMHShowMarkHdl(); 1658 //HMH} 1659 } 1660 } 1661 } 1662 1663 sal_Bool SdrMarkView::IsObjMarked(SdrObject* pObj) const 1664 { 1665 // nicht so ganz die feine Art: Da FindObject() nicht const ist 1666 // muss ich mich hier auf non-const casten. 1667 sal_uIntPtr nPos=((SdrMarkView*)this)->TryToFindMarkedObject(pObj); 1668 return nPos!=CONTAINER_ENTRY_NOTFOUND; 1669 } 1670 1671 sal_uInt16 SdrMarkView::GetMarkHdlSizePixel() const 1672 { 1673 return aHdl.GetHdlSize()*2+1; 1674 } 1675 1676 void SdrMarkView::SetSolidMarkHdl(sal_Bool bOn) 1677 { 1678 if (bOn!=aHdl.IsFineHdl()) { 1679 //HMHBOOL bMerk=IsMarkHdlShown(); 1680 //HMHif (bMerk) HideMarkHdl(); 1681 aHdl.SetFineHdl(bOn); 1682 //HMHif (bMerk) ShowMarkHdl(); 1683 } 1684 } 1685 1686 void SdrMarkView::SetMarkHdlSizePixel(sal_uInt16 nSiz) 1687 { 1688 if (nSiz<3) nSiz=3; 1689 nSiz/=2; 1690 if (nSiz!=aHdl.GetHdlSize()) { 1691 //HMHBOOL bMerk=IsMarkHdlShown(); 1692 //HMHif (bMerk) HideMarkHdl(); 1693 aHdl.SetHdlSize(nSiz); 1694 //HMHif (bMerk) ShowMarkHdl(); 1695 } 1696 } 1697 1698 #define SDRSEARCH_IMPISMASTER 0x80000000 /* MasterPage wird gerade durchsucht */ 1699 SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, sal_uIntPtr nOptions, const SetOfByte* pMVisLay) const 1700 { 1701 if(((nOptions & SDRSEARCH_IMPISMASTER) && pObj->IsNotVisibleAsMaster()) || (!pObj->IsVisible())) 1702 { 1703 return NULL; 1704 } 1705 1706 const bool bCheckIfMarkable(nOptions & SDRSEARCH_TESTMARKABLE); 1707 const bool bDeep(nOptions & SDRSEARCH_DEEP); 1708 const bool bOLE(pObj->ISA(SdrOle2Obj)); 1709 const bool bTXT(pObj->ISA(SdrTextObj) && ((SdrTextObj*)pObj)->IsTextFrame()); 1710 SdrObject* pRet=NULL; 1711 Rectangle aRect(pObj->GetCurrentBoundRect()); 1712 sal_uInt16 nTol2(nTol); 1713 1714 // double tolerance for OLE, text frames and objects in 1715 // active text edit 1716 if(bOLE || bTXT || pObj==((SdrObjEditView*)this)->GetTextEditObject()) 1717 { 1718 nTol2*=2; 1719 } 1720 1721 aRect.Left ()-=nTol2; // Einmal Toleranz drauf fuer alle Objekte 1722 aRect.Top ()-=nTol2; 1723 aRect.Right ()+=nTol2; 1724 aRect.Bottom()+=nTol2; 1725 1726 if (aRect.IsInside(rPnt)) 1727 { 1728 if ((!bCheckIfMarkable || IsObjMarkable(pObj,pPV))) 1729 { 1730 SdrObjList* pOL=pObj->GetSubList(); 1731 1732 if (pOL!=NULL && pOL->GetObjCount()!=0) 1733 { 1734 SdrObject* pTmpObj; 1735 // OD 30.06.2003 #108784# - adjustment hit point for virtual 1736 // objects. 1737 Point aPnt( rPnt ); 1738 1739 if ( pObj->ISA(SdrVirtObj) ) 1740 { 1741 Point aOffset = static_cast<SdrVirtObj*>(pObj)->GetOffset(); 1742 aPnt.Move( -aOffset.X(), -aOffset.Y() ); 1743 } 1744 1745 pRet=CheckSingleSdrObjectHit(aPnt,nTol,pOL,pPV,nOptions,pMVisLay,pTmpObj); 1746 } 1747 else 1748 { 1749 if(!pMVisLay || pMVisLay->IsSet(pObj->GetLayer())) 1750 { 1751 pRet = SdrObjectPrimitiveHit(*pObj, rPnt, nTol2, *pPV, &pPV->GetVisibleLayers(), false); 1752 } 1753 } 1754 } 1755 } 1756 1757 if (!bDeep && pRet!=NULL) 1758 { 1759 pRet=pObj; 1760 } 1761 1762 return pRet; 1763 } 1764 1765 SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList* pOL, SdrPageView* pPV, sal_uIntPtr nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const 1766 { 1767 sal_Bool bBack=(nOptions & SDRSEARCH_BACKWARD)!=0; 1768 SdrObject* pRet=NULL; 1769 rpRootObj=NULL; 1770 if (pOL!=NULL) 1771 { 1772 // #110988# 1773 sal_Bool bRemap(pOL->GetOwnerObj() && pOL->GetOwnerObj()->ISA(E3dScene)); 1774 E3dScene* pRemapScene = (bRemap ? (E3dScene*)pOL->GetOwnerObj() : 0L); 1775 1776 sal_uIntPtr nObjAnz=pOL->GetObjCount(); 1777 sal_uIntPtr nObjNum=bBack ? 0 : nObjAnz; 1778 while (pRet==NULL && (bBack ? nObjNum<nObjAnz : nObjNum>0)) { 1779 if (!bBack) nObjNum--; 1780 SdrObject* pObj; 1781 1782 // #110988# 1783 if(bRemap) 1784 { 1785 pObj = pOL->GetObj(pRemapScene->RemapOrdNum(nObjNum)); 1786 } 1787 else 1788 { 1789 pObj = pOL->GetObj(nObjNum); 1790 } 1791 1792 pRet=CheckSingleSdrObjectHit(rPnt,nTol,pObj,pPV,nOptions,pMVisLay); 1793 if (pRet!=NULL) rpRootObj=pObj; 1794 if (bBack) nObjNum++; 1795 } 1796 } 1797 return pRet; 1798 } 1799 1800 sal_Bool SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions) const 1801 { 1802 return PickObj(rPnt,nTol,rpObj,rpPV,nOptions,NULL,NULL,NULL); 1803 } 1804 1805 sal_Bool SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions, SdrObject** ppRootObj, sal_uIntPtr* pnMarkNum, sal_uInt16* pnPassNum) const 1806 { // Fehlt noch Pass2,Pass3 1807 SortMarkedObjects(); 1808 if (ppRootObj!=NULL) *ppRootObj=NULL; 1809 if (pnMarkNum!=NULL) *pnMarkNum=CONTAINER_ENTRY_NOTFOUND; 1810 if (pnPassNum!=NULL) *pnPassNum=0; 1811 rpObj=NULL; 1812 rpPV=NULL; 1813 sal_Bool bWholePage=(nOptions & SDRSEARCH_WHOLEPAGE) !=0; 1814 sal_Bool bMarked=(nOptions & SDRSEARCH_MARKED) !=0; 1815 sal_Bool bMasters=!bMarked && (nOptions & SDRSEARCH_ALSOONMASTER) !=0; 1816 sal_Bool bBack=(nOptions & SDRSEARCH_BACKWARD) !=0; 1817 #if OSL_DEBUG_LEVEL > 0 1818 sal_Bool bNext=(nOptions & SDRSEARCH_NEXT) !=0; (void)bNext; // n.i. 1819 sal_Bool bBoundCheckOn2ndPass=(nOptions & SDRSEARCH_PASS2BOUND) !=0; (void)bBoundCheckOn2ndPass;// n.i. 1820 sal_Bool bCheckNearestOn3rdPass=(nOptions & SDRSEARCH_PASS3NEAREST) !=0; (void)bCheckNearestOn3rdPass;// n.i. 1821 #endif 1822 if (nTol<0) nTol=ImpGetHitTolLogic(nTol,NULL); 1823 Point aPt(rPnt); 1824 SdrObject* pObj=NULL; 1825 SdrObject* pHitObj=NULL; 1826 SdrPageView* pPV=NULL; 1827 if (!bBack && ((SdrObjEditView*)this)->IsTextEditFrameHit(rPnt)) { 1828 pObj=((SdrObjEditView*)this)->GetTextEditObject(); 1829 pHitObj=pObj; 1830 pPV=((SdrObjEditView*)this)->GetTextEditPageView(); 1831 } 1832 if (bMarked) { 1833 sal_uIntPtr nMrkAnz=GetMarkedObjectCount(); 1834 sal_uIntPtr nMrkNum=bBack ? 0 : nMrkAnz; 1835 while (pHitObj==NULL && (bBack ? nMrkNum<nMrkAnz : nMrkNum>0)) { 1836 if (!bBack) nMrkNum--; 1837 SdrMark* pM=GetSdrMarkByIndex(nMrkNum); 1838 pObj=pM->GetMarkedSdrObj(); 1839 pPV=pM->GetPageView(); 1840 pHitObj=CheckSingleSdrObjectHit(aPt,nTol,pObj,pPV,nOptions,NULL); 1841 if (bBack) nMrkNum++; 1842 } 1843 } 1844 else 1845 { 1846 pPV = GetSdrPageView(); 1847 1848 if(pPV) 1849 { 1850 SdrPage* pPage=pPV->GetPage(); 1851 sal_uInt16 nPgAnz=1; 1852 1853 if(bMasters && pPage->TRG_HasMasterPage()) 1854 { 1855 nPgAnz++; 1856 } 1857 1858 sal_Bool bExtraPassForWholePage=bWholePage && pPage!=pPV->GetObjList(); 1859 if (bExtraPassForWholePage) nPgAnz++; // Suche erst in AktObjList, dann auf der gesamten Page 1860 sal_uInt16 nPgNum=bBack ? 0 : nPgAnz; 1861 while (pHitObj==NULL && (bBack ? nPgNum<nPgAnz : nPgNum>0)) { 1862 sal_uIntPtr nTmpOptions=nOptions; 1863 if (!bBack) nPgNum--; 1864 const SetOfByte* pMVisLay=NULL; 1865 SdrObjList* pObjList=NULL; 1866 if (pnPassNum!=NULL) *pnPassNum&=~(SDRSEARCHPASS_MASTERPAGE|SDRSEARCHPASS_INACTIVELIST); 1867 if (nPgNum>=nPgAnz-1 || (bExtraPassForWholePage && nPgNum>=nPgAnz-2)) 1868 { 1869 pObjList=pPV->GetObjList(); 1870 if (bExtraPassForWholePage && nPgNum==nPgAnz-2) { 1871 pObjList=pPage; 1872 if (pnPassNum!=NULL) *pnPassNum|=SDRSEARCHPASS_INACTIVELIST; 1873 } 1874 } 1875 else 1876 { 1877 // sonst MasterPage 1878 SdrPage& rMasterPage = pPage->TRG_GetMasterPage(); 1879 pMVisLay = &pPage->TRG_GetMasterPageVisibleLayers(); 1880 pObjList = &rMasterPage; 1881 1882 if (pnPassNum!=NULL) *pnPassNum|=SDRSEARCHPASS_MASTERPAGE; 1883 nTmpOptions=nTmpOptions | SDRSEARCH_IMPISMASTER; 1884 } 1885 pHitObj=CheckSingleSdrObjectHit(aPt,nTol,pObjList,pPV,nTmpOptions,pMVisLay,pObj); 1886 if (bBack) nPgNum++; 1887 } 1888 } 1889 } 1890 if (pHitObj!=NULL) { 1891 if (ppRootObj!=NULL) *ppRootObj=pObj; 1892 if ((nOptions & SDRSEARCH_DEEP) !=0) pObj=pHitObj; 1893 if ((nOptions & SDRSEARCH_TESTTEXTEDIT) !=0) { 1894 if (!pObj->HasTextEdit() || pPV->GetLockedLayers().IsSet(pObj->GetLayer())) { 1895 pObj=NULL; 1896 } 1897 } 1898 if (pObj!=NULL && (nOptions & SDRSEARCH_TESTMACRO) !=0) { 1899 SdrObjMacroHitRec aHitRec; 1900 aHitRec.aPos=aPt; 1901 aHitRec.aDownPos=aPt; 1902 aHitRec.nTol=nTol; 1903 aHitRec.pVisiLayer=&pPV->GetVisibleLayers(); 1904 aHitRec.pPageView=pPV; 1905 if (!pObj->HasMacro() || !pObj->IsMacroHit(aHitRec)) pObj=NULL; 1906 } 1907 if (pObj!=NULL && (nOptions & SDRSEARCH_WITHTEXT) !=0 && pObj->GetOutlinerParaObject()==NULL) pObj=NULL; 1908 if (pObj!=NULL && (nOptions & SDRSEARCH_TESTTEXTAREA) !=0) 1909 { 1910 if(!SdrObjectPrimitiveHit(*pObj, aPt, 0, *pPV, 0, true)) 1911 { 1912 pObj = 0; 1913 } 1914 } 1915 if (pObj!=NULL) { 1916 rpObj=pObj; 1917 rpPV=pPV; 1918 if (pnPassNum!=NULL) *pnPassNum|=SDRSEARCHPASS_DIRECT; 1919 } 1920 } 1921 return rpObj!=NULL; 1922 } 1923 1924 sal_Bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr* pnMarkNum, sal_uIntPtr nOptions) const 1925 { 1926 SortMarkedObjects(); 1927 sal_Bool bBoundCheckOn2ndPass=(nOptions & SDRSEARCH_PASS2BOUND) !=0; 1928 sal_Bool bCheckNearestOn3rdPass=(nOptions & SDRSEARCH_PASS3NEAREST) !=0; 1929 rpObj=NULL; 1930 rpPV=NULL; 1931 if (pnMarkNum!=NULL) *pnMarkNum=CONTAINER_ENTRY_NOTFOUND; 1932 Point aPt(rPnt); 1933 sal_uInt16 nTol=(sal_uInt16)nHitTolLog; 1934 sal_Bool bFnd=sal_False; 1935 sal_uIntPtr nMarkAnz=GetMarkedObjectCount(); 1936 sal_uIntPtr nMarkNum; 1937 for (nMarkNum=nMarkAnz; nMarkNum>0 && !bFnd;) { 1938 nMarkNum--; 1939 SdrMark* pM=GetSdrMarkByIndex(nMarkNum); 1940 SdrPageView* pPV=pM->GetPageView(); 1941 SdrObject* pObj=pM->GetMarkedSdrObj(); 1942 bFnd = 0 != CheckSingleSdrObjectHit(aPt,nTol,pObj,pPV,SDRSEARCH_TESTMARKABLE,0); 1943 if (bFnd) { 1944 rpObj=pObj; 1945 rpPV=pPV; 1946 if (pnMarkNum!=NULL) *pnMarkNum=nMarkNum; 1947 } 1948 } 1949 if ((bBoundCheckOn2ndPass || bCheckNearestOn3rdPass) && !bFnd) { 1950 SdrObject* pBestObj=NULL; 1951 SdrPageView* pBestPV=NULL; 1952 sal_uIntPtr nBestMarkNum=0; 1953 sal_uIntPtr nBestDist=ULONG_MAX; 1954 for (nMarkNum=nMarkAnz; nMarkNum>0 && !bFnd;) { 1955 nMarkNum--; 1956 SdrMark* pM=GetSdrMarkByIndex(nMarkNum); 1957 SdrPageView* pPV=pM->GetPageView(); 1958 SdrObject* pObj=pM->GetMarkedSdrObj(); 1959 Rectangle aRect(pObj->GetCurrentBoundRect()); 1960 aRect.Left ()-=nTol; 1961 aRect.Top ()-=nTol; 1962 aRect.Right ()+=nTol; 1963 aRect.Bottom()+=nTol; 1964 if (aRect.IsInside(aPt)) { 1965 bFnd=sal_True; 1966 rpObj=pObj; 1967 rpPV=pPV; 1968 if (pnMarkNum!=NULL) *pnMarkNum=nMarkNum; 1969 } else if (bCheckNearestOn3rdPass) { 1970 sal_uIntPtr nDist=0; 1971 if (aPt.X()<aRect.Left()) nDist+=aRect.Left()-aPt.X(); 1972 if (aPt.X()>aRect.Right()) nDist+=aPt.X()-aRect.Right(); 1973 if (aPt.Y()<aRect.Top()) nDist+=aRect.Top()-aPt.Y(); 1974 if (aPt.Y()>aRect.Bottom()) nDist+=aPt.Y()-aRect.Bottom(); 1975 if (nDist<nBestDist) { 1976 pBestObj=pObj; 1977 pBestPV=pPV; 1978 nBestMarkNum=nMarkNum; 1979 } 1980 } 1981 } 1982 if (bCheckNearestOn3rdPass && !bFnd) { 1983 rpObj=pBestObj; 1984 rpPV=pBestPV; 1985 if (pnMarkNum!=NULL) *pnMarkNum=nBestMarkNum; 1986 bFnd=pBestObj!=NULL; 1987 } 1988 } 1989 return bFnd; 1990 } 1991 1992 SdrHitKind SdrMarkView::PickSomething(const Point& rPnt, short nTol) const 1993 { 1994 nTol=ImpGetHitTolLogic(nTol,NULL); 1995 SdrHitKind eRet=SDRHIT_NONE; 1996 Point aPt(rPnt); 1997 SdrObject* pObj=NULL; 1998 SdrPageView* pPV=NULL; 1999 if (eRet==SDRHIT_NONE && PickObj(rPnt,sal_uInt16(nTol),pObj,pPV,SDRSEARCH_PICKMARKABLE)) { 2000 Rectangle aRct1(aPt-Point(nTol,nTol),aPt+Point(nTol,nTol)); // HitRect fuer Toleranz 2001 Rectangle aBR(pObj->GetCurrentBoundRect()); 2002 if (aRct1.IsInside(aBR.TopLeft())) eRet=SDRHIT_BOUNDTL; 2003 else if (aRct1.IsInside(aBR.TopCenter())) eRet=SDRHIT_BOUNDTC; 2004 else if (aRct1.IsInside(aBR.TopRight())) eRet=SDRHIT_BOUNDTR; 2005 else if (aRct1.IsInside(aBR.LeftCenter())) eRet=SDRHIT_BOUNDCL; 2006 else if (aRct1.IsInside(aBR.RightCenter())) eRet=SDRHIT_BOUNDCR; 2007 else if (aRct1.IsInside(aBR.BottomLeft())) eRet=SDRHIT_BOUNDBL; 2008 else if (aRct1.IsInside(aBR.BottomCenter())) eRet=SDRHIT_BOUNDBC; 2009 else if (aRct1.IsInside(aBR.BottomRight())) eRet=SDRHIT_BOUNDBR; 2010 else eRet=SDRHIT_OBJECT; 2011 } 2012 return eRet; 2013 } 2014 2015 void SdrMarkView::UnmarkAllObj(SdrPageView* pPV) 2016 { 2017 if (GetMarkedObjectCount()!=0) { 2018 BrkAction(); 2019 //HMHBOOL bVis=bHdlShown; 2020 //HMHif (bVis) HideMarkHdl(); 2021 if (pPV!=NULL) 2022 { 2023 GetMarkedObjectListWriteAccess().DeletePageView(*pPV); 2024 } 2025 else 2026 { 2027 GetMarkedObjectListWriteAccess().Clear(); 2028 } 2029 pMarkedObj=NULL; 2030 pMarkedPV=NULL; 2031 MarkListHasChanged(); 2032 AdjustMarkHdl(); //HMHTRUE); 2033 //HMHif (bVis) ShowMarkHdl(); // ggf. fuer die RefPoints 2034 } 2035 } 2036 2037 void SdrMarkView::MarkAllObj(SdrPageView* _pPV) 2038 { 2039 BrkAction(); 2040 //HMHHideMarkHdl(); 2041 2042 if(!_pPV) 2043 { 2044 _pPV = GetSdrPageView(); 2045 } 2046 2047 // #i69171# _pPV may still be NULL if there is no SDrPageView (!), e.g. when inserting 2048 // other files 2049 if(_pPV) 2050 { 2051 const bool bMarkChg(GetMarkedObjectListWriteAccess().InsertPageView(*_pPV)); 2052 2053 if(bMarkChg) 2054 { 2055 MarkListHasChanged(); 2056 } 2057 } 2058 2059 if(GetMarkedObjectCount()) 2060 { 2061 AdjustMarkHdl(); //HMHTRUE); 2062 //HMHShowMarkHdl(); 2063 } 2064 } 2065 2066 void SdrMarkView::AdjustMarkHdl() //HMHBOOL bRestraintPaint) 2067 { 2068 //HMHBOOL bVis=bHdlShown; 2069 //HMHif (bVis) HideMarkHdl(); 2070 CheckMarked(); 2071 SetMarkRects(); 2072 SetMarkHandles(); 2073 //HMHif(bRestraintPaint && bVis) 2074 //HMH{ 2075 //HMH ShowMarkHdl(); 2076 //HMH} 2077 } 2078 2079 Rectangle SdrMarkView::GetMarkedObjBoundRect() const 2080 { 2081 Rectangle aRect; 2082 for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount(); nm++) { 2083 SdrMark* pM=GetSdrMarkByIndex(nm); 2084 SdrObject* pO=pM->GetMarkedSdrObj(); 2085 Rectangle aR1(pO->GetCurrentBoundRect()); 2086 if (aRect.IsEmpty()) aRect=aR1; 2087 else aRect.Union(aR1); 2088 } 2089 return aRect; 2090 } 2091 2092 const Rectangle& SdrMarkView::GetMarkedObjRect() const 2093 { 2094 if (bMarkedObjRectDirty) { 2095 ((SdrMarkView*)this)->bMarkedObjRectDirty=sal_False; 2096 Rectangle aRect; 2097 for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount(); nm++) { 2098 SdrMark* pM=GetSdrMarkByIndex(nm); 2099 SdrObject* pO=pM->GetMarkedSdrObj(); 2100 Rectangle aR1(pO->GetSnapRect()); 2101 if (aRect.IsEmpty()) aRect=aR1; 2102 else aRect.Union(aR1); 2103 } 2104 ((SdrMarkView*)this)->aMarkedObjRect=aRect; 2105 } 2106 return aMarkedObjRect; 2107 } 2108 2109 //////////////////////////////////////////////////////////////////////////////////////////////////// 2110 2111 void SdrMarkView::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, XubString& rStr, sal_uInt16 nVal, sal_uInt16 nOpt) const 2112 { 2113 rStr = ImpGetResStr(nStrCacheID); 2114 xub_StrLen nPos = rStr.SearchAscii("%1"); 2115 2116 if(nPos != STRING_NOTFOUND) 2117 { 2118 rStr.Erase(nPos, 2); 2119 2120 if(nOpt == IMPSDR_POINTSDESCRIPTION) 2121 { 2122 rStr.Insert(GetDescriptionOfMarkedPoints(), nPos); 2123 } 2124 else if(nOpt == IMPSDR_GLUEPOINTSDESCRIPTION) 2125 { 2126 rStr.Insert(GetDescriptionOfMarkedGluePoints(), nPos); 2127 } 2128 else 2129 { 2130 rStr.Insert(GetDescriptionOfMarkedObjects(), nPos); 2131 } 2132 } 2133 2134 nPos = rStr.SearchAscii("%2"); 2135 2136 if(nPos != STRING_NOTFOUND) 2137 { 2138 rStr.Erase(nPos, 2); 2139 rStr.Insert(UniString::CreateFromInt32(nVal), nPos); 2140 } 2141 } 2142 2143 //////////////////////////////////////////////////////////////////////////////////////////////////// 2144 2145 sal_Bool SdrMarkView::EnterMarkedGroup() 2146 { 2147 sal_Bool bRet=sal_False; 2148 // Es wird nur die erste gefundene Gruppe (also nur in einer PageView) geentert 2149 // Weil PageView::EnterGroup ein AdjustMarkHdl ruft. 2150 // Das muss ich per Flag mal unterbinden vvvvvvvv 2151 SdrPageView* pPV = GetSdrPageView(); 2152 2153 if(pPV) 2154 { 2155 sal_Bool bEnter=sal_False; 2156 for (sal_uInt32 nm(GetMarkedObjectCount()); nm > 0 && !bEnter;) 2157 { 2158 nm--; 2159 SdrMark* pM=GetSdrMarkByIndex(nm); 2160 if (pM->GetPageView()==pPV) { 2161 SdrObject* pObj=pM->GetMarkedSdrObj(); 2162 if (pObj->IsGroupObject()) { 2163 if (pPV->EnterGroup(pObj)) { 2164 bRet=sal_True; 2165 bEnter=sal_True; 2166 } 2167 } 2168 } 2169 } 2170 } 2171 return bRet; 2172 } 2173 2174 //////////////////////////////////////////////////////////////////////////////////////////////////// 2175 2176 void SdrMarkView::MarkListHasChanged() 2177 { 2178 GetMarkedObjectListWriteAccess().SetNameDirty(); 2179 SetEdgesOfMarkedNodesDirty(); // bEdgesOfMarkedNodesDirty=sal_True; 2180 2181 bMarkedObjRectDirty=sal_True; 2182 bMarkedPointsRectsDirty=sal_True; 2183 #ifdef DBG_UTIL 2184 if (pItemBrowser!=NULL) pItemBrowser->SetDirty(); 2185 #endif 2186 sal_Bool bOneEdgeMarked=sal_False; 2187 if (GetMarkedObjectCount()==1) { 2188 const SdrObject* pObj=GetMarkedObjectByIndex(0); 2189 if (pObj->GetObjInventor()==SdrInventor) { 2190 sal_uInt16 nIdent=pObj->GetObjIdentifier(); 2191 bOneEdgeMarked=nIdent==OBJ_EDGE; 2192 } 2193 } 2194 ImpSetGlueVisible4(bOneEdgeMarked); 2195 } 2196 2197 //////////////////////////////////////////////////////////////////////////////////////////////////// 2198 2199 void SdrMarkView::SetMoveOutside(sal_Bool bOn) 2200 { 2201 aHdl.SetMoveOutside(bOn); 2202 } 2203 2204 sal_Bool SdrMarkView::IsMoveOutside() const 2205 { 2206 return aHdl.IsMoveOutside(); 2207 } 2208 2209 void SdrMarkView::SetDesignMode( sal_Bool _bOn ) 2210 { 2211 if ( bDesignMode != _bOn ) 2212 { 2213 bDesignMode = _bOn; 2214 SdrPageView* pPageView = GetSdrPageView(); 2215 if ( pPageView ) 2216 pPageView->SetDesignMode( _bOn ); 2217 } 2218 } 2219 2220 // MarkHandles Objektaenderung: 2221 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2222 // - Bei Notify mit HINT_OBJCHG (oder so) werden die Handles erstmal versteckt 2223 // (wenn nicht schon wegen Dragging versteckt). 2224 // - XorHdl: Bei ModelHasChanged() werden sie dann wieder angezeigt. 2225 // - PaintEvents kommen nun durch. 2226 // - Die XorHandles werden z.T. wieder uebermalt. 2227 // - Xor: Nach dem Painten werden die Handles im (vom PaintHandler gerufenen) 2228 // CompleteRedraw per ToggleShownXor bei gesetzter ClipRegion nochmal gemalt 2229 // und damit ist alles in Butter. 2230 // - ToggleShownXor macht bei SolidHdl nix weil bHdlShown=FALSE 2231 // - Der AfterPaintTimer wird gestartet. 2232 // - SolidHdl: Im AfterPaintHandler wird ShowMarkHdl gerufen. 2233 // Da die Handles zu diesem Zeitpunkt nicht angezeigt sind wird: 2234 // - SaveBackground durchgefuehrt. 2235 // - DrawMarkHdl gerufen und bHdlShown gesetzt. 2236 // 2237 // MarkHandles bei sonstigem Invalidate: 2238 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2239 // In diesem Fall bekomme ich kein Notify und beim Aufruf des 2240 // PaintHandlers->CompleteRedraw() sind auch die SolidHandles sichtbar. 2241 2242