xref: /AOO41X/main/sd/source/ui/view/drviewsc.cxx (revision 5b1900111deff329a5580f97b99b67a25168e53d)
1*5b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*5b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*5b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*5b190011SAndrew Rist  * distributed with this work for additional information
6*5b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*5b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*5b190011SAndrew Rist  * "License"); you may not use this file except in compliance
9*5b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*5b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*5b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*5b190011SAndrew Rist  * software distributed under the License is distributed on an
15*5b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
17*5b190011SAndrew Rist  * specific language governing permissions and limitations
18*5b190011SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*5b190011SAndrew Rist  *************************************************************/
21*5b190011SAndrew Rist 
22*5b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "DrawViewShell.hxx"
28cdf0e10cSrcweir #include "ViewShellImplementation.hxx"
29cdf0e10cSrcweir #include <vcl/waitobj.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #ifndef _SVXIDS_HRC
32cdf0e10cSrcweir #include <svx/svxids.hrc>
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir #include <svx/dialogs.hrc>
35cdf0e10cSrcweir #ifndef _IMAPDLG_HXX
36cdf0e10cSrcweir #include <svx/imapdlg.hxx>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #include <vcl/msgbox.hxx>
39cdf0e10cSrcweir #include <sfx2/request.hxx>
40cdf0e10cSrcweir #include <svx/svdogrp.hxx>
41cdf0e10cSrcweir #include <svx/svdoole2.hxx>
42cdf0e10cSrcweir #include <svx/svdograf.hxx>
43cdf0e10cSrcweir #include <svx/svxdlg.hxx>
44cdf0e10cSrcweir #ifndef _BINDING_HXX //autogen
45cdf0e10cSrcweir #include <sfx2/bindings.hxx>
46cdf0e10cSrcweir #endif
47cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
48cdf0e10cSrcweir #include <svx/svdoole2.hxx>
49cdf0e10cSrcweir #include <svl/style.hxx>
50cdf0e10cSrcweir #include <svx/svdpagv.hxx>
51cdf0e10cSrcweir #include <svx/grafctrl.hxx>
52cdf0e10cSrcweir #include "stlsheet.hxx"
53cdf0e10cSrcweir 
54cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
55cdf0e10cSrcweir 
56cdf0e10cSrcweir #include "app.hrc"
57cdf0e10cSrcweir #include "strings.hrc"
58cdf0e10cSrcweir #include "helpids.h"
59cdf0e10cSrcweir #include "misc.hxx"
60cdf0e10cSrcweir #include "Window.hxx"
61cdf0e10cSrcweir #include "imapinfo.hxx"
62cdf0e10cSrcweir #include "futempl.hxx"
63cdf0e10cSrcweir #include "fusel.hxx"
64cdf0e10cSrcweir #include "sdresid.hxx"
65cdf0e10cSrcweir #include "drawdoc.hxx"
66cdf0e10cSrcweir #include "DrawDocShell.hxx"
67cdf0e10cSrcweir #include "drawview.hxx"
68cdf0e10cSrcweir #include "sdabstdlg.hxx"
69cdf0e10cSrcweir #include "brkdlg.hrc"
70cdf0e10cSrcweir namespace sd {
71cdf0e10cSrcweir 
72cdf0e10cSrcweir #define	MIN_ACTIONS_FOR_DIALOG	5000	// bei mehr als 1600 Metaobjekten
73cdf0e10cSrcweir 										// wird beim Aufbrechen ein Dialog
74cdf0e10cSrcweir 										// angezeigt.
75cdf0e10cSrcweir /*************************************************************************
76cdf0e10cSrcweir |*
77cdf0e10cSrcweir |* SfxRequests fuer temporaere Funktionen
78cdf0e10cSrcweir |*
79cdf0e10cSrcweir \************************************************************************/
80cdf0e10cSrcweir 
81cdf0e10cSrcweir void DrawViewShell::FuTemp03(SfxRequest& rReq)
82cdf0e10cSrcweir {
83cdf0e10cSrcweir 	sal_uInt16 nSId = rReq.GetSlot();
84cdf0e10cSrcweir 	switch( nSId )
85cdf0e10cSrcweir 	{
86cdf0e10cSrcweir 		case SID_GROUP:  // BASIC
87cdf0e10cSrcweir 		{
88cdf0e10cSrcweir 			if ( mpDrawView->IsPresObjSelected( sal_True, sal_True, sal_True ) )
89cdf0e10cSrcweir 			{
90cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
91cdf0e10cSrcweir                 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
92cdf0e10cSrcweir 			}
93cdf0e10cSrcweir 			else
94cdf0e10cSrcweir 			{
95cdf0e10cSrcweir 				mpDrawView->GroupMarked();
96cdf0e10cSrcweir 			}
97cdf0e10cSrcweir 			Cancel();
98cdf0e10cSrcweir 			rReq.Done ();
99cdf0e10cSrcweir 		}
100cdf0e10cSrcweir 		break;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 		case SID_UNGROUP:  // BASIC
103cdf0e10cSrcweir 		{
104cdf0e10cSrcweir 			mpDrawView->UnGroupMarked();
105cdf0e10cSrcweir 			Cancel();
106cdf0e10cSrcweir 			rReq.Done ();
107cdf0e10cSrcweir 		}
108cdf0e10cSrcweir 		break;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 		case SID_NAME_GROUP:
111cdf0e10cSrcweir 		{
112cdf0e10cSrcweir 			// only allow for single object selection since the name of an object needs
113cdf0e10cSrcweir 			// to be unique
114cdf0e10cSrcweir 			if(1L == mpDrawView->GetMarkedObjectCount())
115cdf0e10cSrcweir 			{
116cdf0e10cSrcweir 				// #i68101#
117cdf0e10cSrcweir 				SdrObject* pSelected = mpDrawView->GetMarkedObjectByIndex(0L);
118cdf0e10cSrcweir 				OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
119cdf0e10cSrcweir 				String aName(pSelected->GetName());
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 				SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
122cdf0e10cSrcweir 				OSL_ENSURE(pFact, "Dialogdiet fail!");
123cdf0e10cSrcweir 				AbstractSvxObjectNameDialog* pDlg = pFact->CreateSvxObjectNameDialog(NULL, aName);
124cdf0e10cSrcweir 				OSL_ENSURE(pDlg, "Dialogdiet fail!");
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 				pDlg->SetCheckNameHdl(LINK(this, DrawViewShell, NameObjectHdl));
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 				if(RET_OK == pDlg->Execute())
129cdf0e10cSrcweir 				{
130cdf0e10cSrcweir 					pDlg->GetName(aName);
131cdf0e10cSrcweir 					pSelected->SetName(aName);
132cdf0e10cSrcweir 				}
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 				delete pDlg;
135cdf0e10cSrcweir 			}
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 			SfxBindings& rBindings = GetViewFrame()->GetBindings();
138cdf0e10cSrcweir 			rBindings.Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False );
139cdf0e10cSrcweir 			rBindings.Invalidate( SID_CONTEXT );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 			Cancel();
142cdf0e10cSrcweir 			rReq.Ignore();
143cdf0e10cSrcweir 			break;
144cdf0e10cSrcweir 		}
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 		// #i68101#
147cdf0e10cSrcweir 		case SID_OBJECT_TITLE_DESCRIPTION:
148cdf0e10cSrcweir 		{
149cdf0e10cSrcweir 			if(1L == mpDrawView->GetMarkedObjectCount())
150cdf0e10cSrcweir 			{
151cdf0e10cSrcweir 				SdrObject* pSelected = mpDrawView->GetMarkedObjectByIndex(0L);
152cdf0e10cSrcweir 				OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
153cdf0e10cSrcweir 				String aTitle(pSelected->GetTitle());
154cdf0e10cSrcweir 				String aDescription(pSelected->GetDescription());
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 				SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
157cdf0e10cSrcweir 				OSL_ENSURE(pFact, "Dialogdiet fail!");
158cdf0e10cSrcweir 				AbstractSvxObjectTitleDescDialog* pDlg = pFact->CreateSvxObjectTitleDescDialog(NULL, aTitle, aDescription);
159cdf0e10cSrcweir 				OSL_ENSURE(pDlg, "Dialogdiet fail!");
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 				if(RET_OK == pDlg->Execute())
162cdf0e10cSrcweir 				{
163cdf0e10cSrcweir 					pDlg->GetTitle(aTitle);
164cdf0e10cSrcweir 					pDlg->GetDescription(aDescription);
165cdf0e10cSrcweir 					pSelected->SetTitle(aTitle);
166cdf0e10cSrcweir 					pSelected->SetDescription(aDescription);
167cdf0e10cSrcweir 				}
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 				delete pDlg;
170cdf0e10cSrcweir 			}
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 			SfxBindings& rBindings = GetViewFrame()->GetBindings();
173cdf0e10cSrcweir 			rBindings.Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False );
174cdf0e10cSrcweir 			rBindings.Invalidate( SID_CONTEXT );
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 			Cancel();
177cdf0e10cSrcweir 			rReq.Ignore();
178cdf0e10cSrcweir 			break;
179cdf0e10cSrcweir 		}
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 		case SID_ENTER_GROUP:  // BASIC
182cdf0e10cSrcweir 		{
183cdf0e10cSrcweir 			mpDrawView->EnterMarkedGroup();
184cdf0e10cSrcweir 			Cancel();
185cdf0e10cSrcweir 			rReq.Done ();
186cdf0e10cSrcweir 		}
187cdf0e10cSrcweir 		break;
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 		case SID_LEAVE_GROUP:  // BASIC
190cdf0e10cSrcweir 		{
191cdf0e10cSrcweir 			mpDrawView->LeaveOneGroup();
192cdf0e10cSrcweir 			Cancel();
193cdf0e10cSrcweir 			rReq.Done ();
194cdf0e10cSrcweir 		}
195cdf0e10cSrcweir 		break;
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 		case SID_LEAVE_ALL_GROUPS:  // BASIC
198cdf0e10cSrcweir 		{
199cdf0e10cSrcweir 			mpDrawView->LeaveAllGroup();
200cdf0e10cSrcweir 			Cancel();
201cdf0e10cSrcweir 			rReq.Done ();
202cdf0e10cSrcweir 		}
203cdf0e10cSrcweir 		break;
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 		case SID_COMBINE:  // BASIC
206cdf0e10cSrcweir 		{
207cdf0e10cSrcweir 			// #88224# End text edit to avoid conflicts
208cdf0e10cSrcweir 			if(mpDrawView->IsTextEdit())
209cdf0e10cSrcweir 				mpDrawView->SdrEndTextEdit();
210cdf0e10cSrcweir 
211cdf0e10cSrcweir 			if ( mpDrawView->IsPresObjSelected() )
212cdf0e10cSrcweir 			{
213cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
214cdf0e10cSrcweir                 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
215cdf0e10cSrcweir 			}
216cdf0e10cSrcweir 			else
217cdf0e10cSrcweir 			{
218cdf0e10cSrcweir 				WaitObject aWait( (Window*)GetActiveWindow() );
219cdf0e10cSrcweir 				mpDrawView->CombineMarkedObjects(sal_False);
220cdf0e10cSrcweir 			}
221cdf0e10cSrcweir 			Cancel();
222cdf0e10cSrcweir 			rReq.Done ();
223cdf0e10cSrcweir 		}
224cdf0e10cSrcweir 		break;
225cdf0e10cSrcweir 
226cdf0e10cSrcweir 		case SID_DISTRIBUTE_DLG:
227cdf0e10cSrcweir 		{
228cdf0e10cSrcweir 			if ( mpDrawView->IsPresObjSelected() )
229cdf0e10cSrcweir 			{
230cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
231cdf0e10cSrcweir                 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
232cdf0e10cSrcweir 			}
233cdf0e10cSrcweir 			else
234cdf0e10cSrcweir 			{
235cdf0e10cSrcweir 				mpDrawView->DistributeMarkedObjects();
236cdf0e10cSrcweir 			}
237cdf0e10cSrcweir 			Cancel();
238cdf0e10cSrcweir 			rReq.Done ();
239cdf0e10cSrcweir 		}
240cdf0e10cSrcweir 		break;
241cdf0e10cSrcweir 
242cdf0e10cSrcweir         case SID_POLY_MERGE:
243cdf0e10cSrcweir 		{
244cdf0e10cSrcweir 			// #88224# End text edit to avoid conflicts
245cdf0e10cSrcweir 			if(mpDrawView->IsTextEdit())
246cdf0e10cSrcweir 				mpDrawView->SdrEndTextEdit();
247cdf0e10cSrcweir 
248cdf0e10cSrcweir 			if ( mpDrawView->IsPresObjSelected() )
249cdf0e10cSrcweir 			{
250cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
251cdf0e10cSrcweir                 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
252cdf0e10cSrcweir 			}
253cdf0e10cSrcweir 			else
254cdf0e10cSrcweir 			{
255cdf0e10cSrcweir 				WaitObject aWait( (Window*)GetActiveWindow() );
256cdf0e10cSrcweir 				mpDrawView->MergeMarkedObjects(SDR_MERGE_MERGE);
257cdf0e10cSrcweir 			}
258cdf0e10cSrcweir 			Cancel();
259cdf0e10cSrcweir 			rReq.Done ();
260cdf0e10cSrcweir 		}
261cdf0e10cSrcweir 		break;
262cdf0e10cSrcweir 
263cdf0e10cSrcweir         case SID_POLY_SUBSTRACT:
264cdf0e10cSrcweir 		{
265cdf0e10cSrcweir 			// #88224# End text edit to avoid conflicts
266cdf0e10cSrcweir 			if(mpDrawView->IsTextEdit())
267cdf0e10cSrcweir 				mpDrawView->SdrEndTextEdit();
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 			if ( mpDrawView->IsPresObjSelected() )
270cdf0e10cSrcweir 			{
271cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
272cdf0e10cSrcweir                 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
273cdf0e10cSrcweir 			}
274cdf0e10cSrcweir 			else
275cdf0e10cSrcweir 			{
276cdf0e10cSrcweir 				WaitObject aWait( (Window*)GetActiveWindow() );
277cdf0e10cSrcweir 				mpDrawView->MergeMarkedObjects(SDR_MERGE_SUBSTRACT);
278cdf0e10cSrcweir 			}
279cdf0e10cSrcweir 			Cancel();
280cdf0e10cSrcweir 			rReq.Done ();
281cdf0e10cSrcweir 		}
282cdf0e10cSrcweir 		break;
283cdf0e10cSrcweir 
284cdf0e10cSrcweir         case SID_POLY_INTERSECT:
285cdf0e10cSrcweir 		{
286cdf0e10cSrcweir 			// #88224# End text edit to avoid conflicts
287cdf0e10cSrcweir 			if(mpDrawView->IsTextEdit())
288cdf0e10cSrcweir 				mpDrawView->SdrEndTextEdit();
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 			if ( mpDrawView->IsPresObjSelected() )
291cdf0e10cSrcweir 			{
292cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
293cdf0e10cSrcweir                 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
294cdf0e10cSrcweir 			}
295cdf0e10cSrcweir 			else
296cdf0e10cSrcweir 			{
297cdf0e10cSrcweir 				WaitObject aWait( (Window*)GetActiveWindow() );
298cdf0e10cSrcweir 				mpDrawView->MergeMarkedObjects(SDR_MERGE_INTERSECT);
299cdf0e10cSrcweir 			}
300cdf0e10cSrcweir 			Cancel();
301cdf0e10cSrcweir 			rReq.Done ();
302cdf0e10cSrcweir 		}
303cdf0e10cSrcweir 		break;
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 		case SID_DISMANTLE:  // BASIC
306cdf0e10cSrcweir 		{
307cdf0e10cSrcweir 			if ( mpDrawView->IsDismantlePossible(sal_False) )
308cdf0e10cSrcweir 			{
309cdf0e10cSrcweir 				WaitObject aWait( (Window*)GetActiveWindow() );
310cdf0e10cSrcweir 				mpDrawView->DismantleMarkedObjects(sal_False);
311cdf0e10cSrcweir 			}
312cdf0e10cSrcweir 			Cancel();
313cdf0e10cSrcweir 			rReq.Done ();
314cdf0e10cSrcweir 		}
315cdf0e10cSrcweir 		break;
316cdf0e10cSrcweir 
317cdf0e10cSrcweir 		case SID_CONNECT:  // BASIC
318cdf0e10cSrcweir 		{
319cdf0e10cSrcweir 			if ( mpDrawView->IsPresObjSelected() )
320cdf0e10cSrcweir 			{
321cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
322cdf0e10cSrcweir                 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
323cdf0e10cSrcweir 			}
324cdf0e10cSrcweir 			else
325cdf0e10cSrcweir 			{
326cdf0e10cSrcweir 				WaitObject aWait( (Window*)GetActiveWindow() );
327cdf0e10cSrcweir 				mpDrawView->CombineMarkedObjects(sal_True);
328cdf0e10cSrcweir 			}
329cdf0e10cSrcweir 			Cancel();
330cdf0e10cSrcweir 			rReq.Done ();
331cdf0e10cSrcweir 		}
332cdf0e10cSrcweir 		break;
333cdf0e10cSrcweir 
334cdf0e10cSrcweir 		case SID_BREAK:  // BASIC
335cdf0e10cSrcweir 		{
336cdf0e10cSrcweir 			if ( mpDrawView->IsTextEdit() )
337cdf0e10cSrcweir 			{
338cdf0e10cSrcweir 				mpDrawView->SdrEndTextEdit();
339cdf0e10cSrcweir 			}
340cdf0e10cSrcweir 
341cdf0e10cSrcweir             if ( mpDrawView->IsBreak3DObjPossible() )
342cdf0e10cSrcweir 			{
343cdf0e10cSrcweir 				WaitObject aWait( (Window*)GetActiveWindow() );
344cdf0e10cSrcweir                 mpDrawView->Break3DObj();
345cdf0e10cSrcweir 			}
346cdf0e10cSrcweir             else if ( mpDrawView->IsDismantlePossible(sal_True) )
347cdf0e10cSrcweir 			{
348cdf0e10cSrcweir 				WaitObject aWait( (Window*)GetActiveWindow() );
349cdf0e10cSrcweir 				mpDrawView->DismantleMarkedObjects(sal_True);
350cdf0e10cSrcweir             }
351cdf0e10cSrcweir             else if ( mpDrawView->IsImportMtfPossible() )
352cdf0e10cSrcweir 			{
353cdf0e10cSrcweir 
354cdf0e10cSrcweir 				WaitObject aWait( (Window*)GetActiveWindow() );
355cdf0e10cSrcweir 				const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
356cdf0e10cSrcweir 				sal_uLong nAnz=rMarkList.GetMarkCount();
357cdf0e10cSrcweir 
358cdf0e10cSrcweir 				// Summe der Metaobjekte aller sel. Metafiles erm.
359cdf0e10cSrcweir 				sal_uLong nCount = 0;
360cdf0e10cSrcweir 				for(sal_uLong nm=0; nm<nAnz; nm++)
361cdf0e10cSrcweir 				{
362cdf0e10cSrcweir 					SdrMark*     pM=rMarkList.GetMark(nm);
363cdf0e10cSrcweir 				    SdrObject*   pObj=pM->GetMarkedSdrObj();
364cdf0e10cSrcweir 				    SdrGrafObj*  pGraf=PTR_CAST(SdrGrafObj,pObj);
365cdf0e10cSrcweir 					SdrOle2Obj*  pOle2=PTR_CAST(SdrOle2Obj,pObj);
366cdf0e10cSrcweir 			        if (pGraf!=NULL && pGraf->HasGDIMetaFile())
367cdf0e10cSrcweir 						nCount += pGraf->GetGraphic().GetGDIMetaFile().GetActionCount();
368cdf0e10cSrcweir                     if(pOle2!=NULL && pOle2->GetGraphic())
369cdf0e10cSrcweir                         nCount += pOle2->GetGraphic()->GetGDIMetaFile().GetActionCount();
370cdf0e10cSrcweir 				}
371cdf0e10cSrcweir 
372cdf0e10cSrcweir 				// anhand der erm. Summe entscheiden ob mit
373cdf0e10cSrcweir 				// oder ohne Dialog aufgebrochen wird.
374cdf0e10cSrcweir 				if(nCount < MIN_ACTIONS_FOR_DIALOG)
375cdf0e10cSrcweir 				{
376cdf0e10cSrcweir 					// ohne Dialog aufbrechen
377cdf0e10cSrcweir 					mpDrawView->DoImportMarkedMtf();
378cdf0e10cSrcweir 				}
379cdf0e10cSrcweir 				else
380cdf0e10cSrcweir 				{
381cdf0e10cSrcweir 					SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
382cdf0e10cSrcweir 					if( pFact )
383cdf0e10cSrcweir 					{
384cdf0e10cSrcweir 						VclAbstractDialog* pDlg = pFact->CreateBreakDlg(GetActiveWindow(), mpDrawView, GetDocSh(), nCount, nAnz );
385cdf0e10cSrcweir 						if( pDlg )
386cdf0e10cSrcweir 						{
387cdf0e10cSrcweir 							pDlg->Execute();
388cdf0e10cSrcweir 							delete pDlg;
389cdf0e10cSrcweir 						}
390cdf0e10cSrcweir 					}
391cdf0e10cSrcweir 				}
392cdf0e10cSrcweir 			}
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 			Cancel();
395cdf0e10cSrcweir 			rReq.Done ();
396cdf0e10cSrcweir 		}
397cdf0e10cSrcweir 		break;
398cdf0e10cSrcweir 
399cdf0e10cSrcweir 		case SID_CONVERT_TO_3D:
400cdf0e10cSrcweir 		{
401cdf0e10cSrcweir 			if ( mpDrawView->IsPresObjSelected() )
402cdf0e10cSrcweir 			{
403cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
404cdf0e10cSrcweir                 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
405cdf0e10cSrcweir 			}
406cdf0e10cSrcweir 			else
407cdf0e10cSrcweir 			{
408cdf0e10cSrcweir 				if (mpDrawView->IsConvertTo3DObjPossible())
409cdf0e10cSrcweir 				{
410cdf0e10cSrcweir 					if (mpDrawView->IsTextEdit())
411cdf0e10cSrcweir 					{
412cdf0e10cSrcweir 						mpDrawView->SdrEndTextEdit();
413cdf0e10cSrcweir 					}
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 					WaitObject aWait( (Window*)GetActiveWindow() );
416cdf0e10cSrcweir 					mpDrawView->ConvertMarkedObjTo3D(sal_True);
417cdf0e10cSrcweir 				}
418cdf0e10cSrcweir 			}
419cdf0e10cSrcweir 
420cdf0e10cSrcweir 			Cancel();
421cdf0e10cSrcweir 			rReq.Done();
422cdf0e10cSrcweir 		}
423cdf0e10cSrcweir 		break;
424cdf0e10cSrcweir 
425cdf0e10cSrcweir 		case SID_FRAME_TO_TOP:	// BASIC
426cdf0e10cSrcweir 		{
427cdf0e10cSrcweir 			mpDrawView->PutMarkedToTop();
428cdf0e10cSrcweir 			Cancel();
429cdf0e10cSrcweir 			Invalidate( SID_POSITION );
430cdf0e10cSrcweir 			rReq.Done ();
431cdf0e10cSrcweir 		}
432cdf0e10cSrcweir 		break;
433cdf0e10cSrcweir 
434cdf0e10cSrcweir 		case SID_MOREFRONT:  // BASIC
435cdf0e10cSrcweir 		{
436cdf0e10cSrcweir 			mpDrawView->MovMarkedToTop();
437cdf0e10cSrcweir 			Cancel();
438cdf0e10cSrcweir 			Invalidate( SID_POSITION );
439cdf0e10cSrcweir 			rReq.Done ();
440cdf0e10cSrcweir 		}
441cdf0e10cSrcweir 		break;
442cdf0e10cSrcweir 
443cdf0e10cSrcweir 		case SID_MOREBACK:	// BASIC
444cdf0e10cSrcweir 		{
445cdf0e10cSrcweir 			mpDrawView->MovMarkedToBtm();
446cdf0e10cSrcweir 			Cancel();
447cdf0e10cSrcweir 			Invalidate( SID_POSITION );
448cdf0e10cSrcweir 			rReq.Done ();
449cdf0e10cSrcweir 		}
450cdf0e10cSrcweir 		break;
451cdf0e10cSrcweir 
452cdf0e10cSrcweir 		case SID_FRAME_TO_BOTTOM:	// BASIC
453cdf0e10cSrcweir 		{
454cdf0e10cSrcweir 			mpDrawView->PutMarkedToBtm();
455cdf0e10cSrcweir 			Cancel();
456cdf0e10cSrcweir 			Invalidate( SID_POSITION );
457cdf0e10cSrcweir 			rReq.Done ();
458cdf0e10cSrcweir 		}
459cdf0e10cSrcweir 		break;
460cdf0e10cSrcweir 
461cdf0e10cSrcweir 		case SID_HORIZONTAL:  // BASIC
462cdf0e10cSrcweir 		{
463cdf0e10cSrcweir 			mpDrawView->MirrorAllMarkedHorizontal();
464cdf0e10cSrcweir 			Cancel();
465cdf0e10cSrcweir 			rReq.Done ();
466cdf0e10cSrcweir 		}
467cdf0e10cSrcweir 		break;
468cdf0e10cSrcweir 
469cdf0e10cSrcweir 		case SID_VERTICAL:	// BASIC
470cdf0e10cSrcweir 		{
471cdf0e10cSrcweir 			mpDrawView->MirrorAllMarkedVertical();
472cdf0e10cSrcweir 			Cancel();
473cdf0e10cSrcweir 			rReq.Done ();
474cdf0e10cSrcweir 		}
475cdf0e10cSrcweir 		break;
476cdf0e10cSrcweir 
477cdf0e10cSrcweir 		case SID_OBJECT_ALIGN_LEFT:  // BASIC
478cdf0e10cSrcweir 		{
479cdf0e10cSrcweir 			mpDrawView->AlignMarkedObjects(SDRHALIGN_LEFT, SDRVALIGN_NONE);
480cdf0e10cSrcweir 			Cancel();
481cdf0e10cSrcweir 			rReq.Done ();
482cdf0e10cSrcweir 		}
483cdf0e10cSrcweir 		break;
484cdf0e10cSrcweir 
485cdf0e10cSrcweir 		case SID_OBJECT_ALIGN_CENTER:  // BASIC
486cdf0e10cSrcweir 		{
487cdf0e10cSrcweir 			mpDrawView->AlignMarkedObjects(SDRHALIGN_CENTER, SDRVALIGN_NONE);
488cdf0e10cSrcweir 			Cancel();
489cdf0e10cSrcweir 			rReq.Done ();
490cdf0e10cSrcweir 		}
491cdf0e10cSrcweir 		break;
492cdf0e10cSrcweir 
493cdf0e10cSrcweir 		case SID_OBJECT_ALIGN_RIGHT:  // BASIC
494cdf0e10cSrcweir 		{
495cdf0e10cSrcweir 			mpDrawView->AlignMarkedObjects(SDRHALIGN_RIGHT, SDRVALIGN_NONE);
496cdf0e10cSrcweir 			Cancel();
497cdf0e10cSrcweir 			rReq.Done ();
498cdf0e10cSrcweir 		}
499cdf0e10cSrcweir 		break;
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 		case SID_OBJECT_ALIGN_UP:  // BASIC
502cdf0e10cSrcweir 		{
503cdf0e10cSrcweir 			mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_TOP);
504cdf0e10cSrcweir 			Cancel();
505cdf0e10cSrcweir 			rReq.Done ();
506cdf0e10cSrcweir 		}
507cdf0e10cSrcweir 		break;
508cdf0e10cSrcweir 
509cdf0e10cSrcweir 		case SID_OBJECT_ALIGN_MIDDLE:  // BASIC
510cdf0e10cSrcweir 		{
511cdf0e10cSrcweir 			mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_CENTER);
512cdf0e10cSrcweir 			Cancel();
513cdf0e10cSrcweir 			rReq.Done ();
514cdf0e10cSrcweir 		}
515cdf0e10cSrcweir 		break;
516cdf0e10cSrcweir 
517cdf0e10cSrcweir 		case SID_OBJECT_ALIGN_DOWN:  // BASIC
518cdf0e10cSrcweir 		{
519cdf0e10cSrcweir 			mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_BOTTOM);
520cdf0e10cSrcweir 			Cancel();
521cdf0e10cSrcweir 			rReq.Done ();
522cdf0e10cSrcweir 		}
523cdf0e10cSrcweir 		break;
524cdf0e10cSrcweir 
525cdf0e10cSrcweir 		case SID_SELECTALL:  // BASIC
526cdf0e10cSrcweir 		{
527cdf0e10cSrcweir             if( (dynamic_cast<FuSelection*>( GetOldFunction().get() ) != 0) &&
528cdf0e10cSrcweir                 !GetView()->IsFrameDragSingles() && GetView()->HasMarkablePoints())
529cdf0e10cSrcweir 			{
530cdf0e10cSrcweir 				if ( !mpDrawView->IsAction() )
531cdf0e10cSrcweir 					mpDrawView->MarkAllPoints();
532cdf0e10cSrcweir 			}
533cdf0e10cSrcweir 			else
534cdf0e10cSrcweir 				mpDrawView->SelectAll();
535cdf0e10cSrcweir 
536cdf0e10cSrcweir 			Cancel();
537cdf0e10cSrcweir 			rReq.Done ();
538cdf0e10cSrcweir 		}
539cdf0e10cSrcweir 		break;
540cdf0e10cSrcweir 
541cdf0e10cSrcweir 		case SID_STYLE_NEW:	// BASIC ???
542cdf0e10cSrcweir 		case SID_STYLE_APPLY:
543cdf0e10cSrcweir 		case SID_STYLE_EDIT:
544cdf0e10cSrcweir 		case SID_STYLE_DELETE:
545cdf0e10cSrcweir 		case SID_STYLE_FAMILY:
546cdf0e10cSrcweir 		case SID_STYLE_WATERCAN:
547cdf0e10cSrcweir 		case SID_STYLE_UPDATE_BY_EXAMPLE:
548cdf0e10cSrcweir 		case SID_STYLE_NEW_BY_EXAMPLE:
549cdf0e10cSrcweir 		{
550cdf0e10cSrcweir 			if( rReq.GetSlot() == SID_STYLE_EDIT && !rReq.GetArgs() )
551cdf0e10cSrcweir 			{
552cdf0e10cSrcweir 				SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet();
553cdf0e10cSrcweir 				if( pStyleSheet && pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE)
554cdf0e10cSrcweir 					pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
555cdf0e10cSrcweir 
556cdf0e10cSrcweir 				if( (pStyleSheet == NULL) && GetView()->IsTextEdit() )
557cdf0e10cSrcweir 				{
558cdf0e10cSrcweir 					GetView()->SdrEndTextEdit();
559cdf0e10cSrcweir 
560cdf0e10cSrcweir 					pStyleSheet = mpDrawView->GetStyleSheet();
561cdf0e10cSrcweir 					if(pStyleSheet && pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE)
562cdf0e10cSrcweir 						pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
563cdf0e10cSrcweir 				}
564cdf0e10cSrcweir 
565cdf0e10cSrcweir 				if( pStyleSheet == NULL )
566cdf0e10cSrcweir 				{
567cdf0e10cSrcweir 					rReq.Ignore();
568cdf0e10cSrcweir 					break;
569cdf0e10cSrcweir 				}
570cdf0e10cSrcweir 
571cdf0e10cSrcweir 				SfxAllItemSet aSet(GetDoc()->GetPool());
572cdf0e10cSrcweir 
573cdf0e10cSrcweir 				SfxStringItem aStyleNameItem( SID_STYLE_EDIT, pStyleSheet->GetName() );
574cdf0e10cSrcweir 				aSet.Put(aStyleNameItem);
575cdf0e10cSrcweir 
576cdf0e10cSrcweir 				SfxUInt16Item aStyleFamilyItem( SID_STYLE_FAMILY, (sal_uInt16)pStyleSheet->GetFamily() );
577cdf0e10cSrcweir 				aSet.Put(aStyleFamilyItem);
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 				rReq.SetArgs(aSet);
580cdf0e10cSrcweir 			}
581cdf0e10cSrcweir 
582cdf0e10cSrcweir 			if( rReq.GetArgs() )
583cdf0e10cSrcweir 			{
584cdf0e10cSrcweir 				SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
585cdf0e10cSrcweir 				if( rReq.GetSlot() == SID_STYLE_APPLY )
586cdf0e10cSrcweir 					GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY );
587cdf0e10cSrcweir 				Cancel();
588cdf0e10cSrcweir 			}
589cdf0e10cSrcweir 			else if( rReq.GetSlot() == SID_STYLE_APPLY )
590cdf0e10cSrcweir 				GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER, SFX_CALLMODE_ASYNCHRON );
591cdf0e10cSrcweir 			rReq.Ignore ();
592cdf0e10cSrcweir 		}
593cdf0e10cSrcweir 		break;
594cdf0e10cSrcweir 
595cdf0e10cSrcweir 		case SID_IMAP:
596cdf0e10cSrcweir 		{
597cdf0e10cSrcweir 			SvxIMapDlg* pDlg;
598cdf0e10cSrcweir 			sal_uInt16		nId = SvxIMapDlgChildWindow::GetChildWindowId();
599cdf0e10cSrcweir 
600cdf0e10cSrcweir 			GetViewFrame()->ToggleChildWindow( nId );
601cdf0e10cSrcweir 			GetViewFrame()->GetBindings().Invalidate( SID_IMAP );
602cdf0e10cSrcweir 
603cdf0e10cSrcweir 			if ( GetViewFrame()->HasChildWindow( nId )
604cdf0e10cSrcweir                 && ( ( pDlg = ViewShell::Implementation::GetImageMapDialog() ) != NULL ) )
605cdf0e10cSrcweir 			{
606cdf0e10cSrcweir 				const SdrMarkList&	rMarkList = mpDrawView->GetMarkedObjectList();
607cdf0e10cSrcweir 
608cdf0e10cSrcweir 				if ( rMarkList.GetMarkCount() == 1 )
609cdf0e10cSrcweir 					UpdateIMapDlg( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
610cdf0e10cSrcweir 			}
611cdf0e10cSrcweir 
612cdf0e10cSrcweir 			Cancel();
613cdf0e10cSrcweir 			rReq.Ignore ();
614cdf0e10cSrcweir 		}
615cdf0e10cSrcweir 		break;
616cdf0e10cSrcweir 
617cdf0e10cSrcweir 		case SID_GRID_FRONT:
618cdf0e10cSrcweir 		{
619cdf0e10cSrcweir 			mpDrawView->SetGridFront( !mpDrawView->IsGridFront() );
620cdf0e10cSrcweir 			Cancel();
621cdf0e10cSrcweir 			rReq.Done ();
622cdf0e10cSrcweir 		}
623cdf0e10cSrcweir 		break;
624cdf0e10cSrcweir 
625cdf0e10cSrcweir 		case SID_HELPLINES_FRONT:
626cdf0e10cSrcweir 		{
627cdf0e10cSrcweir 			mpDrawView->SetHlplFront( !mpDrawView->IsHlplFront() );
628cdf0e10cSrcweir 			Cancel();
629cdf0e10cSrcweir 			rReq.Done ();
630cdf0e10cSrcweir 		}
631cdf0e10cSrcweir 		break;
632cdf0e10cSrcweir 
633cdf0e10cSrcweir 		default:
634cdf0e10cSrcweir 			FuTemp04(rReq);
635cdf0e10cSrcweir 		break;
636cdf0e10cSrcweir 	};
637cdf0e10cSrcweir };
638cdf0e10cSrcweir 
639cdf0e10cSrcweir /*************************************************************************
640cdf0e10cSrcweir |*
641cdf0e10cSrcweir |* Liefert die globale/Haupt-ID zurueck, also die ID, ueber die die
642cdf0e10cSrcweir |* Toolbox ausgeloest wird
643cdf0e10cSrcweir |*
644cdf0e10cSrcweir \************************************************************************/
645cdf0e10cSrcweir 
646cdf0e10cSrcweir sal_uInt16 DrawViewShell::GetIdBySubId( sal_uInt16 nSId )
647cdf0e10cSrcweir {
648cdf0e10cSrcweir 	sal_uInt16 nMappedSId = 0;
649cdf0e10cSrcweir 	switch( nSId )
650cdf0e10cSrcweir 	{
651cdf0e10cSrcweir 		case SID_OBJECT_ROTATE:
652cdf0e10cSrcweir 		case SID_OBJECT_MIRROR:
653cdf0e10cSrcweir 		case SID_OBJECT_TRANSPARENCE:
654cdf0e10cSrcweir 		case SID_OBJECT_GRADIENT:
655cdf0e10cSrcweir 		case SID_OBJECT_SHEAR:
656cdf0e10cSrcweir 		case SID_OBJECT_CROOK_ROTATE:
657cdf0e10cSrcweir 		case SID_OBJECT_CROOK_SLANT:
658cdf0e10cSrcweir 		case SID_OBJECT_CROOK_STRETCH:
659cdf0e10cSrcweir         case SID_CONVERT_TO_3D_LATHE:
660cdf0e10cSrcweir 		{
661cdf0e10cSrcweir 			nMappedSId = SID_OBJECT_CHOOSE_MODE;
662cdf0e10cSrcweir 		}
663cdf0e10cSrcweir 		break;
664cdf0e10cSrcweir 
665cdf0e10cSrcweir 		case SID_OBJECT_ALIGN_LEFT:
666cdf0e10cSrcweir 		case SID_OBJECT_ALIGN_CENTER:
667cdf0e10cSrcweir 		case SID_OBJECT_ALIGN_RIGHT:
668cdf0e10cSrcweir 		case SID_OBJECT_ALIGN_UP:
669cdf0e10cSrcweir 		case SID_OBJECT_ALIGN_MIDDLE:
670cdf0e10cSrcweir 		case SID_OBJECT_ALIGN_DOWN:
671cdf0e10cSrcweir 		{
672cdf0e10cSrcweir 			nMappedSId = SID_OBJECT_ALIGN;
673cdf0e10cSrcweir 		}
674cdf0e10cSrcweir 		break;
675cdf0e10cSrcweir 
676cdf0e10cSrcweir 		case SID_FRAME_TO_TOP:
677cdf0e10cSrcweir 		case SID_MOREFRONT:
678cdf0e10cSrcweir 		case SID_MOREBACK:
679cdf0e10cSrcweir 		case SID_FRAME_TO_BOTTOM:
680cdf0e10cSrcweir 		case SID_BEFORE_OBJ:
681cdf0e10cSrcweir 		case SID_BEHIND_OBJ:
682cdf0e10cSrcweir 		case SID_REVERSE_ORDER:
683cdf0e10cSrcweir 		{
684cdf0e10cSrcweir 			nMappedSId = SID_POSITION;
685cdf0e10cSrcweir 		}
686cdf0e10cSrcweir 		break;
687cdf0e10cSrcweir 
688cdf0e10cSrcweir 		case SID_ZOOM_OUT:
689cdf0e10cSrcweir 		case SID_ZOOM_IN:
690cdf0e10cSrcweir 		case SID_SIZE_REAL:
691cdf0e10cSrcweir 		case SID_ZOOM_PANNING:
692cdf0e10cSrcweir 		case SID_SIZE_PAGE:
693cdf0e10cSrcweir 		case SID_SIZE_PAGE_WIDTH:
694cdf0e10cSrcweir 		case SID_SIZE_ALL:
695cdf0e10cSrcweir 		case SID_SIZE_OPTIMAL:
696cdf0e10cSrcweir 		case SID_ZOOM_NEXT:
697cdf0e10cSrcweir 		case SID_ZOOM_PREV:
698cdf0e10cSrcweir 		{
699cdf0e10cSrcweir 			nMappedSId = SID_ZOOM_TOOLBOX;
700cdf0e10cSrcweir 		}
701cdf0e10cSrcweir 		break;
702cdf0e10cSrcweir 
703cdf0e10cSrcweir 		case SID_ATTR_CHAR:
704cdf0e10cSrcweir 		case SID_TEXT_FITTOSIZE:
705cdf0e10cSrcweir 		case SID_DRAW_CAPTION:
706cdf0e10cSrcweir 		case SID_DRAW_FONTWORK:
707cdf0e10cSrcweir 		case SID_DRAW_FONTWORK_VERTICAL:
708cdf0e10cSrcweir 		{
709cdf0e10cSrcweir 			nMappedSId = SID_DRAWTBX_TEXT;
710cdf0e10cSrcweir 		}
711cdf0e10cSrcweir 		break;
712cdf0e10cSrcweir 
713cdf0e10cSrcweir 		case SID_DRAW_RECT:
714cdf0e10cSrcweir 		case SID_DRAW_SQUARE:
715cdf0e10cSrcweir 		case SID_DRAW_RECT_ROUND:
716cdf0e10cSrcweir 		case SID_DRAW_SQUARE_ROUND:
717cdf0e10cSrcweir 		case SID_DRAW_RECT_NOFILL:
718cdf0e10cSrcweir 		case SID_DRAW_SQUARE_NOFILL:
719cdf0e10cSrcweir 		case SID_DRAW_RECT_ROUND_NOFILL:
720cdf0e10cSrcweir 		case SID_DRAW_SQUARE_ROUND_NOFILL:
721cdf0e10cSrcweir 		{
722cdf0e10cSrcweir 			nMappedSId = SID_DRAWTBX_RECTANGLES;
723cdf0e10cSrcweir 		}
724cdf0e10cSrcweir 		break;
725cdf0e10cSrcweir 
726cdf0e10cSrcweir 		case SID_DRAW_ELLIPSE:
727cdf0e10cSrcweir 		case SID_DRAW_CIRCLE:
728cdf0e10cSrcweir 		case SID_DRAW_PIE:
729cdf0e10cSrcweir 		case SID_DRAW_CIRCLEPIE:
730cdf0e10cSrcweir 		case SID_DRAW_ELLIPSECUT:
731cdf0e10cSrcweir 		case SID_DRAW_CIRCLECUT:
732cdf0e10cSrcweir 		case SID_DRAW_ARC:
733cdf0e10cSrcweir 		case SID_DRAW_CIRCLEARC:
734cdf0e10cSrcweir 		case SID_DRAW_ELLIPSE_NOFILL:
735cdf0e10cSrcweir 		case SID_DRAW_CIRCLE_NOFILL:
736cdf0e10cSrcweir 		case SID_DRAW_PIE_NOFILL:
737cdf0e10cSrcweir 		case SID_DRAW_CIRCLEPIE_NOFILL:
738cdf0e10cSrcweir 		case SID_DRAW_ELLIPSECUT_NOFILL:
739cdf0e10cSrcweir 		case SID_DRAW_CIRCLECUT_NOFILL:
740cdf0e10cSrcweir 		{
741cdf0e10cSrcweir 			nMappedSId = SID_DRAWTBX_ELLIPSES;
742cdf0e10cSrcweir 		}
743cdf0e10cSrcweir 		break;
744cdf0e10cSrcweir 
745cdf0e10cSrcweir         case SID_DRAW_BEZIER_NOFILL:
746cdf0e10cSrcweir 		case SID_DRAW_POLYGON_NOFILL:
747cdf0e10cSrcweir 		case SID_DRAW_XPOLYGON_NOFILL:
748cdf0e10cSrcweir         case SID_DRAW_FREELINE_NOFILL:
749cdf0e10cSrcweir         case SID_DRAW_BEZIER_FILL:
750cdf0e10cSrcweir 		case SID_DRAW_POLYGON:
751cdf0e10cSrcweir 		case SID_DRAW_XPOLYGON:
752cdf0e10cSrcweir         case SID_DRAW_FREELINE:
753cdf0e10cSrcweir 		{
754cdf0e10cSrcweir 			nMappedSId = SID_DRAWTBX_LINES;
755cdf0e10cSrcweir 		}
756cdf0e10cSrcweir 		break;
757cdf0e10cSrcweir 
758cdf0e10cSrcweir 		case SID_DRAW_LINE:
759cdf0e10cSrcweir 		case SID_DRAW_XLINE:
760cdf0e10cSrcweir 		case SID_DRAW_MEASURELINE:
761cdf0e10cSrcweir 		case SID_LINE_ARROW_START:
762cdf0e10cSrcweir 		case SID_LINE_ARROW_END:
763cdf0e10cSrcweir 		case SID_LINE_ARROWS:
764cdf0e10cSrcweir 		case SID_LINE_ARROW_CIRCLE:
765cdf0e10cSrcweir 		case SID_LINE_CIRCLE_ARROW:
766cdf0e10cSrcweir 		case SID_LINE_ARROW_SQUARE:
767cdf0e10cSrcweir 		case SID_LINE_SQUARE_ARROW:
768cdf0e10cSrcweir 		{
769cdf0e10cSrcweir 			nMappedSId = SID_DRAWTBX_ARROWS;
770cdf0e10cSrcweir 		}
771cdf0e10cSrcweir 		break;
772cdf0e10cSrcweir 
773cdf0e10cSrcweir 		case SID_3D_CUBE:
774cdf0e10cSrcweir 		case SID_3D_TORUS:
775cdf0e10cSrcweir 		case SID_3D_SPHERE:
776cdf0e10cSrcweir 		case SID_3D_SHELL:
777cdf0e10cSrcweir 		case SID_3D_HALF_SPHERE:
778cdf0e10cSrcweir 		case SID_3D_CYLINDER:
779cdf0e10cSrcweir 		case SID_3D_CONE:
780cdf0e10cSrcweir 		case SID_3D_PYRAMID:
781cdf0e10cSrcweir 		{
782cdf0e10cSrcweir 			nMappedSId = SID_DRAWTBX_3D_OBJECTS;
783cdf0e10cSrcweir 		}
784cdf0e10cSrcweir 		break;
785cdf0e10cSrcweir 
786cdf0e10cSrcweir 		case SID_INSERT_DIAGRAM:
787cdf0e10cSrcweir 		case SID_ATTR_TABLE:
788cdf0e10cSrcweir 		case SID_INSERTFILE:
789cdf0e10cSrcweir 		case SID_INSERT_GRAPHIC:
790cdf0e10cSrcweir 		case SID_INSERT_AVMEDIA:
791cdf0e10cSrcweir 		case SID_INSERTPAGE:
792cdf0e10cSrcweir 	    case SID_INSERT_MATH:
793cdf0e10cSrcweir 	    case SID_INSERT_FLOATINGFRAME:
794cdf0e10cSrcweir 	    case SID_INSERT_OBJECT:
795cdf0e10cSrcweir         case SID_INSERT_PLUGIN:
796cdf0e10cSrcweir 		case SID_INSERT_SOUND:
797cdf0e10cSrcweir 		case SID_INSERT_VIDEO:
798cdf0e10cSrcweir 		case SID_INSERT_TABLE:
799cdf0e10cSrcweir 		{
800cdf0e10cSrcweir 			nMappedSId = SID_DRAWTBX_INSERT;
801cdf0e10cSrcweir 		}
802cdf0e10cSrcweir 		break;
803cdf0e10cSrcweir 
804cdf0e10cSrcweir         case SID_TOOL_CONNECTOR:
805cdf0e10cSrcweir         case SID_CONNECTOR_ARROW_START:
806cdf0e10cSrcweir         case SID_CONNECTOR_ARROW_END:
807cdf0e10cSrcweir         case SID_CONNECTOR_ARROWS:
808cdf0e10cSrcweir         case SID_CONNECTOR_CIRCLE_START:
809cdf0e10cSrcweir         case SID_CONNECTOR_CIRCLE_END:
810cdf0e10cSrcweir         case SID_CONNECTOR_CIRCLES:
811cdf0e10cSrcweir         case SID_CONNECTOR_LINE:
812cdf0e10cSrcweir         case SID_CONNECTOR_LINE_ARROW_START:
813cdf0e10cSrcweir         case SID_CONNECTOR_LINE_ARROW_END:
814cdf0e10cSrcweir         case SID_CONNECTOR_LINE_ARROWS:
815cdf0e10cSrcweir         case SID_CONNECTOR_LINE_CIRCLE_START:
816cdf0e10cSrcweir         case SID_CONNECTOR_LINE_CIRCLE_END:
817cdf0e10cSrcweir         case SID_CONNECTOR_LINE_CIRCLES:
818cdf0e10cSrcweir         case SID_CONNECTOR_CURVE:
819cdf0e10cSrcweir         case SID_CONNECTOR_CURVE_ARROW_START:
820cdf0e10cSrcweir         case SID_CONNECTOR_CURVE_ARROW_END:
821cdf0e10cSrcweir         case SID_CONNECTOR_CURVE_ARROWS:
822cdf0e10cSrcweir         case SID_CONNECTOR_CURVE_CIRCLE_START:
823cdf0e10cSrcweir         case SID_CONNECTOR_CURVE_CIRCLE_END:
824cdf0e10cSrcweir         case SID_CONNECTOR_CURVE_CIRCLES:
825cdf0e10cSrcweir         case SID_CONNECTOR_LINES:
826cdf0e10cSrcweir         case SID_CONNECTOR_LINES_ARROW_START:
827cdf0e10cSrcweir         case SID_CONNECTOR_LINES_ARROW_END:
828cdf0e10cSrcweir         case SID_CONNECTOR_LINES_ARROWS:
829cdf0e10cSrcweir         case SID_CONNECTOR_LINES_CIRCLE_START:
830cdf0e10cSrcweir         case SID_CONNECTOR_LINES_CIRCLE_END:
831cdf0e10cSrcweir         case SID_CONNECTOR_LINES_CIRCLES:
832cdf0e10cSrcweir         {
833cdf0e10cSrcweir             nMappedSId = SID_DRAWTBX_CONNECTORS;
834cdf0e10cSrcweir         }
835cdf0e10cSrcweir 	}
836cdf0e10cSrcweir 	return( nMappedSId );
837cdf0e10cSrcweir }
838cdf0e10cSrcweir 
839cdf0e10cSrcweir /*************************************************************************
840cdf0e10cSrcweir |*
841cdf0e10cSrcweir |* Fuellt das SlotArray, um das aktuelle Mapping des ToolboxSlots zu
842cdf0e10cSrcweir |* bekommen
843cdf0e10cSrcweir |*
844cdf0e10cSrcweir \************************************************************************/
845cdf0e10cSrcweir 
846cdf0e10cSrcweir void DrawViewShell::MapSlot( sal_uInt16 nSId )
847cdf0e10cSrcweir {
848cdf0e10cSrcweir 	sal_uInt16 nMappedSId = GetIdBySubId( nSId );
849cdf0e10cSrcweir 
850cdf0e10cSrcweir 	if( nMappedSId > 0 )
851cdf0e10cSrcweir 	{
852cdf0e10cSrcweir 		sal_uInt16 nID = GetArrayId( nMappedSId ) + 1;
853cdf0e10cSrcweir 		mpSlotArray[ nID ] = nSId;
854cdf0e10cSrcweir 	}
855cdf0e10cSrcweir }
856cdf0e10cSrcweir 
857cdf0e10cSrcweir /*************************************************************************
858cdf0e10cSrcweir |*
859cdf0e10cSrcweir |* Ermoeglicht ueber das SlotArray ein ImageMapping
860cdf0e10cSrcweir |*
861cdf0e10cSrcweir \************************************************************************/
862cdf0e10cSrcweir 
863cdf0e10cSrcweir void DrawViewShell::UpdateToolboxImages( SfxItemSet &rSet, sal_Bool bPermanent )
864cdf0e10cSrcweir {
865cdf0e10cSrcweir 	if( !bPermanent )
866cdf0e10cSrcweir 	{
867cdf0e10cSrcweir 		sal_uInt16 nId = GetArrayId( SID_ZOOM_TOOLBOX ) + 1;
868cdf0e10cSrcweir 		rSet.Put( TbxImageItem( SID_ZOOM_TOOLBOX, mpSlotArray[nId] ) );
869cdf0e10cSrcweir 
870cdf0e10cSrcweir 		nId = GetArrayId( SID_DRAWTBX_INSERT ) + 1;
871cdf0e10cSrcweir 		rSet.Put( TbxImageItem( SID_DRAWTBX_INSERT, mpSlotArray[nId] ) );
872cdf0e10cSrcweir 
873cdf0e10cSrcweir 		nId = GetArrayId( SID_POSITION ) + 1;
874cdf0e10cSrcweir 		rSet.Put( TbxImageItem( SID_POSITION, mpSlotArray[nId] ) );
875cdf0e10cSrcweir 
876cdf0e10cSrcweir 		nId = GetArrayId( SID_OBJECT_ALIGN ) + 1;
877cdf0e10cSrcweir 		rSet.Put( TbxImageItem( SID_OBJECT_ALIGN, mpSlotArray[nId] ) );
878cdf0e10cSrcweir 	}
879cdf0e10cSrcweir 	else
880cdf0e10cSrcweir 	{
881cdf0e10cSrcweir 		for( sal_uInt16 nId = 0; nId < SLOTARRAY_COUNT; nId += 2 )
882cdf0e10cSrcweir 		{
883cdf0e10cSrcweir 			rSet.Put( TbxImageItem( mpSlotArray[nId], mpSlotArray[nId+1] ) );
884cdf0e10cSrcweir 		}
885cdf0e10cSrcweir 	}
886cdf0e10cSrcweir }
887cdf0e10cSrcweir 
888cdf0e10cSrcweir /*************************************************************************
889cdf0e10cSrcweir |*
890cdf0e10cSrcweir |* Gibt den gemappten Slot zurueck
891cdf0e10cSrcweir |*
892cdf0e10cSrcweir \************************************************************************/
893cdf0e10cSrcweir 
894cdf0e10cSrcweir sal_uInt16 DrawViewShell::GetMappedSlot( sal_uInt16 nSId )
895cdf0e10cSrcweir {
896cdf0e10cSrcweir 	sal_uInt16 nSlot = 0;
897cdf0e10cSrcweir 	sal_uInt16 nId = GetArrayId( nSId );
898cdf0e10cSrcweir 	if( nId != USHRT_MAX )
899cdf0e10cSrcweir 		nSlot = mpSlotArray[ nId+1 ];
900cdf0e10cSrcweir 
901cdf0e10cSrcweir 	// Wenn der Slot noch auf sich selbst gemapped ist, muss 0 zurueck-
902cdf0e10cSrcweir 	// gegeben werden, da sonst der Slot immer wieder selbst executet
903cdf0e10cSrcweir 	// wird. Im Array ist der Slot selbst initial vorhanden, damit das
904cdf0e10cSrcweir 	// Image richtig angezeigt wird.
905cdf0e10cSrcweir 	if( nSId == nSlot )
906cdf0e10cSrcweir 		return( 0 );
907cdf0e10cSrcweir 
908cdf0e10cSrcweir 	return( nSlot );
909cdf0e10cSrcweir }
910cdf0e10cSrcweir 
911cdf0e10cSrcweir /*************************************************************************
912cdf0e10cSrcweir |*
913cdf0e10cSrcweir |* Gibt die Nummer des HauptSlots im SlotArray zurueck
914cdf0e10cSrcweir |*
915cdf0e10cSrcweir \************************************************************************/
916cdf0e10cSrcweir 
917cdf0e10cSrcweir sal_uInt16 DrawViewShell::GetArrayId( sal_uInt16 nSId )
918cdf0e10cSrcweir {
919cdf0e10cSrcweir 	for( sal_uInt16 i = 0; i < SLOTARRAY_COUNT; i += 2 )
920cdf0e10cSrcweir 	{
921cdf0e10cSrcweir 		if( mpSlotArray[ i ] == nSId )
922cdf0e10cSrcweir 			return( i );
923cdf0e10cSrcweir 	}
924cdf0e10cSrcweir 	DBG_ERROR( "Slot im Array nicht gefunden!" );
925cdf0e10cSrcweir 	return( USHRT_MAX );
926cdf0e10cSrcweir }
927cdf0e10cSrcweir 
928cdf0e10cSrcweir 
929cdf0e10cSrcweir /*************************************************************************
930cdf0e10cSrcweir |*
931cdf0e10cSrcweir |* IMap-Dlg updaten
932cdf0e10cSrcweir |*
933cdf0e10cSrcweir \************************************************************************/
934cdf0e10cSrcweir 
935cdf0e10cSrcweir void DrawViewShell::UpdateIMapDlg( SdrObject* pObj )
936cdf0e10cSrcweir {
937cdf0e10cSrcweir 	if( ( pObj->ISA( SdrGrafObj ) || pObj->ISA( SdrOle2Obj ) ) && !mpDrawView->IsTextEdit() &&
938cdf0e10cSrcweir 		 GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
939cdf0e10cSrcweir 	{
940cdf0e10cSrcweir 		Graphic 	aGraphic;
941cdf0e10cSrcweir 		ImageMap*	pIMap = NULL;
942cdf0e10cSrcweir 		TargetList*	pTargetList = NULL;
943cdf0e10cSrcweir 		SdIMapInfo* pIMapInfo = GetDoc()->GetIMapInfo( pObj );
944cdf0e10cSrcweir 
945cdf0e10cSrcweir 		// get graphic from shape
946cdf0e10cSrcweir 		SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >( pObj );
947cdf0e10cSrcweir 		if( pGrafObj )
948cdf0e10cSrcweir 			aGraphic = pGrafObj->GetGraphic();
949cdf0e10cSrcweir 
950cdf0e10cSrcweir 		if ( pIMapInfo )
951cdf0e10cSrcweir 		{
952cdf0e10cSrcweir 			pIMap = (ImageMap*) &pIMapInfo->GetImageMap();
953cdf0e10cSrcweir 			pTargetList = new TargetList;
954cdf0e10cSrcweir 			GetViewFrame()->GetTargetList( *pTargetList );
955cdf0e10cSrcweir 		}
956cdf0e10cSrcweir 
957cdf0e10cSrcweir 		SvxIMapDlgChildWindow::UpdateIMapDlg( aGraphic, pIMap, pTargetList, pObj );
958cdf0e10cSrcweir 
959cdf0e10cSrcweir 		// TargetListe kann von uns wieder geloescht werden
960cdf0e10cSrcweir 		if ( pTargetList )
961cdf0e10cSrcweir 		{
962cdf0e10cSrcweir 			String* pEntry = pTargetList->First();
963cdf0e10cSrcweir 			while( pEntry )
964cdf0e10cSrcweir 			{
965cdf0e10cSrcweir 				delete pEntry;
966cdf0e10cSrcweir 				pEntry = pTargetList->Next();
967cdf0e10cSrcweir 			}
968cdf0e10cSrcweir 
969cdf0e10cSrcweir 			delete pTargetList;
970cdf0e10cSrcweir 		}
971cdf0e10cSrcweir 	}
972cdf0e10cSrcweir }
973cdf0e10cSrcweir 
974cdf0e10cSrcweir // -----------------------------------------------------------------------------
975cdf0e10cSrcweir 
976cdf0e10cSrcweir IMPL_LINK( DrawViewShell, NameObjectHdl, AbstractSvxNameDialog*, pDialog )
977cdf0e10cSrcweir {
978cdf0e10cSrcweir     String aName;
979cdf0e10cSrcweir 
980cdf0e10cSrcweir     if( pDialog )
981cdf0e10cSrcweir         pDialog->GetName( aName );
982cdf0e10cSrcweir 
983cdf0e10cSrcweir     return( ( !aName.Len() || ( GetDoc() && !GetDoc()->GetObj( aName ) ) ) ? 1 : 0 );
984cdf0e10cSrcweir }
985cdf0e10cSrcweir 
986cdf0e10cSrcweir } // end of namespace sd
987