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: drviewsc.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 "DrawViewShell.hxx"
35 #include "ViewShellImplementation.hxx"
36 #include <vcl/waitobj.hxx>
39 #include <svx/svxids.hrc>
41 #include <svx/dialogs.hrc>
43 #include <svx/imapdlg.hxx>
45 #include <vcl/msgbox.hxx>
46 #include <sfx2/request.hxx>
47 #include <svx/svdogrp.hxx>
48 #include <svx/svdoole2.hxx>
49 #include <svx/svdograf.hxx>
50 #include <svx/svxdlg.hxx>
51 #ifndef _BINDING_HXX //autogen
52 #include <sfx2/bindings.hxx>
54 #include <sfx2/dispatch.hxx>
55 #include <svx/svdoole2.hxx>
56 #include <svtools/style.hxx>
57 #include <svx/svdpagv.hxx>
58 #include <svx/grafctrl.hxx>
59 #include "stlsheet.hxx"
61 #include <sfx2/viewfrm.hxx>
64 #include "strings.hrc"
68 #include "imapinfo.hxx"
69 #include "futempl.hxx"
71 #include "sdresid.hxx"
72 #include "drawdoc.hxx"
73 #include "DrawDocShell.hxx"
74 #include "drawview.hxx"
75 #include "sdabstdlg.hxx"
79 #define MIN_ACTIONS_FOR_DIALOG 5000 // bei mehr als 1600 Metaobjekten
80 // wird beim Aufbrechen ein Dialog
82 /*************************************************************************
84 |* SfxRequests fuer temporaere Funktionen
86 \************************************************************************/
88 void DrawViewShell::FuTemp03(SfxRequest
& rReq
)
90 USHORT nSId
= rReq
.GetSlot();
93 case SID_GROUP
: // BASIC
95 if ( mpDrawView
->IsPresObjSelected( TRUE
, TRUE
, TRUE
) )
97 ::sd::Window
* pWindow
= GetActiveWindow();
98 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
102 mpDrawView
->GroupMarked();
109 case SID_UNGROUP
: // BASIC
111 mpDrawView
->UnGroupMarked();
119 // only allow for single object selection since the name of an object needs
121 if(1L == mpDrawView
->GetMarkedObjectCount())
124 SdrObject
* pSelected
= mpDrawView
->GetMarkedObjectByIndex(0L);
125 OSL_ENSURE(pSelected
, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
126 String
aName(pSelected
->GetName());
128 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
129 OSL_ENSURE(pFact
, "Dialogdiet fail!");
130 AbstractSvxObjectNameDialog
* pDlg
= pFact
->CreateSvxObjectNameDialog(NULL
, aName
, RID_SVXDLG_OBJECT_NAME
);
131 OSL_ENSURE(pDlg
, "Dialogdiet fail!");
133 pDlg
->SetCheckNameHdl(LINK(this, DrawViewShell
, NameObjectHdl
));
135 if(RET_OK
== pDlg
->Execute())
137 pDlg
->GetName(aName
);
138 pSelected
->SetName(aName
);
144 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
145 rBindings
.Invalidate( SID_NAVIGATOR_STATE
, TRUE
, FALSE
);
146 rBindings
.Invalidate( SID_CONTEXT
);
154 case SID_OBJECT_TITLE_DESCRIPTION
:
156 if(1L == mpDrawView
->GetMarkedObjectCount())
158 SdrObject
* pSelected
= mpDrawView
->GetMarkedObjectByIndex(0L);
159 OSL_ENSURE(pSelected
, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
160 String
aTitle(pSelected
->GetTitle());
161 String
aDescription(pSelected
->GetDescription());
163 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
164 OSL_ENSURE(pFact
, "Dialogdiet fail!");
165 AbstractSvxObjectTitleDescDialog
* pDlg
= pFact
->CreateSvxObjectTitleDescDialog(NULL
, aTitle
, aDescription
, RID_SVXDLG_OBJECT_TITLE_DESC
);
166 OSL_ENSURE(pDlg
, "Dialogdiet fail!");
168 if(RET_OK
== pDlg
->Execute())
170 pDlg
->GetTitle(aTitle
);
171 pDlg
->GetDescription(aDescription
);
172 pSelected
->SetTitle(aTitle
);
173 pSelected
->SetDescription(aDescription
);
179 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
180 rBindings
.Invalidate( SID_NAVIGATOR_STATE
, TRUE
, FALSE
);
181 rBindings
.Invalidate( SID_CONTEXT
);
188 case SID_ENTER_GROUP
: // BASIC
190 mpDrawView
->EnterMarkedGroup();
196 case SID_LEAVE_GROUP
: // BASIC
198 mpDrawView
->LeaveOneGroup();
204 case SID_LEAVE_ALL_GROUPS
: // BASIC
206 mpDrawView
->LeaveAllGroup();
212 case SID_COMBINE
: // BASIC
214 // #88224# End text edit to avoid conflicts
215 if(mpDrawView
->IsTextEdit())
216 mpDrawView
->SdrEndTextEdit();
218 if ( mpDrawView
->IsPresObjSelected() )
220 ::sd::Window
* pWindow
= GetActiveWindow();
221 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
225 WaitObject
aWait( (Window
*)GetActiveWindow() );
226 mpDrawView
->CombineMarkedObjects(sal_False
);
233 case SID_DISTRIBUTE_DLG
:
235 if ( mpDrawView
->IsPresObjSelected() )
237 ::sd::Window
* pWindow
= GetActiveWindow();
238 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
242 mpDrawView
->DistributeMarkedObjects();
251 // #88224# End text edit to avoid conflicts
252 if(mpDrawView
->IsTextEdit())
253 mpDrawView
->SdrEndTextEdit();
255 if ( mpDrawView
->IsPresObjSelected() )
257 ::sd::Window
* pWindow
= GetActiveWindow();
258 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
262 WaitObject
aWait( (Window
*)GetActiveWindow() );
263 mpDrawView
->MergeMarkedObjects(SDR_MERGE_MERGE
);
270 case SID_POLY_SUBSTRACT
:
272 // #88224# End text edit to avoid conflicts
273 if(mpDrawView
->IsTextEdit())
274 mpDrawView
->SdrEndTextEdit();
276 if ( mpDrawView
->IsPresObjSelected() )
278 ::sd::Window
* pWindow
= GetActiveWindow();
279 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
283 WaitObject
aWait( (Window
*)GetActiveWindow() );
284 mpDrawView
->MergeMarkedObjects(SDR_MERGE_SUBSTRACT
);
291 case SID_POLY_INTERSECT
:
293 // #88224# End text edit to avoid conflicts
294 if(mpDrawView
->IsTextEdit())
295 mpDrawView
->SdrEndTextEdit();
297 if ( mpDrawView
->IsPresObjSelected() )
299 ::sd::Window
* pWindow
= GetActiveWindow();
300 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
304 WaitObject
aWait( (Window
*)GetActiveWindow() );
305 mpDrawView
->MergeMarkedObjects(SDR_MERGE_INTERSECT
);
312 case SID_DISMANTLE
: // BASIC
314 if ( mpDrawView
->IsDismantlePossible(FALSE
) )
316 WaitObject
aWait( (Window
*)GetActiveWindow() );
317 mpDrawView
->DismantleMarkedObjects(FALSE
);
324 case SID_CONNECT
: // BASIC
326 if ( mpDrawView
->IsPresObjSelected() )
328 ::sd::Window
* pWindow
= GetActiveWindow();
329 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
333 WaitObject
aWait( (Window
*)GetActiveWindow() );
334 mpDrawView
->CombineMarkedObjects(sal_True
);
341 case SID_BREAK
: // BASIC
343 if ( mpDrawView
->IsTextEdit() )
345 mpDrawView
->SdrEndTextEdit();
348 if ( mpDrawView
->IsBreak3DObjPossible() )
350 WaitObject
aWait( (Window
*)GetActiveWindow() );
351 mpDrawView
->Break3DObj();
353 else if ( mpDrawView
->IsDismantlePossible(TRUE
) )
355 WaitObject
aWait( (Window
*)GetActiveWindow() );
356 mpDrawView
->DismantleMarkedObjects(TRUE
);
358 else if ( mpDrawView
->IsImportMtfPossible() )
361 WaitObject
aWait( (Window
*)GetActiveWindow() );
362 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
363 ULONG nAnz
=rMarkList
.GetMarkCount();
365 // Summe der Metaobjekte aller sel. Metafiles erm.
367 for(ULONG nm
=0; nm
<nAnz
; nm
++)
369 SdrMark
* pM
=rMarkList
.GetMark(nm
);
370 SdrObject
* pObj
=pM
->GetMarkedSdrObj();
371 SdrGrafObj
* pGraf
=PTR_CAST(SdrGrafObj
,pObj
);
372 SdrOle2Obj
* pOle2
=PTR_CAST(SdrOle2Obj
,pObj
);
373 if (pGraf
!=NULL
&& pGraf
->HasGDIMetaFile())
374 nCount
+= pGraf
->GetGraphic().GetGDIMetaFile().GetActionCount();
375 if(pOle2
!=NULL
&& pOle2
->GetGraphic())
376 nCount
+= pOle2
->GetGraphic()->GetGDIMetaFile().GetActionCount();
379 // anhand der erm. Summe entscheiden ob mit
380 // oder ohne Dialog aufgebrochen wird.
381 if(nCount
< MIN_ACTIONS_FOR_DIALOG
)
383 // ohne Dialog aufbrechen
384 mpDrawView
->DoImportMarkedMtf();
388 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
391 VclAbstractDialog
* pDlg
= pFact
->CreateBreakDlg(GetActiveWindow(), mpDrawView
, GetDocSh(), nCount
, nAnz
);
406 case SID_CONVERT_TO_3D
:
408 if ( mpDrawView
->IsPresObjSelected() )
410 ::sd::Window
* pWindow
= GetActiveWindow();
411 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
415 if (mpDrawView
->IsConvertTo3DObjPossible())
417 if (mpDrawView
->IsTextEdit())
419 mpDrawView
->SdrEndTextEdit();
422 WaitObject
aWait( (Window
*)GetActiveWindow() );
423 mpDrawView
->ConvertMarkedObjTo3D(TRUE
);
432 case SID_FRAME_TO_TOP
: // BASIC
434 mpDrawView
->PutMarkedToTop();
436 Invalidate( SID_POSITION
);
441 case SID_MOREFRONT
: // BASIC
443 mpDrawView
->MovMarkedToTop();
445 Invalidate( SID_POSITION
);
450 case SID_MOREBACK
: // BASIC
452 mpDrawView
->MovMarkedToBtm();
454 Invalidate( SID_POSITION
);
459 case SID_FRAME_TO_BOTTOM
: // BASIC
461 mpDrawView
->PutMarkedToBtm();
463 Invalidate( SID_POSITION
);
468 case SID_HORIZONTAL
: // BASIC
470 mpDrawView
->MirrorAllMarkedHorizontal();
476 case SID_VERTICAL
: // BASIC
478 mpDrawView
->MirrorAllMarkedVertical();
484 case SID_OBJECT_ALIGN_LEFT
: // BASIC
486 mpDrawView
->AlignMarkedObjects(SDRHALIGN_LEFT
, SDRVALIGN_NONE
);
492 case SID_OBJECT_ALIGN_CENTER
: // BASIC
494 mpDrawView
->AlignMarkedObjects(SDRHALIGN_CENTER
, SDRVALIGN_NONE
);
500 case SID_OBJECT_ALIGN_RIGHT
: // BASIC
502 mpDrawView
->AlignMarkedObjects(SDRHALIGN_RIGHT
, SDRVALIGN_NONE
);
508 case SID_OBJECT_ALIGN_UP
: // BASIC
510 mpDrawView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_TOP
);
516 case SID_OBJECT_ALIGN_MIDDLE
: // BASIC
518 mpDrawView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_CENTER
);
524 case SID_OBJECT_ALIGN_DOWN
: // BASIC
526 mpDrawView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_BOTTOM
);
532 case SID_SELECTALL
: // BASIC
534 if( (dynamic_cast<FuSelection
*>( GetOldFunction().get() ) != 0) &&
535 !GetView()->IsFrameDragSingles() && GetView()->HasMarkablePoints())
537 if ( !mpDrawView
->IsAction() )
538 mpDrawView
->MarkAllPoints();
541 mpDrawView
->SelectAll();
548 case SID_STYLE_NEW
: // BASIC ???
549 case SID_STYLE_APPLY
:
551 case SID_STYLE_DELETE
:
552 case SID_STYLE_FAMILY
:
553 case SID_STYLE_WATERCAN
:
554 case SID_STYLE_UPDATE_BY_EXAMPLE
:
555 case SID_STYLE_NEW_BY_EXAMPLE
:
557 if( rReq
.GetSlot() == SID_STYLE_EDIT
&& !rReq
.GetArgs() )
559 SfxStyleSheet
* pStyleSheet
= mpDrawView
->GetStyleSheet();
560 if( pStyleSheet
&& pStyleSheet
->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE
)
561 pStyleSheet
= ((SdStyleSheet
*)pStyleSheet
)->GetPseudoStyleSheet();
563 if( (pStyleSheet
== NULL
) && GetView()->IsTextEdit() )
565 GetView()->SdrEndTextEdit();
567 pStyleSheet
= mpDrawView
->GetStyleSheet();
568 if(pStyleSheet
&& pStyleSheet
->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE
)
569 pStyleSheet
= ((SdStyleSheet
*)pStyleSheet
)->GetPseudoStyleSheet();
572 if( pStyleSheet
== NULL
)
578 SfxAllItemSet
aSet(GetDoc()->GetPool());
580 SfxStringItem
aStyleNameItem( SID_STYLE_EDIT
, pStyleSheet
->GetName() );
581 aSet
.Put(aStyleNameItem
);
583 SfxUInt16Item
aStyleFamilyItem( SID_STYLE_FAMILY
, (UINT16
)pStyleSheet
->GetFamily() );
584 aSet
.Put(aStyleFamilyItem
);
591 SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
592 if( rReq
.GetSlot() == SID_STYLE_APPLY
)
593 GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY
);
596 else if( rReq
.GetSlot() == SID_STYLE_APPLY
)
597 GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER
, SFX_CALLMODE_ASYNCHRON
);
605 USHORT nId
= SvxIMapDlgChildWindow::GetChildWindowId();
607 GetViewFrame()->ToggleChildWindow( nId
);
608 GetViewFrame()->GetBindings().Invalidate( SID_IMAP
);
610 if ( GetViewFrame()->HasChildWindow( nId
)
611 && ( ( pDlg
= ViewShell::Implementation::GetImageMapDialog() ) != NULL
) )
613 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
615 if ( rMarkList
.GetMarkCount() == 1 )
616 UpdateIMapDlg( rMarkList
.GetMark( 0 )->GetMarkedSdrObj() );
626 mpDrawView
->SetGridFront( !mpDrawView
->IsGridFront() );
632 case SID_HELPLINES_FRONT
:
634 mpDrawView
->SetHlplFront( !mpDrawView
->IsHlplFront() );
646 /*************************************************************************
648 |* Liefert die globale/Haupt-ID zurueck, also die ID, ueber die die
649 |* Toolbox ausgeloest wird
651 \************************************************************************/
653 USHORT
DrawViewShell::GetIdBySubId( USHORT nSId
)
655 USHORT nMappedSId
= 0;
658 case SID_OBJECT_ROTATE
:
659 case SID_OBJECT_MIRROR
:
660 case SID_OBJECT_TRANSPARENCE
:
661 case SID_OBJECT_GRADIENT
:
662 case SID_OBJECT_SHEAR
:
663 case SID_OBJECT_CROOK_ROTATE
:
664 case SID_OBJECT_CROOK_SLANT
:
665 case SID_OBJECT_CROOK_STRETCH
:
666 case SID_CONVERT_TO_3D_LATHE
:
668 nMappedSId
= SID_OBJECT_CHOOSE_MODE
;
672 case SID_OBJECT_ALIGN_LEFT
:
673 case SID_OBJECT_ALIGN_CENTER
:
674 case SID_OBJECT_ALIGN_RIGHT
:
675 case SID_OBJECT_ALIGN_UP
:
676 case SID_OBJECT_ALIGN_MIDDLE
:
677 case SID_OBJECT_ALIGN_DOWN
:
679 nMappedSId
= SID_OBJECT_ALIGN
;
683 case SID_FRAME_TO_TOP
:
686 case SID_FRAME_TO_BOTTOM
:
689 case SID_REVERSE_ORDER
:
691 nMappedSId
= SID_POSITION
;
698 case SID_ZOOM_PANNING
:
700 case SID_SIZE_PAGE_WIDTH
:
702 case SID_SIZE_OPTIMAL
:
706 nMappedSId
= SID_ZOOM_TOOLBOX
;
711 case SID_TEXT_FITTOSIZE
:
712 case SID_DRAW_CAPTION
:
713 case SID_DRAW_FONTWORK
:
714 case SID_DRAW_FONTWORK_VERTICAL
:
716 nMappedSId
= SID_DRAWTBX_TEXT
;
721 case SID_DRAW_SQUARE
:
722 case SID_DRAW_RECT_ROUND
:
723 case SID_DRAW_SQUARE_ROUND
:
724 case SID_DRAW_RECT_NOFILL
:
725 case SID_DRAW_SQUARE_NOFILL
:
726 case SID_DRAW_RECT_ROUND_NOFILL
:
727 case SID_DRAW_SQUARE_ROUND_NOFILL
:
729 nMappedSId
= SID_DRAWTBX_RECTANGLES
;
733 case SID_DRAW_ELLIPSE
:
734 case SID_DRAW_CIRCLE
:
736 case SID_DRAW_CIRCLEPIE
:
737 case SID_DRAW_ELLIPSECUT
:
738 case SID_DRAW_CIRCLECUT
:
740 case SID_DRAW_CIRCLEARC
:
741 case SID_DRAW_ELLIPSE_NOFILL
:
742 case SID_DRAW_CIRCLE_NOFILL
:
743 case SID_DRAW_PIE_NOFILL
:
744 case SID_DRAW_CIRCLEPIE_NOFILL
:
745 case SID_DRAW_ELLIPSECUT_NOFILL
:
746 case SID_DRAW_CIRCLECUT_NOFILL
:
748 nMappedSId
= SID_DRAWTBX_ELLIPSES
;
752 case SID_DRAW_BEZIER_NOFILL
:
753 case SID_DRAW_POLYGON_NOFILL
:
754 case SID_DRAW_XPOLYGON_NOFILL
:
755 case SID_DRAW_FREELINE_NOFILL
:
756 case SID_DRAW_BEZIER_FILL
:
757 case SID_DRAW_POLYGON
:
758 case SID_DRAW_XPOLYGON
:
759 case SID_DRAW_FREELINE
:
761 nMappedSId
= SID_DRAWTBX_LINES
;
767 case SID_DRAW_MEASURELINE
:
768 case SID_LINE_ARROW_START
:
769 case SID_LINE_ARROW_END
:
770 case SID_LINE_ARROWS
:
771 case SID_LINE_ARROW_CIRCLE
:
772 case SID_LINE_CIRCLE_ARROW
:
773 case SID_LINE_ARROW_SQUARE
:
774 case SID_LINE_SQUARE_ARROW
:
776 nMappedSId
= SID_DRAWTBX_ARROWS
;
784 case SID_3D_HALF_SPHERE
:
785 case SID_3D_CYLINDER
:
789 nMappedSId
= SID_DRAWTBX_3D_OBJECTS
;
793 case SID_INSERT_DIAGRAM
:
794 #ifdef STARIMAGE_AVAILABLE
795 case SID_INSERT_IMAGE
:
799 case SID_INSERT_GRAPHIC
:
800 case SID_INSERT_AVMEDIA
:
802 case SID_INSERT_MATH
:
803 case SID_INSERT_FLOATINGFRAME
:
804 case SID_INSERT_OBJECT
:
805 case SID_INSERT_PLUGIN
:
806 case SID_INSERT_SOUND
:
807 case SID_INSERT_VIDEO
:
808 case SID_INSERT_APPLET
:
809 case SID_INSERT_TABLE
:
811 nMappedSId
= SID_DRAWTBX_INSERT
;
815 case SID_TOOL_CONNECTOR
:
816 case SID_CONNECTOR_ARROW_START
:
817 case SID_CONNECTOR_ARROW_END
:
818 case SID_CONNECTOR_ARROWS
:
819 case SID_CONNECTOR_CIRCLE_START
:
820 case SID_CONNECTOR_CIRCLE_END
:
821 case SID_CONNECTOR_CIRCLES
:
822 case SID_CONNECTOR_LINE
:
823 case SID_CONNECTOR_LINE_ARROW_START
:
824 case SID_CONNECTOR_LINE_ARROW_END
:
825 case SID_CONNECTOR_LINE_ARROWS
:
826 case SID_CONNECTOR_LINE_CIRCLE_START
:
827 case SID_CONNECTOR_LINE_CIRCLE_END
:
828 case SID_CONNECTOR_LINE_CIRCLES
:
829 case SID_CONNECTOR_CURVE
:
830 case SID_CONNECTOR_CURVE_ARROW_START
:
831 case SID_CONNECTOR_CURVE_ARROW_END
:
832 case SID_CONNECTOR_CURVE_ARROWS
:
833 case SID_CONNECTOR_CURVE_CIRCLE_START
:
834 case SID_CONNECTOR_CURVE_CIRCLE_END
:
835 case SID_CONNECTOR_CURVE_CIRCLES
:
836 case SID_CONNECTOR_LINES
:
837 case SID_CONNECTOR_LINES_ARROW_START
:
838 case SID_CONNECTOR_LINES_ARROW_END
:
839 case SID_CONNECTOR_LINES_ARROWS
:
840 case SID_CONNECTOR_LINES_CIRCLE_START
:
841 case SID_CONNECTOR_LINES_CIRCLE_END
:
842 case SID_CONNECTOR_LINES_CIRCLES
:
844 nMappedSId
= SID_DRAWTBX_CONNECTORS
;
847 return( nMappedSId
);
850 /*************************************************************************
852 |* Fuellt das SlotArray, um das aktuelle Mapping des ToolboxSlots zu
855 \************************************************************************/
857 void DrawViewShell::MapSlot( USHORT nSId
)
859 USHORT nMappedSId
= GetIdBySubId( nSId
);
863 USHORT nID
= GetArrayId( nMappedSId
) + 1;
864 mpSlotArray
[ nID
] = nSId
;
868 /*************************************************************************
870 |* Ermoeglicht ueber das SlotArray ein ImageMapping
872 \************************************************************************/
874 void DrawViewShell::UpdateToolboxImages( SfxItemSet
&rSet
, BOOL bPermanent
)
878 USHORT nId
= GetArrayId( SID_ZOOM_TOOLBOX
) + 1;
879 rSet
.Put( TbxImageItem( SID_ZOOM_TOOLBOX
, mpSlotArray
[nId
] ) );
881 nId
= GetArrayId( SID_DRAWTBX_INSERT
) + 1;
882 rSet
.Put( TbxImageItem( SID_DRAWTBX_INSERT
, mpSlotArray
[nId
] ) );
884 nId
= GetArrayId( SID_POSITION
) + 1;
885 rSet
.Put( TbxImageItem( SID_POSITION
, mpSlotArray
[nId
] ) );
887 nId
= GetArrayId( SID_OBJECT_ALIGN
) + 1;
888 rSet
.Put( TbxImageItem( SID_OBJECT_ALIGN
, mpSlotArray
[nId
] ) );
892 for( USHORT nId
= 0; nId
< SLOTARRAY_COUNT
; nId
+= 2 )
894 rSet
.Put( TbxImageItem( mpSlotArray
[nId
], mpSlotArray
[nId
+1] ) );
899 /*************************************************************************
901 |* Gibt den gemappten Slot zurueck
903 \************************************************************************/
905 USHORT
DrawViewShell::GetMappedSlot( USHORT nSId
)
908 USHORT nId
= GetArrayId( nSId
);
909 if( nId
!= USHRT_MAX
)
910 nSlot
= mpSlotArray
[ nId
+1 ];
912 // Wenn der Slot noch auf sich selbst gemapped ist, muss 0 zurueck-
913 // gegeben werden, da sonst der Slot immer wieder selbst executet
914 // wird. Im Array ist der Slot selbst initial vorhanden, damit das
915 // Image richtig angezeigt wird.
922 /*************************************************************************
924 |* Gibt die Nummer des HauptSlots im SlotArray zurueck
926 \************************************************************************/
928 USHORT
DrawViewShell::GetArrayId( USHORT nSId
)
930 for( USHORT i
= 0; i
< SLOTARRAY_COUNT
; i
+= 2 )
932 if( mpSlotArray
[ i
] == nSId
)
935 DBG_ERROR( "Slot im Array nicht gefunden!" );
940 /*************************************************************************
944 \************************************************************************/
946 void DrawViewShell::UpdateIMapDlg( SdrObject
* pObj
)
948 if( ( pObj
->ISA( SdrGrafObj
) || pObj
->ISA( SdrOle2Obj
) ) && !mpDrawView
->IsTextEdit() &&
949 GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
952 ImageMap
* pIMap
= NULL
;
953 TargetList
* pTargetList
= NULL
;
954 SdIMapInfo
* pIMapInfo
= GetDoc()->GetIMapInfo( pObj
);
956 // get graphic from shape
957 SdrGrafObj
* pGrafObj
= dynamic_cast< SdrGrafObj
* >( pObj
);
959 aGraphic
= pGrafObj
->GetGraphic();
963 pIMap
= (ImageMap
*) &pIMapInfo
->GetImageMap();
964 pTargetList
= new TargetList
;
965 GetViewFrame()->GetTargetList( *pTargetList
);
968 SvxIMapDlgChildWindow::UpdateIMapDlg( aGraphic
, pIMap
, pTargetList
, pObj
);
970 // TargetListe kann von uns wieder geloescht werden
973 String
* pEntry
= pTargetList
->First();
977 pEntry
= pTargetList
->Next();
985 // -----------------------------------------------------------------------------
987 IMPL_LINK( DrawViewShell
, NameObjectHdl
, AbstractSvxNameDialog
*, pDialog
)
992 pDialog
->GetName( aName
);
994 return( ( !aName
.Len() || ( GetDoc() && !GetDoc()->GetObj( aName
) ) ) ? 1 : 0 );
997 } // end of namespace sd