Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
31 : :
32 : : #include "DrawViewShell.hxx"
33 : : #include <vcl/msgbox.hxx>
34 : : #include <svl/urlbmk.hxx>
35 : : #include <svx/svdpagv.hxx>
36 : : #include <svx/svdundo.hxx>
37 : : #include <svx/fmglob.hxx>
38 : : #include <editeng/eeitem.hxx>
39 : : #include <editeng/flditem.hxx>
40 : : #include <svx/svxids.hrc>
41 : : #include <svx/ruler.hxx>
42 : : #include <svx/globl3d.hxx>
43 : : #include <editeng/outliner.hxx>
44 : : #include <sfx2/ipclient.hxx>
45 : : #include <sfx2/request.hxx>
46 : : #include <sfx2/dispatch.hxx>
47 : : #include <svx/svdopath.hxx>
48 : : #include <sfx2/viewfrm.hxx>
49 : : #include <editeng/editview.hxx>
50 : : #include <vcl/cursor.hxx>
51 : :
52 : :
53 : : #include "app.hrc"
54 : : #include "glob.hrc"
55 : : #include "strings.hrc"
56 : : #include "res_bmp.hrc"
57 : : #include "DrawDocShell.hxx"
58 : : #include "drawdoc.hxx"
59 : : #include "Window.hxx"
60 : : #include "fupoor.hxx"
61 : : #include "fusnapln.hxx"
62 : : #include "app.hxx"
63 : : #include "Ruler.hxx"
64 : : #include "sdresid.hxx"
65 : : #include "GraphicViewShell.hxx"
66 : : #include "sdpage.hxx"
67 : : #include "slideshow.hxx"
68 : : #include "anminfo.hxx"
69 : : #include "sdpopup.hxx"
70 : : #include "drawview.hxx"
71 : : #include <svx/bmpmask.hxx>
72 : : #include "LayerTabBar.hxx"
73 : :
74 : : #include <svx/svditer.hxx>
75 : :
76 : : namespace sd {
77 : :
78 : : #define PIPETTE_RANGE 0
79 : :
80 : : #ifdef _MSC_VER
81 : : #pragma optimize ( "", off )
82 : : #endif
83 : :
84 : : using namespace ::com::sun::star::uno;
85 : : using namespace ::com::sun::star::drawing;
86 : :
87 : : /*************************************************************************
88 : : |*
89 : : |* aktuelle Seite loeschen
90 : : |*
91 : : \************************************************************************/
92 : :
93 : 0 : void DrawViewShell::DeleteActualPage()
94 : : {
95 : 0 : sal_uInt16 nPage = maTabControl.GetCurPageId() - 1;
96 : :
97 : 0 : mpDrawView->SdrEndTextEdit();
98 : :
99 : : try
100 : : {
101 [ # # ][ # # ]: 0 : Reference<XDrawPagesSupplier> xDrawPagesSupplier( GetDoc()->getUnoModel(), UNO_QUERY_THROW );
[ # # ]
102 [ # # ][ # # ]: 0 : Reference<XDrawPages> xPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW );
[ # # ]
103 [ # # ][ # # ]: 0 : Reference< XDrawPage > xPage( xPages->getByIndex( nPage ), UNO_QUERY_THROW );
[ # # ]
104 [ # # ][ # # ]: 0 : xPages->remove( xPage );
[ # # ]
105 : : }
106 : 0 : catch( Exception& )
107 : : {
108 : : OSL_FAIL("SelectionManager::DeleteSelectedMasterPages(), exception caught!");
109 : : }
110 : 0 : }
111 : :
112 : : /*************************************************************************
113 : : |*
114 : : |* aktuelle Ebene loeschen
115 : : |*
116 : : \************************************************************************/
117 : :
118 : 0 : void DrawViewShell::DeleteActualLayer()
119 : : {
120 [ # # ]: 0 : SdrLayerAdmin& rAdmin = GetDoc()->GetLayerAdmin();
121 [ # # ][ # # ]: 0 : const String& rName = GetLayerTabControl()->GetPageText(GetLayerTabControl()->GetCurPageId());
[ # # ]
122 [ # # ][ # # ]: 0 : String aString(SdResId(STR_ASK_DELETE_LAYER));
123 : :
124 : : // Platzhalter ersetzen
125 [ # # ]: 0 : sal_uInt16 nPos = aString.Search(sal_Unicode('$'));
126 [ # # ]: 0 : aString.Erase(nPos, 1);
127 [ # # ]: 0 : aString.Insert(rName, nPos);
128 : :
129 [ # # ][ # # ]: 0 : if (QueryBox(GetActiveWindow(), WB_YES_NO, aString).Execute() == RET_YES)
[ # # ][ # # ]
[ # # ]
130 : : {
131 [ # # ]: 0 : const SdrLayer* pLayer = rAdmin.GetLayer(rName, sal_False);
132 [ # # ]: 0 : mpDrawView->DeleteLayer( pLayer->GetName() );
133 : :
134 : : // damit TabBar und Window neu gezeichnet werden;
135 : : // sollte spaeter wie beim Aendern der Layerfolge durch einen
136 : : // Hint von Joe angestossen werden
137 : : // ( View::Notify() --> ViewShell::ResetActualLayer() )
138 : :
139 : 0 : mbIsLayerModeActive = false; // damit ChangeEditMode() ueberhaupt was tut
140 [ # # ]: 0 : ChangeEditMode(GetEditMode(), true);
141 [ # # ][ # # ]: 0 : }
142 : 0 : }
143 : :
144 : :
145 : : /*************************************************************************
146 : : |*
147 : : |* Keyboard event
148 : : |*
149 : : \************************************************************************/
150 : :
151 : 0 : sal_Bool DrawViewShell::KeyInput (const KeyEvent& rKEvt, ::sd::Window* pWin)
152 : : {
153 : 0 : sal_Bool bRet = sal_False;
154 : :
155 [ # # ][ # # ]: 0 : if ( !IsInputLocked() || ( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE ) )
[ # # ]
156 : : {
157 [ # # # # : 0 : if(KEY_RETURN == rKEvt.GetKeyCode().GetCode()
# # ][ # # ]
158 : 0 : && rKEvt.GetKeyCode().IsMod1()
159 : 0 : && GetView()->IsTextEdit())
160 : : {
161 : : // this should be used for cursor travelling.
162 : 0 : SdPage* pActualPage = GetActualPage();
163 : 0 : const SdrMarkList& rMarkList = GetView()->GetMarkedObjectList();
164 : 0 : SdrTextObj* pCandidate = 0L;
165 : :
166 [ # # ][ # # ]: 0 : if(pActualPage && 1 == rMarkList.GetMarkCount())
[ # # ]
167 : : {
168 [ # # ]: 0 : SdrMark* pMark = rMarkList.GetMark(0);
169 : :
170 : : // remember which object was the text in edit mode
171 [ # # ]: 0 : SdrObject* pOldObj = pMark->GetMarkedSdrObj();
172 : :
173 : : // end text edit now
174 [ # # ]: 0 : GetView()->SdrEndTextEdit();
175 : :
176 : : // look for a new candidate, a successor of pOldObj
177 [ # # ]: 0 : SdrObjListIter aIter(*pActualPage, IM_DEEPNOGROUPS);
178 : 0 : sal_Bool bDidVisitOldObject(sal_False);
179 : :
180 [ # # ][ # # ]: 0 : while(aIter.IsMore() && !pCandidate)
[ # # ]
181 : : {
182 [ # # ]: 0 : SdrObject* pObj = aIter.Next();
183 : :
184 [ # # ][ # # ]: 0 : if(pObj && pObj->ISA(SdrTextObj))
[ # # ][ # # ]
[ # # ]
185 : : {
186 [ # # ]: 0 : sal_uInt32 nInv(pObj->GetObjInventor());
187 [ # # ]: 0 : sal_uInt16 nKnd(pObj->GetObjIdentifier());
188 : :
189 [ # # ][ # # ]: 0 : if(SdrInventor == nInv &&
[ # # ][ # # ]
[ # # ]
190 : : (OBJ_TITLETEXT == nKnd || OBJ_OUTLINETEXT == nKnd || OBJ_TEXT == nKnd)
191 : : && bDidVisitOldObject)
192 : : {
193 : 0 : pCandidate = (SdrTextObj*)pObj;
194 : : }
195 : :
196 [ # # ]: 0 : if(pObj == pOldObj)
197 : : {
198 : 0 : bDidVisitOldObject = sal_True;
199 : : }
200 : : }
201 : 0 : }
202 : : }
203 : :
204 [ # # ]: 0 : if(pCandidate)
205 : : {
206 : : // set the new candidate to text edit mode
207 : 0 : GetView()->UnMarkAll();
208 : 0 : GetView()->MarkObj(pCandidate, GetView()->GetSdrPageView());
209 : :
210 : : GetViewFrame()->GetDispatcher()->Execute(
211 : 0 : SID_ATTR_CHAR, SFX_CALLMODE_ASYNCHRON);
212 : : }
213 : : else
214 : : {
215 : : // insert a new page with the same page layout
216 : : GetViewFrame()->GetDispatcher()->Execute(
217 : 0 : SID_INSERTPAGE_QUICK, SFX_CALLMODE_ASYNCHRON);
218 : : }
219 : : }
220 : : else
221 : : {
222 : 0 : bRet = ViewShell::KeyInput(rKEvt, pWin);
223 : : }
224 : : }
225 : :
226 : 0 : return bRet;
227 : : }
228 : :
229 : : /*************************************************************************
230 : : |*
231 : : |* Vom Lineal ausgehenden Drag (Hilflinien, Ursprung) beginnen
232 : : |*
233 : : \************************************************************************/
234 : :
235 : 0 : void DrawViewShell::StartRulerDrag (
236 : : const Ruler& rRuler,
237 : : const MouseEvent& rMEvt)
238 : : {
239 [ # # ][ # # ]: 0 : GetActiveWindow()->CaptureMouse();
240 : :
241 [ # # ][ # # ]: 0 : Point aWPos = GetActiveWindow()->PixelToLogic(GetActiveWindow()->GetPointerPosPixel());
[ # # ][ # # ]
242 : :
243 [ # # ][ # # ]: 0 : if ( rRuler.GetExtraRect().IsInside(rMEvt.GetPosPixel()) )
244 : : {
245 [ # # ]: 0 : mpDrawView->BegSetPageOrg(aWPos);
246 : 0 : mbIsRulerDrag = sal_True;
247 : : }
248 : : else
249 : : {
250 : : // #i34536# if no guide-lines are visible yet, that show them
251 [ # # ]: 0 : if( ! mpDrawView->IsHlplVisible())
252 [ # # ]: 0 : mpDrawView->SetHlplVisible( sal_True );
253 : :
254 : : SdrHelpLineKind eKind;
255 : :
256 [ # # ]: 0 : if ( rMEvt.IsMod1() )
257 : 0 : eKind = SDRHELPLINE_POINT;
258 [ # # ]: 0 : else if ( rRuler.IsHorizontal() )
259 : 0 : eKind = SDRHELPLINE_HORIZONTAL;
260 : : else
261 : 0 : eKind = SDRHELPLINE_VERTICAL;
262 : :
263 [ # # ]: 0 : mpDrawView->BegDragHelpLine(aWPos, eKind);
264 : 0 : mbIsRulerDrag = sal_True;
265 : : }
266 : 0 : }
267 : :
268 : : /*************************************************************************
269 : : |*
270 : : |* MouseButtonDown event
271 : : |*
272 : : \************************************************************************/
273 : :
274 : 0 : void DrawViewShell::MouseButtonDown(const MouseEvent& rMEvt,
275 : : ::sd::Window* pWin)
276 : : {
277 : : // We have to check if a context menu is shown and we have an UI
278 : : // active inplace client. In that case we have to ignore the mouse
279 : : // button down event. Otherwise we would crash (context menu has been
280 : : // opened by inplace client and we would deactivate the inplace client,
281 : : // the contex menu is closed by VCL asynchronously which in the end
282 : : // would work on deleted objects or the context menu has no parent anymore)
283 : 0 : SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient();
284 [ # # ][ # # ]: 0 : sal_Bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() );
285 : :
286 [ # # ][ # # ]: 0 : if ( bIsOleActive && PopupMenu::IsInExecute() )
[ # # ]
287 : 0 : return;
288 : :
289 [ # # ]: 0 : if ( !IsInputLocked() )
290 : : {
291 : 0 : ViewShell::MouseButtonDown(rMEvt, pWin);
292 : :
293 [ # # ]: 0 : if ( mbPipette )
294 : 0 : ( (SvxBmpMask*) GetViewFrame()->GetChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )->PipetteClicked();
295 : : }
296 : : }
297 : :
298 : : /*************************************************************************
299 : : |*
300 : : |* MouseMove event
301 : : |*
302 : : \************************************************************************/
303 : :
304 : :
305 : 0 : void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
306 : : {
307 [ # # ]: 0 : if ( !IsInputLocked() )
308 : : {
309 [ # # ][ # # ]: 0 : if ( mpDrawView->IsAction() )
310 : : {
311 [ # # ][ # # ]: 0 : Rectangle aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel());
312 : :
313 [ # # ][ # # ]: 0 : if ( !aOutputArea.IsInside(rMEvt.GetPosPixel()) )
314 : : {
315 : 0 : sal_Bool bInsideOtherWindow = sal_False;
316 : :
317 [ # # ]: 0 : if (mpContentWindow.get() != NULL)
318 : : {
319 : : aOutputArea = Rectangle(Point(0,0),
320 [ # # ]: 0 : mpContentWindow->GetOutputSizePixel());
321 : :
322 [ # # ]: 0 : Point aPos = mpContentWindow->GetPointerPosPixel();
323 [ # # ][ # # ]: 0 : if ( aOutputArea.IsInside(aPos) )
324 : 0 : bInsideOtherWindow = sal_True;
325 : : }
326 : :
327 [ # # ][ # # ]: 0 : if (! GetActiveWindow()->HasFocus ())
[ # # ]
328 : : {
329 [ # # ][ # # ]: 0 : GetActiveWindow()->ReleaseMouse ();
330 [ # # ]: 0 : mpDrawView->BrkAction ();
331 : 0 : return;
332 : : }
333 [ # # ]: 0 : else if ( bInsideOtherWindow )
334 : : {
335 [ # # ][ # # ]: 0 : GetActiveWindow()->ReleaseMouse();
336 [ # # ]: 0 : pWin->CaptureMouse ();
337 : : }
338 : : }
339 [ # # ][ # # ]: 0 : else if ( pWin != GetActiveWindow() )
340 [ # # ]: 0 : pWin->CaptureMouse();
341 : : }
342 : :
343 : : // Since the next MouseMove may execute a IsSolidDraggingNow() in
344 : : // SdrCreateView::MovCreateObj and there the ApplicationBackgroundColor
345 : : // is needed it is necessary to set it here.
346 [ # # ][ # # ]: 0 : if(mpDrawView!=NULL && GetDoc()!=NULL)
[ # # ][ # # ]
347 : : {
348 [ # # ]: 0 : svtools::ColorConfig aColorConfig;
349 : 0 : Color aFillColor;
350 : :
351 [ # # ][ # # ]: 0 : if(DOCUMENT_TYPE_IMPRESS == GetDoc()->GetDocumentType())
352 : : {
353 [ # # ]: 0 : aFillColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
354 : : }
355 : : else
356 : : {
357 [ # # ]: 0 : aFillColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
358 : : }
359 : :
360 [ # # ][ # # ]: 0 : mpDrawView->SetApplicationBackgroundColor(aFillColor);
361 : : }
362 : :
363 [ # # ]: 0 : ViewShell::MouseMove(rMEvt, pWin);
364 : :
365 [ # # ]: 0 : if( !mbMousePosFreezed )
366 : 0 : maMousePos = rMEvt.GetPosPixel();
367 : :
368 [ # # ]: 0 : Rectangle aRect;
369 : :
370 [ # # ]: 0 : if ( mbIsRulerDrag )
371 : : {
372 [ # # ][ # # ]: 0 : Point aLogPos = GetActiveWindow()->PixelToLogic(maMousePos);
373 [ # # ]: 0 : mpDrawView->MovAction(aLogPos);
374 : : }
375 : :
376 [ # # ][ # # ]: 0 : if ( mpDrawView->IsAction() )
377 : : {
378 [ # # ]: 0 : mpDrawView->TakeActionRect(aRect);
379 [ # # ][ # # ]: 0 : aRect = GetActiveWindow()->LogicToPixel(aRect);
380 : : }
381 : : else
382 : : {
383 [ # # ]: 0 : aRect = Rectangle(maMousePos, maMousePos);
384 : : }
385 : :
386 [ # # ]: 0 : ShowMousePosInfo(aRect, pWin);
387 : :
388 [ # # ][ # # ]: 0 : if ( mbPipette && GetViewFrame()->HasChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() ) )
[ # # ][ # # ]
[ # # ][ # # ]
389 : : {
390 : 0 : const long nStartX = maMousePos.X() - PIPETTE_RANGE;
391 : 0 : const long nEndX = maMousePos.X() + PIPETTE_RANGE;
392 : 0 : const long nStartY = maMousePos.Y() - PIPETTE_RANGE;
393 : 0 : const long nEndY = maMousePos.Y() + PIPETTE_RANGE;
394 : 0 : long nRed = 0;
395 : 0 : long nGreen = 0;
396 : 0 : long nBlue = 0;
397 : 0 : const double fDiv = ( ( PIPETTE_RANGE << 1 ) + 1 ) * ( ( PIPETTE_RANGE << 1 ) + 1 );
398 : :
399 [ # # ]: 0 : for ( long nY = nStartY; nY <= nEndY; nY++ )
400 : : {
401 [ # # ]: 0 : for( long nX = nStartX; nX <= nEndX; nX++ )
402 : : {
403 [ # # ][ # # ]: 0 : const Color aCol( pWin->GetPixel( pWin->PixelToLogic( Point( nX, nY ) ) ) );
404 : :
405 : 0 : nRed += aCol.GetRed();
406 : 0 : nGreen += aCol.GetGreen();
407 : 0 : nBlue += aCol.GetBlue();
408 : : }
409 : : }
410 : :
411 [ # # ][ # # ]: 0 : ( (SvxBmpMask*) GetViewFrame()->GetChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )->
[ # # ]
412 : : SetColor( Color( (sal_uInt8) ( nRed / fDiv + .5 ),
413 : : (sal_uInt8) ( nGreen / fDiv + .5 ),
414 [ # # ]: 0 : (sal_uInt8) ( nBlue / fDiv + .5 ) ) );
415 : : }
416 : : }
417 : : }
418 : :
419 : :
420 : : /*************************************************************************
421 : : |*
422 : : |* MouseButtonUp event
423 : : |*
424 : : \************************************************************************/
425 : :
426 : 0 : void DrawViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
427 : : {
428 [ # # ]: 0 : if ( !IsInputLocked() )
429 : : {
430 : 0 : bool bIsSetPageOrg = mpDrawView->IsSetPageOrg();
431 : :
432 [ # # ]: 0 : if (mbIsRulerDrag)
433 : : {
434 [ # # ][ # # ]: 0 : Rectangle aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel());
435 : :
436 [ # # ][ # # ]: 0 : if (aOutputArea.IsInside(rMEvt.GetPosPixel()))
437 : : {
438 [ # # ]: 0 : mpDrawView->EndAction();
439 : :
440 [ # # ]: 0 : if (bIsSetPageOrg)
441 [ # # ][ # # ]: 0 : GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET);
442 : : }
443 [ # # ][ # # ]: 0 : else if (rMEvt.IsLeft() && bIsSetPageOrg)
[ # # ]
444 : : {
445 [ # # ]: 0 : mpDrawView->BrkAction();
446 : 0 : SdPage* pPage = (SdPage*) mpDrawView->GetSdrPageView()->GetPage();
447 [ # # ][ # # ]: 0 : Point aOrg(pPage->GetLftBorder(), pPage->GetUppBorder());
448 [ # # ]: 0 : mpDrawView->GetSdrPageView()->SetPageOrigin(aOrg);
449 [ # # ][ # # ]: 0 : GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET);
450 : : }
451 : : else
452 : : {
453 [ # # ]: 0 : mpDrawView->BrkAction();
454 : : }
455 : :
456 [ # # ][ # # ]: 0 : GetActiveWindow()->ReleaseMouse();
457 : 0 : mbIsRulerDrag = sal_False;
458 : : }
459 : : else
460 : 0 : ViewShell::MouseButtonUp(rMEvt, pWin);
461 : : }
462 : 0 : }
463 : :
464 : : /*************************************************************************
465 : : |*
466 : : |* Command event
467 : : |*
468 : : \************************************************************************/
469 : :
470 : 0 : void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
471 : : {
472 : : // The command event is send to the window after a possible context
473 : : // menu from an inplace client is closed. Now we have the chance to
474 : : // deactivate the inplace client without any problem regarding parent
475 : : // windows and code on the stack.
476 : 0 : SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient();
477 [ # # ][ # # ]: 0 : sal_Bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() );
478 [ # # ][ # # ]: 0 : if ( bIsOleActive && ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ))
[ # # ]
479 : : {
480 : : // Deactivate OLE object
481 : 0 : mpDrawView->UnmarkAll();
482 : 0 : SelectionHasChanged();
483 : 0 : return;
484 : : }
485 : :
486 [ # # ]: 0 : if ( !IsInputLocked() )
487 : : {
488 [ # # ][ # # ]: 0 : if( GetView() &&GetView()->getSmartTags().Command(rCEvt) )
[ # # ]
489 : 0 : return;
490 : :
491 : 0 : const bool bNativeShow (SlideShow::IsRunning(GetViewShellBase()));
492 : :
493 [ # # ][ # # ]: 0 : if( rCEvt.GetCommand() == COMMAND_PASTESELECTION && !bNativeShow )
[ # # ]
494 : : {
495 [ # # ][ # # ]: 0 : TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSelection( GetActiveWindow() ) );
496 : :
497 [ # # ]: 0 : if( aDataHelper.GetTransferable().is() )
498 : : {
499 : 0 : Point aPos;
500 : 0 : sal_Int8 nDnDAction = DND_ACTION_COPY;
501 : :
502 [ # # ][ # # ]: 0 : if( GetActiveWindow() )
503 [ # # ][ # # ]: 0 : aPos = GetActiveWindow()->PixelToLogic( rCEvt.GetMousePosPixel() );
504 : :
505 [ # # ][ # # ]: 0 : if( !mpDrawView->InsertData( aDataHelper, aPos, nDnDAction, sal_False ) )
506 : : {
507 [ # # ]: 0 : INetBookmark aINetBookmark( aEmptyStr, aEmptyStr );
508 : :
509 [ # # ][ # # ]: 0 : if( ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
510 [ # # ]: 0 : aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) ||
511 [ # # ]: 0 : ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) &&
512 [ # # ]: 0 : aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, aINetBookmark ) ) ||
513 [ # # ]: 0 : ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) &&
514 [ # # ]: 0 : aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, aINetBookmark ) ) )
515 : : {
516 [ # # ]: 0 : InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), aEmptyStr, NULL );
517 [ # # ]: 0 : }
518 : : }
519 [ # # ]: 0 : }
520 : : }
521 [ # # ][ # # ]: 0 : else if( rCEvt.GetCommand() == COMMAND_CONTEXTMENU && !bNativeShow &&
[ # # # #
# # ][ # # ]
522 : 0 : pWin != NULL && !mpDrawView->IsAction() && !SD_MOD()->GetWaterCan() )
523 : : {
524 : 0 : sal_uInt16 nSdResId = 0; // ResourceID fuer Popup-Menue
525 [ # # ][ # # ]: 0 : sal_Bool bGraphicShell = this->ISA(GraphicViewShell);
526 : :
527 : : // Ist ein Fangobjekt unter dem Mauszeiger?
528 : : SdrPageView* pPV;
529 [ # # ]: 0 : Point aMPos = pWin->PixelToLogic( maMousePos );
530 [ # # ]: 0 : sal_uInt16 nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic(
531 [ # # ]: 0 : Size(FuPoor::HITPIX, 0 ) ).Width();
532 : : sal_uInt16 nHelpLine;
533 : : // fuer Klebepunkt
534 : 0 : SdrObject* pObj = NULL;
535 : 0 : sal_uInt16 nPickId = 0;
536 : : // fuer Feldbefehl
537 : 0 : OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
538 : 0 : const SvxFieldItem* pFldItem = NULL;
539 [ # # ]: 0 : if( pOLV )
540 [ # # ]: 0 : pFldItem = pOLV->GetFieldAtSelection();
541 : :
542 : : // Hilfslinie
543 [ # # ][ # # ]: 0 : if ( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) )
[ # # ]
544 : : {
545 : 0 : nSdResId = RID_DRAW_SNAPOBJECT_POPUP;
546 [ # # ]: 0 : ShowSnapLineContextMenu(*pPV, nHelpLine, rCEvt.GetMousePosPixel());
547 : : return;
548 : : }
549 : : // Klebepunkt unter dem Mauszeiger markiert?
550 [ # # ][ # # ]: 0 : else if( mpDrawView->PickGluePoint( aMPos, pObj, nPickId, pPV ) &&
[ # # ][ # # ]
551 [ # # ]: 0 : mpDrawView->IsGluePointMarked( pObj, nPickId ) )
552 : : {
553 : 0 : nSdResId = RID_DRAW_GLUEPOINT_POPUP;
554 : : }
555 : : // Feldbefehl ?
556 [ # # ][ # # ]: 0 : else if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
557 [ # # ][ # # ]: 0 : pFldItem->GetField()->ISA( SvxExtTimeField ) ||
558 [ # # ][ # # ]: 0 : pFldItem->GetField()->ISA( SvxExtFileField ) ||
559 [ # # ][ # # ]: 0 : pFldItem->GetField()->ISA( SvxAuthorField ) ) )
560 : : {
561 : 0 : LanguageType eLanguage( LANGUAGE_SYSTEM );
562 : :
563 : : // Format popup with outliner language, if possible
564 [ # # ]: 0 : if( pOLV->GetOutliner() )
565 : : {
566 [ # # ]: 0 : ESelection aSelection( pOLV->GetSelection() );
567 [ # # ]: 0 : eLanguage = pOLV->GetOutliner()->GetLanguage( aSelection.nStartPara, aSelection.nStartPos );
568 : : }
569 : :
570 [ # # ]: 0 : SdFieldPopup aFieldPopup( pFldItem->GetField(), eLanguage );
571 : :
572 [ # # ]: 0 : if ( rCEvt.IsMouseEvent() )
573 : 0 : aMPos = rCEvt.GetMousePosPixel();
574 : : else
575 : 0 : aMPos = Point( 20, 20 );
576 [ # # ]: 0 : aFieldPopup.Execute( pWin, aMPos );
577 : :
578 [ # # ]: 0 : SvxFieldData* pField = aFieldPopup.GetField();
579 [ # # ]: 0 : if( pField )
580 : : {
581 [ # # ]: 0 : SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD );
582 : : // Feld selektieren, so dass es beim Insert geloescht wird
583 [ # # ]: 0 : ESelection aSel = pOLV->GetSelection();
584 : 0 : sal_Bool bSel = sal_True;
585 [ # # ]: 0 : if( aSel.nStartPos == aSel.nEndPos )
586 : : {
587 : 0 : bSel = sal_False;
588 : 0 : aSel.nEndPos++;
589 : : }
590 [ # # ]: 0 : pOLV->SetSelection( aSel );
591 : :
592 [ # # ]: 0 : pOLV->InsertField( aFieldItem );
593 : :
594 : : // Selektion wird wieder in den Ursprungszustand gebracht
595 [ # # ]: 0 : if( !bSel )
596 : 0 : aSel.nEndPos--;
597 [ # # ]: 0 : pOLV->SetSelection( aSel );
598 : :
599 [ # # ][ # # ]: 0 : delete pField;
[ # # ]
600 [ # # ]: 0 : }
601 : : }
602 : : else
603 : : {
604 : : // ist etwas selektiert?
605 [ # # # # ]: 0 : if (mpDrawView->AreObjectsMarked() &&
[ # # ]
606 : 0 : mpDrawView->GetMarkedObjectList().GetMarkCount() == 1 )
607 : : {
608 [ # # ][ # # ]: 0 : pObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
609 [ # # ][ # # ]: 0 : if( HasCurrentFunction(SID_BEZIER_EDIT) && (dynamic_cast< SdrPathObj * >( pObj ) != 0 ) )
[ # # ][ # # ]
[ # # ]
610 : : {
611 : 0 : nSdResId = RID_BEZIER_POPUP;
612 : : }
613 : : else
614 : : {
615 [ # # ][ # # ]: 0 : if( mpDrawView->GetTextEditObject() )
616 : : {
617 : 0 : OutlinerView* pOutlinerView = mpDrawView->GetTextEditOutlinerView();
618 : 0 : Point aPos(rCEvt.GetMousePosPixel());
619 : :
620 [ # # ]: 0 : if ( pOutlinerView )
621 : : {
622 [ # # ][ # # ]: 0 : if( ( rCEvt.IsMouseEvent() && pOutlinerView->IsWrongSpelledWordAtPos(aPos) ) ||
[ # # # # ]
[ # # ][ # # ]
623 [ # # ]: 0 : ( !rCEvt.IsMouseEvent() && pOutlinerView->IsCursorAtWrongSpelledWord() ) )
624 : : {
625 : : // Popup for Online-Spelling now handled by DrawDocShell
626 [ # # ][ # # ]: 0 : Link aLink = LINK(GetDocSh(), DrawDocShell, OnlineSpellCallback);
627 : :
628 [ # # ]: 0 : if( !rCEvt.IsMouseEvent() )
629 : : {
630 [ # # ][ # # ]: 0 : aPos = GetActiveWindow()->LogicToPixel( pOutlinerView->GetEditView().GetCursor()->GetPos() );
[ # # ]
631 : : }
632 : : // While showing the spell context menu
633 : : // we lock the input so that another
634 : : // context menu can not be opened during
635 : : // that time (crash #i43235#). In order
636 : : // to not lock the UI completely we
637 : : // first release the mouse.
638 [ # # ][ # # ]: 0 : GetActiveWindow()->ReleaseMouse();
639 : 0 : LockInput();
640 [ # # ]: 0 : pOutlinerView->ExecuteSpellPopup(aPos, &aLink);
641 : 0 : UnlockInput();
642 : : }
643 : : else
644 : : {
645 [ # # ][ # # ]: 0 : if( (pObj->GetObjInventor() == SdrInventor) && (pObj->GetObjIdentifier() == OBJ_TABLE) )
[ # # ][ # # ]
[ # # ]
646 : : {
647 : 0 : nSdResId = RID_DRAW_TABLEOBJ_INSIDE_POPUP;
648 : : }
649 : : else
650 : : {
651 : 0 : nSdResId = RID_DRAW_TEXTOBJ_INSIDE_POPUP;
652 : : }
653 : : }
654 : : }
655 : : }
656 : : else
657 : : {
658 [ # # ]: 0 : sal_uInt32 nInv = pObj->GetObjInventor();
659 [ # # ]: 0 : sal_uInt16 nId = pObj->GetObjIdentifier();
660 : :
661 [ # # ]: 0 : if (nInv == SdrInventor)
662 : : {
663 [ # # # # : 0 : switch ( nId )
# # # # #
# # # #
# ]
664 : : {
665 : : case OBJ_OUTLINETEXT:
666 : : nSdResId = bGraphicShell ? RID_GRAPHIC_OUTLINETEXTOBJ_POPUP :
667 [ # # ]: 0 : RID_DRAW_OUTLINETEXTOBJ_POPUP;
668 : 0 : break;
669 : :
670 : : case OBJ_CAPTION:
671 : : case OBJ_TITLETEXT:
672 : : case OBJ_TEXT:
673 : : nSdResId = bGraphicShell ? RID_GRAPHIC_TEXTOBJ_POPUP :
674 [ # # ]: 0 : RID_DRAW_TEXTOBJ_POPUP;
675 : 0 : break;
676 : :
677 : : case OBJ_PATHLINE:
678 : : case OBJ_PLIN:
679 : : nSdResId = bGraphicShell ? RID_GRAPHIC_POLYLINEOBJ_POPUP :
680 [ # # ]: 0 : RID_DRAW_POLYLINEOBJ_POPUP;
681 : 0 : break;
682 : :
683 : : case OBJ_FREELINE:
684 : : case OBJ_EDGE: // Connector
685 : : nSdResId = bGraphicShell ? RID_GRAPHIC_EDGEOBJ_POPUP :
686 [ # # ]: 0 : RID_DRAW_EDGEOBJ_POPUP;
687 : 0 : break;
688 : :
689 : : case OBJ_LINE:
690 : : nSdResId = bGraphicShell ? RID_GRAPHIC_LINEOBJ_POPUP :
691 [ # # ]: 0 : RID_DRAW_LINEOBJ_POPUP;
692 : 0 : break;
693 : :
694 : : case OBJ_MEASURE:
695 : : nSdResId = bGraphicShell ? RID_GRAPHIC_MEASUREOBJ_POPUP :
696 [ # # ]: 0 : RID_DRAW_MEASUREOBJ_POPUP;
697 : 0 : break;
698 : :
699 : : case OBJ_RECT:
700 : : case OBJ_CIRC:
701 : : case OBJ_FREEFILL:
702 : : case OBJ_PATHFILL:
703 : : case OBJ_POLY:
704 : : case OBJ_SECT:
705 : : case OBJ_CARC:
706 : : case OBJ_CCUT:
707 : : nSdResId = bGraphicShell ? RID_GRAPHIC_GEOMOBJ_POPUP :
708 [ # # ]: 0 : RID_DRAW_GEOMOBJ_POPUP;
709 : 0 : break;
710 : :
711 : : case OBJ_CUSTOMSHAPE:
712 : : nSdResId = bGraphicShell ? RID_GRAPHIC_CUSTOMSHAPE_POPUP :
713 [ # # ]: 0 : RID_DRAW_CUSTOMSHAPE_POPUP;
714 : 0 : break;
715 : :
716 : : case OBJ_GRUP:
717 : : nSdResId = bGraphicShell ? RID_GRAPHIC_GROUPOBJ_POPUP :
718 [ # # ]: 0 : RID_DRAW_GROUPOBJ_POPUP;
719 : 0 : break;
720 : :
721 : : case OBJ_GRAF:
722 : : nSdResId = bGraphicShell ? RID_GRAPHIC_GRAPHIC_POPUP :
723 [ # # ]: 0 : RID_DRAW_GRAPHIC_POPUP;
724 : 0 : break;
725 : :
726 : : case OBJ_OLE2:
727 : : nSdResId = bGraphicShell ? RID_GRAPHIC_OLE2_POPUP :
728 [ # # ]: 0 : RID_DRAW_OLE2_POPUP;
729 : 0 : break;
730 : : case OBJ_MEDIA:
731 : : nSdResId = bGraphicShell ? RID_GRAPHIC_MEDIA_POPUP :
732 [ # # ]: 0 : RID_DRAW_MEDIA_POPUP;
733 : 0 : break;
734 : : case OBJ_TABLE:
735 : : nSdResId = bGraphicShell ? RID_GRAPHIC_TABLE_POPUP :
736 [ # # ]: 0 : RID_DRAW_TABLE_POPUP;
737 : 0 : break;
738 : : }
739 : : }
740 [ # # ]: 0 : else if( nInv == E3dInventor )
741 : : {
742 [ # # ][ # # ]: 0 : if( nId == E3D_POLYSCENE_ID || nId == E3D_SCENE_ID )
743 : : {
744 [ # # ][ # # ]: 0 : if( !mpDrawView->IsGroupEntered() )
745 : : nSdResId = bGraphicShell ? RID_GRAPHIC_3DSCENE_POPUP :
746 [ # # ]: 0 : RID_DRAW_3DSCENE_POPUP;
747 : : else
748 : : nSdResId = bGraphicShell ? RID_GRAPHIC_3DSCENE2_POPUP :
749 [ # # ]: 0 : RID_DRAW_3DSCENE2_POPUP;
750 : : }
751 : : else
752 : : nSdResId = bGraphicShell ? RID_GRAPHIC_3DOBJ_POPUP :
753 [ # # ]: 0 : RID_DRAW_3DOBJ_POPUP;
754 : : }
755 [ # # ]: 0 : else if( nInv == FmFormInventor )
756 : : {
757 : 0 : nSdResId = RID_FORM_CONTROL_POPUP;
758 : : }
759 : : }
760 : : }
761 : : }
762 : :
763 : : // Mehrfachselektion
764 [ # # # # ]: 0 : else if (mpDrawView->AreObjectsMarked() &&
[ # # ]
765 : 0 : mpDrawView->GetMarkedObjectList().GetMarkCount() > 1 )
766 : : {
767 : : nSdResId = bGraphicShell ? RID_GRAPHIC_MULTISELECTION_POPUP :
768 [ # # ]: 0 : RID_DRAW_MULTISELECTION_POPUP;
769 : : }
770 : :
771 : : // nichts selektiert
772 : : else
773 : : {
774 : : nSdResId = bGraphicShell ? RID_GRAPHIC_NOSEL_POPUP :
775 [ # # ]: 0 : RID_DRAW_NOSEL_POPUP;
776 : : }
777 : : }
778 : : // show Popup-Menu
779 [ # # ]: 0 : if (nSdResId)
780 : : {
781 [ # # ][ # # ]: 0 : GetActiveWindow()->ReleaseMouse();
782 : :
783 [ # # ]: 0 : if(rCEvt.IsMouseEvent())
784 [ # # ][ # # ]: 0 : GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(nSdResId));
[ # # ]
785 : : else
786 : : {
787 : : //don't open contextmenu at mouse position if not opened via mouse
788 : :
789 : : //middle of the window if nothing is marked
790 [ # # ][ # # ]: 0 : Point aMenuPos(GetActiveWindow()->GetSizePixel().Width()/2
791 [ # # ][ # # ]: 0 : ,GetActiveWindow()->GetSizePixel().Height()/2);
792 : :
793 : : //middle of the bounding rect if something is marked
794 [ # # ][ # # ]: 0 : if( mpDrawView->AreObjectsMarked() && mpDrawView->GetMarkedObjectList().GetMarkCount() >= 1 )
[ # # ]
795 : : {
796 [ # # ]: 0 : Rectangle aMarkRect;
797 [ # # ]: 0 : mpDrawView->GetMarkedObjectList().TakeBoundRect(NULL,aMarkRect);
798 [ # # ][ # # ]: 0 : aMenuPos = GetActiveWindow()->LogicToPixel( aMarkRect.Center() );
[ # # ]
799 : :
800 : : //move the point into the visible window area
801 [ # # ]: 0 : if( aMenuPos.X() < 0 )
802 : 0 : aMenuPos.X() = 0;
803 [ # # ]: 0 : if( aMenuPos.Y() < 0 )
804 : 0 : aMenuPos.Y() = 0;
805 [ # # ][ # # ]: 0 : if( aMenuPos.X() > GetActiveWindow()->GetSizePixel().Width() )
[ # # ]
806 [ # # ][ # # ]: 0 : aMenuPos.X() = GetActiveWindow()->GetSizePixel().Width();
807 [ # # ][ # # ]: 0 : if( aMenuPos.Y() > GetActiveWindow()->GetSizePixel().Height() )
[ # # ]
808 [ # # ][ # # ]: 0 : aMenuPos.Y() = GetActiveWindow()->GetSizePixel().Height();
809 : : }
810 : :
811 : : //open context menu at that point
812 [ # # ][ # # ]: 0 : GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(nSdResId),GetActiveWindow(),&aMenuPos);
[ # # ][ # # ]
813 : : }
814 : 0 : mbMousePosFreezed = sal_False;
815 : : }
816 : : }
817 : : else
818 : : {
819 : 0 : ViewShell::Command(rCEvt, pWin);
820 : : }
821 : : }
822 : : }
823 : :
824 : : /*************************************************************************
825 : : |*
826 : : |* Linealmarkierungen anzeigen
827 : : |*
828 : : \************************************************************************/
829 : :
830 : 0 : void DrawViewShell::ShowMousePosInfo(const Rectangle& rRect,
831 : : ::sd::Window* pWin)
832 : : {
833 [ # # ][ # # ]: 0 : if (mbHasRulers && pWin )
834 : : {
835 : : RulerLine pHLines[2];
836 : : RulerLine pVLines[2];
837 : 0 : long nHOffs = 0L;
838 : 0 : long nVOffs = 0L;
839 : : sal_uInt16 nCnt;
840 : :
841 [ # # ]: 0 : if (mpHorizontalRuler.get() != NULL)
842 [ # # ]: 0 : mpHorizontalRuler->SetLines();
843 : :
844 [ # # ]: 0 : if (mpVerticalRuler.get() != NULL)
845 [ # # ]: 0 : mpVerticalRuler->SetLines();
846 : :
847 [ # # ]: 0 : if (mpHorizontalRuler.get() != NULL)
848 : : {
849 [ # # ]: 0 : nHOffs = mpHorizontalRuler->GetNullOffset() +
850 [ # # ]: 0 : mpHorizontalRuler->GetPageOffset();
851 : : }
852 : :
853 [ # # ]: 0 : if (mpVerticalRuler.get() != NULL)
854 : : {
855 [ # # ]: 0 : nVOffs = mpVerticalRuler->GetNullOffset() +
856 [ # # ]: 0 : mpVerticalRuler->GetPageOffset();
857 : : }
858 : :
859 : 0 : nCnt = 1;
860 : 0 : pHLines[0].nPos = rRect.Left() - nHOffs;
861 : 0 : pVLines[0].nPos = rRect.Top() - nVOffs;
862 : 0 : pHLines[0].nStyle = 0;
863 : 0 : pVLines[0].nStyle = 0;
864 : :
865 [ # # ][ # # ]: 0 : if ( rRect.Right() != rRect.Left() || rRect.Bottom() != rRect.Top() )
[ # # ]
866 : : {
867 : 0 : pHLines[1].nPos = rRect.Right() - nHOffs;
868 : 0 : pVLines[1].nPos = rRect.Bottom() - nVOffs;
869 : 0 : pHLines[1].nStyle = 0;
870 : 0 : pVLines[1].nStyle = 0;
871 : 0 : nCnt++;
872 : : }
873 : :
874 [ # # ]: 0 : if (mpHorizontalRuler.get() != NULL)
875 [ # # ]: 0 : mpHorizontalRuler->SetLines(nCnt, pHLines);
876 [ # # ]: 0 : if (mpVerticalRuler.get() != NULL)
877 [ # # ]: 0 : mpVerticalRuler->SetLines(nCnt, pVLines);
878 : : }
879 : :
880 : : // StatusBar Koordinatenanzeige
881 : : OSL_ASSERT (GetViewShell()!=NULL);
882 [ # # ]: 0 : if ( !GetViewShell()->GetUIActiveClient() )
883 : : {
884 : 0 : SfxItemSet aSet(GetPool(), SID_CONTEXT, SID_CONTEXT,
885 : : SID_ATTR_POSITION, SID_ATTR_POSITION,
886 : : SID_ATTR_SIZE, SID_ATTR_SIZE,
887 [ # # ]: 0 : 0L);
888 : :
889 : : // GetStatusBarState(aSet); nicht performant bei gedrueckter Modifiertaste!!
890 : :
891 [ # # ][ # # ]: 0 : aSet.Put( SfxStringItem( SID_CONTEXT, mpDrawView->GetStatusText() ) );
[ # # ][ # # ]
[ # # ]
892 : :
893 [ # # ]: 0 : SfxBindings& rBindings = GetViewFrame()->GetBindings();
894 [ # # ]: 0 : rBindings.SetState(aSet);
895 [ # # ]: 0 : rBindings.Invalidate(SID_CONTEXT);
896 [ # # ]: 0 : rBindings.Invalidate(SID_ATTR_POSITION);
897 [ # # ][ # # ]: 0 : rBindings.Invalidate(SID_ATTR_SIZE);
898 : : }
899 : 0 : }
900 : :
901 : 0 : void DrawViewShell::LockInput()
902 : : {
903 : 0 : mnLockCount++;
904 : 0 : }
905 : :
906 : 0 : void DrawViewShell::UnlockInput()
907 : : {
908 : : DBG_ASSERT( mnLockCount, "Input for this shell is not locked!" );
909 [ # # ]: 0 : if ( mnLockCount )
910 : 0 : mnLockCount--;
911 : 0 : }
912 : :
913 : :
914 : :
915 : :
916 : 0 : void DrawViewShell::ShowSnapLineContextMenu (
917 : : SdrPageView& rPageView,
918 : : const sal_uInt16 nSnapLineIndex,
919 : : const Point& rMouseLocation)
920 : : {
921 [ # # ]: 0 : const SdrHelpLine& rHelpLine (rPageView.GetHelpLines()[nSnapLineIndex]);
922 [ # # ][ # # ]: 0 : ::boost::scoped_ptr<PopupMenu> pMenu (new PopupMenu ());
923 : :
924 [ # # ]: 0 : if (rHelpLine.GetKind() == SDRHELPLINE_POINT)
925 : : {
926 : 0 : pMenu->InsertItem(
927 : : SID_SET_SNAPITEM,
928 [ # # ]: 0 : String(SdResId(STR_POPUP_EDIT_SNAPPOINT)));
[ # # # # ]
[ # # ]
929 [ # # ]: 0 : pMenu->InsertSeparator();
930 : 0 : pMenu->InsertItem(
931 : : SID_DELETE_SNAPITEM,
932 [ # # ]: 0 : String(SdResId(STR_POPUP_DELETE_SNAPPOINT)));
[ # # # # ]
[ # # ]
933 : : }
934 : : else
935 : : {
936 : 0 : pMenu->InsertItem(
937 : : SID_SET_SNAPITEM,
938 [ # # ]: 0 : String(SdResId(STR_POPUP_EDIT_SNAPLINE)));
[ # # # # ]
[ # # ]
939 [ # # ]: 0 : pMenu->InsertSeparator();
940 : 0 : pMenu->InsertItem(
941 : : SID_DELETE_SNAPITEM,
942 [ # # ]: 0 : String(SdResId(STR_POPUP_DELETE_SNAPLINE)));
[ # # # # ]
[ # # ]
943 : : }
944 : :
945 [ # # ]: 0 : pMenu->RemoveDisabledEntries(sal_False, sal_False);
946 : :
947 : : const sal_uInt16 nResult = pMenu->Execute(
948 [ # # ]: 0 : GetActiveWindow(),
949 : : Rectangle(rMouseLocation, Size(10,10)),
950 [ # # ][ # # ]: 0 : POPUPMENU_EXECUTE_DOWN);
951 [ # # # ]: 0 : switch (nResult)
952 : : {
953 : : case SID_SET_SNAPITEM:
954 : : {
955 [ # # ]: 0 : SfxUInt32Item aHelpLineItem (ID_VAL_INDEX, nSnapLineIndex);
956 : 0 : const SfxPoolItem* aArguments[] = {&aHelpLineItem, NULL};
957 : : GetViewFrame()->GetDispatcher()->Execute(
958 : : SID_SET_SNAPITEM,
959 : : SFX_CALLMODE_SLOT,
960 [ # # ][ # # ]: 0 : aArguments);
[ # # ]
961 : : }
962 : 0 : break;
963 : :
964 : : case SID_DELETE_SNAPITEM:
965 : : {
966 [ # # ]: 0 : rPageView.DeleteHelpLine(nSnapLineIndex);
967 : : }
968 : 0 : break;
969 : :
970 : : default:
971 : 0 : break;
972 [ # # ]: 0 : }
973 : 0 : }
974 : :
975 : :
976 : :
977 : :
978 : : #ifdef _MSC_VER
979 : : #pragma optimize ( "", on )
980 : : #endif
981 : :
982 : : } // end of namespace sd
983 : :
984 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|