update dev300-m58
[ooovba.git] / sd / source / ui / view / drviewsc.cxx
blobedd3eea8218f585c3759bf9d59ebb0c91aec6c91
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drviewsc.cxx,v $
10 * $Revision: 1.35 $
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>
38 #ifndef _SVXIDS_HRC
39 #include <svx/svxids.hrc>
40 #endif
41 #include <svx/dialogs.hrc>
42 #ifndef _IMAPDLG_HXX
43 #include <svx/imapdlg.hxx>
44 #endif
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>
53 #endif
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>
63 #include "app.hrc"
64 #include "strings.hrc"
65 #include "helpids.h"
66 #include "misc.hxx"
67 #include "Window.hxx"
68 #include "imapinfo.hxx"
69 #include "futempl.hxx"
70 #include "fusel.hxx"
71 #include "sdresid.hxx"
72 #include "drawdoc.hxx"
73 #include "DrawDocShell.hxx"
74 #include "drawview.hxx"
75 #include "sdabstdlg.hxx"
76 #include "brkdlg.hrc"
77 namespace sd {
79 #define MIN_ACTIONS_FOR_DIALOG 5000 // bei mehr als 1600 Metaobjekten
80 // wird beim Aufbrechen ein Dialog
81 // angezeigt.
82 /*************************************************************************
84 |* SfxRequests fuer temporaere Funktionen
86 \************************************************************************/
88 void DrawViewShell::FuTemp03(SfxRequest& rReq)
90 USHORT nSId = rReq.GetSlot();
91 switch( nSId )
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();
100 else
102 mpDrawView->GroupMarked();
104 Cancel();
105 rReq.Done ();
107 break;
109 case SID_UNGROUP: // BASIC
111 mpDrawView->UnGroupMarked();
112 Cancel();
113 rReq.Done ();
115 break;
117 case SID_NAME_GROUP:
119 // only allow for single object selection since the name of an object needs
120 // to be unique
121 if(1L == mpDrawView->GetMarkedObjectCount())
123 // #i68101#
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);
141 delete pDlg;
144 SfxBindings& rBindings = GetViewFrame()->GetBindings();
145 rBindings.Invalidate( SID_NAVIGATOR_STATE, TRUE, FALSE );
146 rBindings.Invalidate( SID_CONTEXT );
148 Cancel();
149 rReq.Ignore();
150 break;
153 // #i68101#
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);
176 delete pDlg;
179 SfxBindings& rBindings = GetViewFrame()->GetBindings();
180 rBindings.Invalidate( SID_NAVIGATOR_STATE, TRUE, FALSE );
181 rBindings.Invalidate( SID_CONTEXT );
183 Cancel();
184 rReq.Ignore();
185 break;
188 case SID_ENTER_GROUP: // BASIC
190 mpDrawView->EnterMarkedGroup();
191 Cancel();
192 rReq.Done ();
194 break;
196 case SID_LEAVE_GROUP: // BASIC
198 mpDrawView->LeaveOneGroup();
199 Cancel();
200 rReq.Done ();
202 break;
204 case SID_LEAVE_ALL_GROUPS: // BASIC
206 mpDrawView->LeaveAllGroup();
207 Cancel();
208 rReq.Done ();
210 break;
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();
223 else
225 WaitObject aWait( (Window*)GetActiveWindow() );
226 mpDrawView->CombineMarkedObjects(sal_False);
228 Cancel();
229 rReq.Done ();
231 break;
233 case SID_DISTRIBUTE_DLG:
235 if ( mpDrawView->IsPresObjSelected() )
237 ::sd::Window* pWindow = GetActiveWindow();
238 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
240 else
242 mpDrawView->DistributeMarkedObjects();
244 Cancel();
245 rReq.Done ();
247 break;
249 case SID_POLY_MERGE:
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();
260 else
262 WaitObject aWait( (Window*)GetActiveWindow() );
263 mpDrawView->MergeMarkedObjects(SDR_MERGE_MERGE);
265 Cancel();
266 rReq.Done ();
268 break;
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();
281 else
283 WaitObject aWait( (Window*)GetActiveWindow() );
284 mpDrawView->MergeMarkedObjects(SDR_MERGE_SUBSTRACT);
286 Cancel();
287 rReq.Done ();
289 break;
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();
302 else
304 WaitObject aWait( (Window*)GetActiveWindow() );
305 mpDrawView->MergeMarkedObjects(SDR_MERGE_INTERSECT);
307 Cancel();
308 rReq.Done ();
310 break;
312 case SID_DISMANTLE: // BASIC
314 if ( mpDrawView->IsDismantlePossible(FALSE) )
316 WaitObject aWait( (Window*)GetActiveWindow() );
317 mpDrawView->DismantleMarkedObjects(FALSE);
319 Cancel();
320 rReq.Done ();
322 break;
324 case SID_CONNECT: // BASIC
326 if ( mpDrawView->IsPresObjSelected() )
328 ::sd::Window* pWindow = GetActiveWindow();
329 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
331 else
333 WaitObject aWait( (Window*)GetActiveWindow() );
334 mpDrawView->CombineMarkedObjects(sal_True);
336 Cancel();
337 rReq.Done ();
339 break;
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.
366 ULONG nCount = 0;
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();
386 else
388 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
389 if( pFact )
391 VclAbstractDialog* pDlg = pFact->CreateBreakDlg(GetActiveWindow(), mpDrawView, GetDocSh(), nCount, nAnz );
392 if( pDlg )
394 pDlg->Execute();
395 delete pDlg;
401 Cancel();
402 rReq.Done ();
404 break;
406 case SID_CONVERT_TO_3D:
408 if ( mpDrawView->IsPresObjSelected() )
410 ::sd::Window* pWindow = GetActiveWindow();
411 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
413 else
415 if (mpDrawView->IsConvertTo3DObjPossible())
417 if (mpDrawView->IsTextEdit())
419 mpDrawView->SdrEndTextEdit();
422 WaitObject aWait( (Window*)GetActiveWindow() );
423 mpDrawView->ConvertMarkedObjTo3D(TRUE);
427 Cancel();
428 rReq.Done();
430 break;
432 case SID_FRAME_TO_TOP: // BASIC
434 mpDrawView->PutMarkedToTop();
435 Cancel();
436 Invalidate( SID_POSITION );
437 rReq.Done ();
439 break;
441 case SID_MOREFRONT: // BASIC
443 mpDrawView->MovMarkedToTop();
444 Cancel();
445 Invalidate( SID_POSITION );
446 rReq.Done ();
448 break;
450 case SID_MOREBACK: // BASIC
452 mpDrawView->MovMarkedToBtm();
453 Cancel();
454 Invalidate( SID_POSITION );
455 rReq.Done ();
457 break;
459 case SID_FRAME_TO_BOTTOM: // BASIC
461 mpDrawView->PutMarkedToBtm();
462 Cancel();
463 Invalidate( SID_POSITION );
464 rReq.Done ();
466 break;
468 case SID_HORIZONTAL: // BASIC
470 mpDrawView->MirrorAllMarkedHorizontal();
471 Cancel();
472 rReq.Done ();
474 break;
476 case SID_VERTICAL: // BASIC
478 mpDrawView->MirrorAllMarkedVertical();
479 Cancel();
480 rReq.Done ();
482 break;
484 case SID_OBJECT_ALIGN_LEFT: // BASIC
486 mpDrawView->AlignMarkedObjects(SDRHALIGN_LEFT, SDRVALIGN_NONE);
487 Cancel();
488 rReq.Done ();
490 break;
492 case SID_OBJECT_ALIGN_CENTER: // BASIC
494 mpDrawView->AlignMarkedObjects(SDRHALIGN_CENTER, SDRVALIGN_NONE);
495 Cancel();
496 rReq.Done ();
498 break;
500 case SID_OBJECT_ALIGN_RIGHT: // BASIC
502 mpDrawView->AlignMarkedObjects(SDRHALIGN_RIGHT, SDRVALIGN_NONE);
503 Cancel();
504 rReq.Done ();
506 break;
508 case SID_OBJECT_ALIGN_UP: // BASIC
510 mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_TOP);
511 Cancel();
512 rReq.Done ();
514 break;
516 case SID_OBJECT_ALIGN_MIDDLE: // BASIC
518 mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_CENTER);
519 Cancel();
520 rReq.Done ();
522 break;
524 case SID_OBJECT_ALIGN_DOWN: // BASIC
526 mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_BOTTOM);
527 Cancel();
528 rReq.Done ();
530 break;
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();
540 else
541 mpDrawView->SelectAll();
543 Cancel();
544 rReq.Done ();
546 break;
548 case SID_STYLE_NEW: // BASIC ???
549 case SID_STYLE_APPLY:
550 case SID_STYLE_EDIT:
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 )
574 rReq.Ignore();
575 break;
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);
586 rReq.SetArgs(aSet);
589 if( rReq.GetArgs() )
591 SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
592 if( rReq.GetSlot() == SID_STYLE_APPLY )
593 GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY );
594 Cancel();
596 else if( rReq.GetSlot() == SID_STYLE_APPLY )
597 GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER, SFX_CALLMODE_ASYNCHRON );
598 rReq.Ignore ();
600 break;
602 case SID_IMAP:
604 SvxIMapDlg* pDlg;
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() );
619 Cancel();
620 rReq.Ignore ();
622 break;
624 case SID_GRID_FRONT:
626 mpDrawView->SetGridFront( !mpDrawView->IsGridFront() );
627 Cancel();
628 rReq.Done ();
630 break;
632 case SID_HELPLINES_FRONT:
634 mpDrawView->SetHlplFront( !mpDrawView->IsHlplFront() );
635 Cancel();
636 rReq.Done ();
638 break;
640 default:
641 FuTemp04(rReq);
642 break;
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;
656 switch( nSId )
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;
670 break;
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;
681 break;
683 case SID_FRAME_TO_TOP:
684 case SID_MOREFRONT:
685 case SID_MOREBACK:
686 case SID_FRAME_TO_BOTTOM:
687 case SID_BEFORE_OBJ:
688 case SID_BEHIND_OBJ:
689 case SID_REVERSE_ORDER:
691 nMappedSId = SID_POSITION;
693 break;
695 case SID_ZOOM_OUT:
696 case SID_ZOOM_IN:
697 case SID_SIZE_REAL:
698 case SID_ZOOM_PANNING:
699 case SID_SIZE_PAGE:
700 case SID_SIZE_PAGE_WIDTH:
701 case SID_SIZE_ALL:
702 case SID_SIZE_OPTIMAL:
703 case SID_ZOOM_NEXT:
704 case SID_ZOOM_PREV:
706 nMappedSId = SID_ZOOM_TOOLBOX;
708 break;
710 case SID_ATTR_CHAR:
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;
718 break;
720 case SID_DRAW_RECT:
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;
731 break;
733 case SID_DRAW_ELLIPSE:
734 case SID_DRAW_CIRCLE:
735 case SID_DRAW_PIE:
736 case SID_DRAW_CIRCLEPIE:
737 case SID_DRAW_ELLIPSECUT:
738 case SID_DRAW_CIRCLECUT:
739 case SID_DRAW_ARC:
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;
750 break;
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;
763 break;
765 case SID_DRAW_LINE:
766 case SID_DRAW_XLINE:
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;
778 break;
780 case SID_3D_CUBE:
781 case SID_3D_TORUS:
782 case SID_3D_SPHERE:
783 case SID_3D_SHELL:
784 case SID_3D_HALF_SPHERE:
785 case SID_3D_CYLINDER:
786 case SID_3D_CONE:
787 case SID_3D_PYRAMID:
789 nMappedSId = SID_DRAWTBX_3D_OBJECTS;
791 break;
793 case SID_INSERT_DIAGRAM:
794 #ifdef STARIMAGE_AVAILABLE
795 case SID_INSERT_IMAGE:
796 #endif
797 case SID_ATTR_TABLE:
798 case SID_INSERTFILE:
799 case SID_INSERT_GRAPHIC:
800 case SID_INSERT_AVMEDIA:
801 case SID_INSERTPAGE:
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;
813 break;
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
853 |* bekommen
855 \************************************************************************/
857 void DrawViewShell::MapSlot( USHORT nSId )
859 USHORT nMappedSId = GetIdBySubId( nSId );
861 if( nMappedSId > 0 )
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 )
876 if( !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] ) );
890 else
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 )
907 USHORT nSlot = 0;
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.
916 if( nSId == nSlot )
917 return( 0 );
919 return( nSlot );
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 )
933 return( i );
935 DBG_ERROR( "Slot im Array nicht gefunden!" );
936 return( USHRT_MAX );
940 /*************************************************************************
942 |* IMap-Dlg updaten
944 \************************************************************************/
946 void DrawViewShell::UpdateIMapDlg( SdrObject* pObj )
948 if( ( pObj->ISA( SdrGrafObj ) || pObj->ISA( SdrOle2Obj ) ) && !mpDrawView->IsTextEdit() &&
949 GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
951 Graphic aGraphic;
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 );
958 if( pGrafObj )
959 aGraphic = pGrafObj->GetGraphic();
961 if ( pIMapInfo )
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
971 if ( pTargetList )
973 String* pEntry = pTargetList->First();
974 while( pEntry )
976 delete pEntry;
977 pEntry = pTargetList->Next();
980 delete pTargetList;
985 // -----------------------------------------------------------------------------
987 IMPL_LINK( DrawViewShell, NameObjectHdl, AbstractSvxNameDialog*, pDialog )
989 String aName;
991 if( pDialog )
992 pDialog->GetName( aName );
994 return( ( !aName.Len() || ( GetDoc() && !GetDoc()->GetObj( aName ) ) ) ? 1 : 0 );
997 } // end of namespace sd