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