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