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