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