1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drviews4.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
36 #include "DrawViewShell.hxx"
37 #include <vcl/msgbox.hxx>
38 #include <svtools/urlbmk.hxx>
39 #include <svx/svdpagv.hxx>
40 #include <svx/svdundo.hxx>
41 #include <svx/fmglob.hxx>
42 #include <svx/eeitem.hxx>
44 #include <svx/flditem.hxx>
47 #include <svx/svxids.hrc>
49 #include <svx/ruler.hxx>
51 #include <svx/globl3d.hxx>
53 #include <svx/outliner.hxx>
54 #ifndef _SFX_CLIENTSH_HXX
55 #include <sfx2/ipclient.hxx>
57 #include <sfx2/request.hxx>
58 #include <sfx2/dispatch.hxx>
59 #include <svx/svdopath.hxx>
60 #include <sfx2/viewfrm.hxx>
61 #include <svx/editview.hxx>
62 #include <vcl/cursor.hxx>
67 #include "strings.hrc"
68 #include "res_bmp.hrc"
69 #include "DrawDocShell.hxx"
70 #include "drawdoc.hxx"
73 #include "fusnapln.hxx"
76 #include "sdresid.hxx"
77 #include "GraphicViewShell.hxx"
79 #include "slideshow.hxx"
80 #include "anminfo.hxx"
81 #include "sdpopup.hxx"
82 #include "drawview.hxx"
83 #include <svx/bmpmask.hxx>
84 #include "LayerTabBar.hxx"
87 #include <svx/svditer.hxx>
91 #define PIPETTE_RANGE 0
94 #pragma optimize ( "", off )
97 using namespace ::com::sun::star::uno
;
98 using namespace ::com::sun::star::drawing
;
100 /*************************************************************************
102 |* aktuelle Seite loeschen
104 \************************************************************************/
106 void DrawViewShell::DeleteActualPage()
108 USHORT nPage
= maTabControl
.GetCurPageId() - 1;
110 mpDrawView
->SdrEndTextEdit();
114 Reference
<XDrawPagesSupplier
> xDrawPagesSupplier( GetDoc()->getUnoModel(), UNO_QUERY_THROW
);
115 Reference
<XDrawPages
> xPages( xDrawPagesSupplier
->getDrawPages(), UNO_QUERY_THROW
);
116 Reference
< XDrawPage
> xPage( xPages
->getByIndex( nPage
), UNO_QUERY_THROW
);
117 xPages
->remove( xPage
);
121 DBG_ERROR("SelectionManager::DeleteSelectedMasterPages(), exception caught!");
125 /*************************************************************************
127 |* aktuelle Ebene loeschen
129 \************************************************************************/
131 void DrawViewShell::DeleteActualLayer()
133 SdrLayerAdmin
& rAdmin
= GetDoc()->GetLayerAdmin();
134 const String
& rName
= GetLayerTabControl()->GetPageText(GetLayerTabControl()->GetCurPageId());
135 String
aString(SdResId(STR_ASK_DELETE_LAYER
));
137 // Platzhalter ersetzen
138 USHORT nPos
= aString
.Search(sal_Unicode('$'));
139 aString
.Erase(nPos
, 1);
140 aString
.Insert(rName
, nPos
);
142 if (QueryBox(GetActiveWindow(), WB_YES_NO
, aString
).Execute() == RET_YES
)
144 const SdrLayer
* pLayer
= rAdmin
.GetLayer(rName
, FALSE
);
145 mpDrawView
->DeleteLayer( pLayer
->GetName() );
147 // damit TabBar und Window neu gezeichnet werden;
148 // sollte spaeter wie beim Aendern der Layerfolge durch einen
149 // Hint von Joe angestossen werden
150 // ( View::Notify() --> ViewShell::ResetActualLayer() )
152 mbIsLayerModeActive
= false; // damit ChangeEditMode() ueberhaupt was tut
153 ChangeEditMode(GetEditMode(), true);
158 /*************************************************************************
162 \************************************************************************/
164 BOOL
DrawViewShell::KeyInput (const KeyEvent
& rKEvt
, ::sd::Window
* pWin
)
168 if ( !IsInputLocked() || ( rKEvt
.GetKeyCode().GetCode() == KEY_ESCAPE
) )
171 if(KEY_RETURN
== rKEvt
.GetKeyCode().GetCode()
172 && rKEvt
.GetKeyCode().IsMod1()
173 && GetView()->IsTextEdit())
175 // this should be used for cursor travelling.
176 SdPage
* pActualPage
= GetActualPage();
177 const SdrMarkList
& rMarkList
= GetView()->GetMarkedObjectList();
178 SdrTextObj
* pCandidate
= 0L;
180 if(pActualPage
&& 1 == rMarkList
.GetMarkCount())
182 SdrMark
* pMark
= rMarkList
.GetMark(0);
184 // remember which object was the text in edit mode
185 SdrObject
* pOldObj
= pMark
->GetMarkedSdrObj();
188 GetView()->SdrEndTextEdit();
190 // look for a new candidate, a successor of pOldObj
191 SdrObjListIter
aIter(*pActualPage
, IM_DEEPNOGROUPS
);
192 BOOL
bDidVisitOldObject(FALSE
);
194 while(aIter
.IsMore() && !pCandidate
)
196 SdrObject
* pObj
= aIter
.Next();
198 if(pObj
&& pObj
->ISA(SdrTextObj
))
200 sal_uInt32
nInv(pObj
->GetObjInventor());
201 sal_uInt16
nKnd(pObj
->GetObjIdentifier());
203 if(SdrInventor
== nInv
&&
204 (OBJ_TITLETEXT
== nKnd
|| OBJ_OUTLINETEXT
== nKnd
|| OBJ_TEXT
== nKnd
)
205 && bDidVisitOldObject
)
207 pCandidate
= (SdrTextObj
*)pObj
;
212 bDidVisitOldObject
= TRUE
;
220 // set the new candidate to text edit mode
221 GetView()->UnMarkAll();
222 GetView()->MarkObj(pCandidate
, GetView()->GetSdrPageView());
224 GetViewFrame()->GetDispatcher()->Execute(
225 SID_ATTR_CHAR
, SFX_CALLMODE_ASYNCHRON
);
229 // insert a new page with the same page layout
230 GetViewFrame()->GetDispatcher()->Execute(
231 SID_INSERTPAGE_QUICK
, SFX_CALLMODE_ASYNCHRON
);
236 bRet
= ViewShell::KeyInput(rKEvt
, pWin
);
243 /*************************************************************************
245 |* Vom Lineal ausgehenden Drag (Hilflinien, Ursprung) beginnen
247 \************************************************************************/
249 void DrawViewShell::StartRulerDrag (
251 const MouseEvent
& rMEvt
)
253 GetActiveWindow()->CaptureMouse();
255 Point aWPos
= GetActiveWindow()->PixelToLogic(GetActiveWindow()->GetPointerPosPixel());
257 if ( rRuler
.GetExtraRect().IsInside(rMEvt
.GetPosPixel()) )
259 mpDrawView
->BegSetPageOrg(aWPos
);
260 mbIsRulerDrag
= TRUE
;
264 // #i34536# if no guide-lines are visible yet, that show them
265 if( ! mpDrawView
->IsHlplVisible())
266 mpDrawView
->SetHlplVisible( TRUE
);
268 SdrHelpLineKind eKind
;
270 if ( rMEvt
.IsMod1() )
271 eKind
= SDRHELPLINE_POINT
;
272 else if ( rRuler
.IsHorizontal() )
273 eKind
= SDRHELPLINE_HORIZONTAL
;
275 eKind
= SDRHELPLINE_VERTICAL
;
277 mpDrawView
->BegDragHelpLine(aWPos
, eKind
);
278 mbIsRulerDrag
= TRUE
;
282 /*************************************************************************
284 |* MouseButtonDown event
286 \************************************************************************/
288 void DrawViewShell::MouseButtonDown(const MouseEvent
& rMEvt
,
291 // We have to check if a context menu is shown and we have an UI
292 // active inplace client. In that case we have to ignore the mouse
293 // button down event. Otherwise we would crash (context menu has been
294 // opened by inplace client and we would deactivate the inplace client,
295 // the contex menu is closed by VCL asynchronously which in the end
296 // would work on deleted objects or the context menu has no parent anymore)
297 // See #126086# and #128122#
298 SfxInPlaceClient
* pIPClient
= GetViewShell()->GetIPClient();
299 BOOL bIsOleActive
= ( pIPClient
&& pIPClient
->IsObjectInPlaceActive() );
301 if ( bIsOleActive
&& PopupMenu::IsInExecute() )
304 if ( !IsInputLocked() )
306 ViewShell::MouseButtonDown(rMEvt
, pWin
);
309 ( (SvxBmpMask
*) GetViewFrame()->GetChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )->PipetteClicked();
313 /*************************************************************************
317 \************************************************************************/
320 void DrawViewShell::MouseMove(const MouseEvent
& rMEvt
, ::sd::Window
* pWin
)
322 if ( !IsInputLocked() )
324 if ( mpDrawView
->IsAction() )
326 Rectangle
aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel());
328 if ( !aOutputArea
.IsInside(rMEvt
.GetPosPixel()) )
330 BOOL bInsideOtherWindow
= FALSE
;
332 if (mpContentWindow
.get() != NULL
)
334 aOutputArea
= Rectangle(Point(0,0),
335 mpContentWindow
->GetOutputSizePixel());
337 Point aPos
= mpContentWindow
->GetPointerPosPixel();
338 if ( aOutputArea
.IsInside(aPos
) )
339 bInsideOtherWindow
= TRUE
;
342 if (! GetActiveWindow()->HasFocus ())
344 GetActiveWindow()->ReleaseMouse ();
345 mpDrawView
->BrkAction ();
348 else if ( bInsideOtherWindow
)
350 GetActiveWindow()->ReleaseMouse();
351 pWin
->CaptureMouse ();
354 else if ( pWin
!= GetActiveWindow() )
355 pWin
->CaptureMouse();
359 // Since the next MouseMove may execute a IsSolidDraggingNow() in
360 // SdrCreateView::MovCreateObj and there the ApplicationBackgroundColor
361 // is needed it is necessary to set it here.
362 if(mpDrawView
!=NULL
&& GetDoc()!=NULL
)
364 svtools::ColorConfig aColorConfig
;
367 if(DOCUMENT_TYPE_IMPRESS
== GetDoc()->GetDocumentType())
369 aFillColor
= Color( aColorConfig
.GetColorValue( svtools::APPBACKGROUND
).nColor
);
373 aFillColor
= Color( aColorConfig
.GetColorValue( svtools::DOCCOLOR
).nColor
);
376 mpDrawView
->SetApplicationBackgroundColor(aFillColor
);
379 ViewShell::MouseMove(rMEvt
, pWin
);
381 if( !mbMousePosFreezed
)
382 maMousePos
= rMEvt
.GetPosPixel();
388 Point aLogPos
= GetActiveWindow()->PixelToLogic(maMousePos
);
389 mpDrawView
->MovAction(aLogPos
);
392 if ( mpDrawView
->IsAction() )
394 mpDrawView
->TakeActionRect(aRect
);
395 aRect
= GetActiveWindow()->LogicToPixel(aRect
);
399 aRect
= Rectangle(maMousePos
, maMousePos
);
402 ShowMousePosInfo(aRect
, pWin
);
404 if ( mbPipette
&& GetViewFrame()->HasChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() ) )
406 const long nStartX
= maMousePos
.X() - PIPETTE_RANGE
;
407 const long nEndX
= maMousePos
.X() + PIPETTE_RANGE
;
408 const long nStartY
= maMousePos
.Y() - PIPETTE_RANGE
;
409 const long nEndY
= maMousePos
.Y() + PIPETTE_RANGE
;
413 const double fDiv
= ( ( PIPETTE_RANGE
<< 1 ) + 1 ) * ( ( PIPETTE_RANGE
<< 1 ) + 1 );
415 for ( long nY
= nStartY
; nY
<= nEndY
; nY
++ )
417 for( long nX
= nStartX
; nX
<= nEndX
; nX
++ )
419 const Color
aCol( pWin
->GetPixel( pWin
->PixelToLogic( Point( nX
, nY
) ) ) );
421 nRed
+= aCol
.GetRed();
422 nGreen
+= aCol
.GetGreen();
423 nBlue
+= aCol
.GetBlue();
427 ( (SvxBmpMask
*) GetViewFrame()->GetChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )->
428 SetColor( Color( (BYTE
) ( nRed
/ fDiv
+ .5 ),
429 (BYTE
) ( nGreen
/ fDiv
+ .5 ),
430 (BYTE
) ( nBlue
/ fDiv
+ .5 ) ) );
436 /*************************************************************************
438 |* MouseButtonUp event
440 \************************************************************************/
442 void DrawViewShell::MouseButtonUp(const MouseEvent
& rMEvt
, ::sd::Window
* pWin
)
444 if ( !IsInputLocked() )
446 FASTBOOL bIsSetPageOrg
= mpDrawView
->IsSetPageOrg();
450 Rectangle
aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel());
452 if (aOutputArea
.IsInside(rMEvt
.GetPosPixel()))
454 mpDrawView
->EndAction();
457 GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET
);
459 else if (rMEvt
.IsLeft() && bIsSetPageOrg
)
461 mpDrawView
->BrkAction();
462 SdPage
* pPage
= (SdPage
*) mpDrawView
->GetSdrPageView()->GetPage();
463 Point
aOrg(pPage
->GetLftBorder(), pPage
->GetUppBorder());
464 mpDrawView
->GetSdrPageView()->SetPageOrigin(aOrg
);
465 GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET
);
469 mpDrawView
->BrkAction();
472 GetActiveWindow()->ReleaseMouse();
473 mbIsRulerDrag
= FALSE
;
476 ViewShell::MouseButtonUp(rMEvt
, pWin
);
480 /*************************************************************************
484 \************************************************************************/
486 void DrawViewShell::Command(const CommandEvent
& rCEvt
, ::sd::Window
* pWin
)
488 // The command event is send to the window after a possible context
489 // menu from an inplace client is closed. Now we have the chance to
490 // deactivate the inplace client without any problem regarding parent
491 // windows and code on the stack.
492 // For more information, see #126086# and #128122#
493 SfxInPlaceClient
* pIPClient
= GetViewShell()->GetIPClient();
494 BOOL bIsOleActive
= ( pIPClient
&& pIPClient
->IsObjectInPlaceActive() );
495 if ( bIsOleActive
&& ( rCEvt
.GetCommand() == COMMAND_CONTEXTMENU
))
497 // Deactivate OLE object
498 mpDrawView
->UnmarkAll();
499 SelectionHasChanged();
503 if ( !IsInputLocked() )
505 if( GetView() &&GetView()->getSmartTags().Command(rCEvt
) )
508 const bool bNativeShow (SlideShow::IsRunning(GetViewShellBase()));
510 if( rCEvt
.GetCommand() == COMMAND_PASTESELECTION
&& !bNativeShow
)
512 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSelection( GetActiveWindow() ) );
514 if( aDataHelper
.GetTransferable().is() )
517 sal_Int8 nDnDAction
= DND_ACTION_COPY
;
519 if( GetActiveWindow() )
520 aPos
= GetActiveWindow()->PixelToLogic( rCEvt
.GetMousePosPixel() );
522 if( !mpDrawView
->InsertData( aDataHelper
, aPos
, nDnDAction
, FALSE
) )
524 INetBookmark
aINetBookmark( aEmptyStr
, aEmptyStr
);
526 if( ( aDataHelper
.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK
) &&
527 aDataHelper
.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK
, aINetBookmark
) ) ||
528 ( aDataHelper
.HasFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR
) &&
529 aDataHelper
.GetINetBookmark( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR
, aINetBookmark
) ) ||
530 ( aDataHelper
.HasFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR
) &&
531 aDataHelper
.GetINetBookmark( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR
, aINetBookmark
) ) )
533 InsertURLField( aINetBookmark
.GetURL(), aINetBookmark
.GetDescription(), aEmptyStr
, NULL
);
538 else if( rCEvt
.GetCommand() == COMMAND_CONTEXTMENU
&& !bNativeShow
&&
539 pWin
!= NULL
&& !mpDrawView
->IsAction() && !SD_MOD()->GetWaterCan() )
541 USHORT nSdResId
= 0; // ResourceID fuer Popup-Menue
542 BOOL bGraphicShell
= this->ISA(GraphicViewShell
);
544 // Ist ein Fangobjekt unter dem Mauszeiger?
546 Point aMPos
= pWin
->PixelToLogic( maMousePos
);
547 USHORT nHitLog
= (USHORT
) GetActiveWindow()->PixelToLogic(
548 Size(FuPoor::HITPIX
, 0 ) ).Width();
551 SdrObject
* pObj
= NULL
;
554 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
555 const SvxFieldItem
* pFldItem
= NULL
;
557 pFldItem
= pOLV
->GetFieldAtSelection();
558 //pFldItem = pOLV->GetFieldUnderMousePointer();
561 if ( mpDrawView
->PickHelpLine( aMPos
, nHitLog
, *GetActiveWindow(), nHelpLine
, pPV
) )
563 nSdResId
= RID_DRAW_SNAPOBJECT_POPUP
;
564 ShowSnapLineContextMenu(*pPV
, nHelpLine
, rCEvt
.GetMousePosPixel());
567 // Klebepunkt unter dem Mauszeiger markiert?
568 else if( mpDrawView
->PickGluePoint( aMPos
, pObj
, nPickId
, pPV
) &&
569 mpDrawView
->IsGluePointMarked( pObj
, nPickId
) )
571 nSdResId
= RID_DRAW_GLUEPOINT_POPUP
;
574 else if( pFldItem
&& (pFldItem
->GetField()->ISA( SvxDateField
) ||
575 pFldItem
->GetField()->ISA( SvxExtTimeField
) ||
576 pFldItem
->GetField()->ISA( SvxExtFileField
) ||
577 pFldItem
->GetField()->ISA( SvxAuthorField
) ) )
579 LanguageType
eLanguage( LANGUAGE_SYSTEM
);
581 // #101743# Format popup with outliner language, if possible
582 if( pOLV
->GetOutliner() )
584 ESelection
aSelection( pOLV
->GetSelection() );
585 eLanguage
= pOLV
->GetOutliner()->GetLanguage( aSelection
.nStartPara
, aSelection
.nStartPos
);
588 SdFieldPopup
aFieldPopup( pFldItem
->GetField(), eLanguage
);
590 if ( rCEvt
.IsMouseEvent() )
591 aMPos
= rCEvt
.GetMousePosPixel();
593 aMPos
= Point( 20, 20 );
594 aFieldPopup
.Execute( pWin
, aMPos
);
596 SvxFieldData
* pField
= aFieldPopup
.GetField();
599 SvxFieldItem
aFieldItem( *pField
, EE_FEATURE_FIELD
);
600 //pOLV->DeleteSelected(); <-- fehlt leider !
601 // Feld selektieren, so dass es beim Insert geloescht wird
602 ESelection aSel
= pOLV
->GetSelection();
604 if( aSel
.nStartPos
== aSel
.nEndPos
)
609 pOLV
->SetSelection( aSel
);
611 pOLV
->InsertField( aFieldItem
);
613 // Selektion wird wieder in den Ursprungszustand gebracht
616 pOLV
->SetSelection( aSel
);
623 // ist etwas selektiert?
624 if (mpDrawView
->AreObjectsMarked() &&
625 mpDrawView
->GetMarkedObjectList().GetMarkCount() == 1 )
627 pObj
= mpDrawView
->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
628 if( HasCurrentFunction(SID_BEZIER_EDIT
) && (dynamic_cast< SdrPathObj
* >( pObj
) != 0 ) )
630 nSdResId
= RID_BEZIER_POPUP
;
634 if( mpDrawView
->GetTextEditObject() )
636 OutlinerView
* pOutlinerView
= mpDrawView
->GetTextEditOutlinerView();
637 Point
aPos(rCEvt
.GetMousePosPixel());
641 if( ( rCEvt
.IsMouseEvent() && pOutlinerView
->IsWrongSpelledWordAtPos(aPos
) ) ||
642 ( !rCEvt
.IsMouseEvent() && pOutlinerView
->IsCursorAtWrongSpelledWord() ) )
644 // #91457# Popup for Online-Spelling now handled by DrawDocShell
645 // Link aLink = LINK(GetDoc(), SdDrawDocument, OnlineSpellCallback);
646 Link aLink
= LINK(GetDocSh(), DrawDocShell
, OnlineSpellCallback
);
648 if( !rCEvt
.IsMouseEvent() )
650 aPos
= GetActiveWindow()->LogicToPixel( pOutlinerView
->GetEditView().GetCursor()->GetPos() );
652 // While showing the spell context menu
653 // we lock the input so that another
654 // context menu can not be opened during
655 // that time (crash #i43235#). In order
656 // to not lock the UI completely we
657 // first release the mouse.
658 GetActiveWindow()->ReleaseMouse();
660 pOutlinerView
->ExecuteSpellPopup(aPos
, &aLink
);
665 if( (pObj
->GetObjInventor() == SdrInventor
) && (pObj
->GetObjIdentifier() == OBJ_TABLE
) )
667 nSdResId
= RID_DRAW_TABLEOBJ_INSIDE_POPUP
;
671 nSdResId
= RID_DRAW_TEXTOBJ_INSIDE_POPUP
;
678 UINT32 nInv
= pObj
->GetObjInventor();
679 UINT16 nId
= pObj
->GetObjIdentifier();
681 if (nInv
== SdrInventor
)
685 case OBJ_OUTLINETEXT
:
686 nSdResId
= bGraphicShell
? RID_GRAPHIC_OUTLINETEXTOBJ_POPUP
:
687 RID_DRAW_OUTLINETEXTOBJ_POPUP
;
693 nSdResId
= bGraphicShell
? RID_GRAPHIC_TEXTOBJ_POPUP
:
694 RID_DRAW_TEXTOBJ_POPUP
;
699 nSdResId
= bGraphicShell
? RID_GRAPHIC_POLYLINEOBJ_POPUP
:
700 RID_DRAW_POLYLINEOBJ_POPUP
;
704 case OBJ_EDGE
: // Connector
705 nSdResId
= bGraphicShell
? RID_GRAPHIC_EDGEOBJ_POPUP
:
706 RID_DRAW_EDGEOBJ_POPUP
;
710 nSdResId
= bGraphicShell
? RID_GRAPHIC_LINEOBJ_POPUP
:
711 RID_DRAW_LINEOBJ_POPUP
;
715 nSdResId
= bGraphicShell
? RID_GRAPHIC_MEASUREOBJ_POPUP
:
716 RID_DRAW_MEASUREOBJ_POPUP
;
727 nSdResId
= bGraphicShell
? RID_GRAPHIC_GEOMOBJ_POPUP
:
728 RID_DRAW_GEOMOBJ_POPUP
;
731 case OBJ_CUSTOMSHAPE
:
732 nSdResId
= bGraphicShell
? RID_GRAPHIC_CUSTOMSHAPE_POPUP
:
733 RID_DRAW_CUSTOMSHAPE_POPUP
;
737 nSdResId
= bGraphicShell
? RID_GRAPHIC_GROUPOBJ_POPUP
:
738 RID_DRAW_GROUPOBJ_POPUP
;
742 nSdResId
= bGraphicShell
? RID_GRAPHIC_GRAPHIC_POPUP
:
743 RID_DRAW_GRAPHIC_POPUP
;
747 nSdResId
= bGraphicShell
? RID_GRAPHIC_OLE2_POPUP
:
751 nSdResId
= bGraphicShell
? RID_GRAPHIC_MEDIA_POPUP
:
752 RID_DRAW_MEDIA_POPUP
;
755 nSdResId
= bGraphicShell
? RID_GRAPHIC_TABLE_POPUP
:
756 RID_DRAW_TABLE_POPUP
;
760 else if( nInv
== E3dInventor
/*&& nId == E3D_POLYSCENE_ID*/)
762 if( nId
== E3D_POLYSCENE_ID
|| nId
== E3D_SCENE_ID
)
764 if( !mpDrawView
->IsGroupEntered() )
765 nSdResId
= bGraphicShell
? RID_GRAPHIC_3DSCENE_POPUP
:
766 RID_DRAW_3DSCENE_POPUP
;
768 nSdResId
= bGraphicShell
? RID_GRAPHIC_3DSCENE2_POPUP
:
769 RID_DRAW_3DSCENE2_POPUP
;
772 nSdResId
= bGraphicShell
? RID_GRAPHIC_3DOBJ_POPUP
:
773 RID_DRAW_3DOBJ_POPUP
;
775 else if( nInv
== FmFormInventor
)
777 nSdResId
= RID_FORM_CONTROL_POPUP
;
784 else if (mpDrawView
->AreObjectsMarked() &&
785 mpDrawView
->GetMarkedObjectList().GetMarkCount() > 1 )
787 nSdResId
= bGraphicShell
? RID_GRAPHIC_MULTISELECTION_POPUP
:
788 RID_DRAW_MULTISELECTION_POPUP
;
794 nSdResId
= bGraphicShell
? RID_GRAPHIC_NOSEL_POPUP
:
795 RID_DRAW_NOSEL_POPUP
;
798 // Popup-Menue anzeigen
801 GetActiveWindow()->ReleaseMouse();
803 if(rCEvt
.IsMouseEvent())
804 GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(nSdResId
));
807 //#106326# don't open contextmenu at mouse position if not opened via mouse
809 //middle of the window if nothing is marked
810 Point
aMenuPos(GetActiveWindow()->GetSizePixel().Width()/2
811 ,GetActiveWindow()->GetSizePixel().Height()/2);
813 //middle of the bounding rect if something is marked
814 if( mpDrawView
->AreObjectsMarked() && mpDrawView
->GetMarkedObjectList().GetMarkCount() >= 1 )
817 mpDrawView
->GetMarkedObjectList().TakeBoundRect(NULL
,aMarkRect
);
818 aMenuPos
= GetActiveWindow()->LogicToPixel( aMarkRect
.Center() );
820 //move the point into the visible window area
821 if( aMenuPos
.X() < 0 )
823 if( aMenuPos
.Y() < 0 )
825 if( aMenuPos
.X() > GetActiveWindow()->GetSizePixel().Width() )
826 aMenuPos
.X() = GetActiveWindow()->GetSizePixel().Width();
827 if( aMenuPos
.Y() > GetActiveWindow()->GetSizePixel().Height() )
828 aMenuPos
.Y() = GetActiveWindow()->GetSizePixel().Height();
831 //open context menu at that point
832 GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(nSdResId
),GetActiveWindow(),&aMenuPos
);
834 mbMousePosFreezed
= FALSE
;
839 ViewShell::Command(rCEvt
, pWin
);
844 /*************************************************************************
846 |* Linealmarkierungen anzeigen
848 \************************************************************************/
850 void DrawViewShell::ShowMousePosInfo(const Rectangle
& rRect
,
853 if (mbHasRulers
&& pWin
)
855 RulerLine pHLines
[2];
856 RulerLine pVLines
[2];
861 if (mpHorizontalRuler
.get() != NULL
)
862 mpHorizontalRuler
->SetLines();
864 if (mpVerticalRuler
.get() != NULL
)
865 mpVerticalRuler
->SetLines();
867 if (mpHorizontalRuler
.get() != NULL
)
869 nHOffs
= mpHorizontalRuler
->GetNullOffset() +
870 mpHorizontalRuler
->GetPageOffset();
873 if (mpVerticalRuler
.get() != NULL
)
875 nVOffs
= mpVerticalRuler
->GetNullOffset() +
876 mpVerticalRuler
->GetPageOffset();
880 pHLines
[0].nPos
= rRect
.Left() - nHOffs
;
881 pVLines
[0].nPos
= rRect
.Top() - nVOffs
;
882 pHLines
[0].nStyle
= 0;
883 pVLines
[0].nStyle
= 0;
885 if ( rRect
.Right() != rRect
.Left() || rRect
.Bottom() != rRect
.Top() )
887 pHLines
[1].nPos
= rRect
.Right() - nHOffs
;
888 pVLines
[1].nPos
= rRect
.Bottom() - nVOffs
;
889 pHLines
[1].nStyle
= 0;
890 pVLines
[1].nStyle
= 0;
894 if (mpHorizontalRuler
.get() != NULL
)
895 mpHorizontalRuler
->SetLines(nCnt
, pHLines
);
896 if (mpVerticalRuler
.get() != NULL
)
897 mpVerticalRuler
->SetLines(nCnt
, pVLines
);
900 // StatusBar Koordinatenanzeige
901 OSL_ASSERT (GetViewShell()!=NULL
);
902 if ( !GetViewShell()->GetUIActiveClient() )
904 SfxItemSet
aSet(GetPool(), SID_CONTEXT
, SID_CONTEXT
,
905 SID_ATTR_POSITION
, SID_ATTR_POSITION
,
906 SID_ATTR_SIZE
, SID_ATTR_SIZE
,
909 // GetStatusBarState(aSet); nicht performant bei gedrueckter Modifiertaste!!
911 aSet
.Put( SfxStringItem( SID_CONTEXT
, mpDrawView
->GetStatusText() ) );
913 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
914 rBindings
.SetState(aSet
);
915 rBindings
.Invalidate(SID_CONTEXT
);
916 rBindings
.Invalidate(SID_ATTR_POSITION
);
917 rBindings
.Invalidate(SID_ATTR_SIZE
);
921 /*************************************************************************
925 \************************************************************************/
927 void DrawViewShell::LockInput()
932 /*************************************************************************
936 \************************************************************************/
938 void DrawViewShell::UnlockInput()
940 DBG_ASSERT( mnLockCount
, "Input for this shell is not locked!" );
948 void DrawViewShell::ShowSnapLineContextMenu (
949 SdrPageView
& rPageView
,
950 const USHORT nSnapLineIndex
,
951 const Point
& rMouseLocation
)
953 const SdrHelpLine
& rHelpLine (rPageView
.GetHelpLines()[nSnapLineIndex
]);
954 ::boost::scoped_ptr
<PopupMenu
> pMenu (new PopupMenu ());
956 if (rHelpLine
.GetKind() == SDRHELPLINE_POINT
)
960 String(SdResId(STR_POPUP_EDIT_SNAPPOINT
)));
961 pMenu
->InsertSeparator();
964 String(SdResId(STR_POPUP_DELETE_SNAPPOINT
)));
970 String(SdResId(STR_POPUP_EDIT_SNAPLINE
)));
971 pMenu
->InsertSeparator();
974 String(SdResId(STR_POPUP_DELETE_SNAPLINE
)));
977 pMenu
->RemoveDisabledEntries(FALSE
, FALSE
);
979 const USHORT nResult
= pMenu
->Execute(
981 Rectangle(rMouseLocation
, Size(10,10)),
982 POPUPMENU_EXECUTE_DOWN
);
985 case SID_SET_SNAPITEM
:
987 SfxUInt32Item
aHelpLineItem (ID_VAL_INDEX
, nSnapLineIndex
);
988 const SfxPoolItem
* aArguments
[] = {&aHelpLineItem
, NULL
};
989 GetViewFrame()->GetDispatcher()->Execute(
996 case SID_DELETE_SNAPITEM
:
998 rPageView
.DeleteHelpLine(nSnapLineIndex
);
1011 #pragma optimize ( "", on )
1014 } // end of namespace sd