xref: /trunk/main/sd/source/ui/view/drviews7.cxx (revision ee093554)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 #include <com/sun/star/lang/Locale.hpp>
28 #include <com/sun/star/linguistic2/XThesaurus.hpp>
29 #include <svx/fmglob.hxx>
30 #include <svx/globl3d.hxx>
31 #include <svx/svdouno.hxx>
32 #include <editeng/eeitem.hxx>
33 #include <editeng/flditem.hxx>
34 #include <editeng/outlobj.hxx>
35 #include <svx/svxids.hrc>
36 #include <svx/svdpagv.hxx>
37 #include <svx/clipfmtitem.hxx>
38 #include <svx/fmshell.hxx>
39 #include <svl/eitem.hxx>
40 #include <svl/aeitem.hxx>
41 #include <svl/stritem.hxx>
42 #include <svl/visitem.hxx>
43 #include <svl/whiter.hxx>
44 #include <sfx2/dispatch.hxx>
45 #include <svx/svdograf.hxx>
46 #include <editeng/unolingu.hxx>
47 #include <svx/extrusionbar.hxx>
48 #include <svx/fontworkbar.hxx>
49 
50 // #UndoRedo#
51 #include <svl/slstitm.hxx>
52 #include <sfx2/app.hxx>
53 #include <svtools/insdlg.hxx>
54 #include <unotools/moduleoptions.hxx>
55 #include <svl/languageoptions.hxx>
56 #include <comphelper/processfactory.hxx>
57 #include <sfx2/request.hxx>
58 
59 
60 #include <svx/pfiledlg.hxx>
61 #include <svx/grafctrl.hxx>
62 #include <svtools/cliplistener.hxx>
63 #include <sfx2/viewfrm.hxx>
64 
65 #include "app.hrc"
66 #include "glob.hrc"
67 #include "res_bmp.hrc"
68 #include "PresentationViewShell.hxx"
69 
70 #include "misc.hxx"
71 #include "Outliner.hxx"
72 #include "drawdoc.hxx"
73 #include "sdresid.hxx"
74 #include "sdpage.hxx"
75 #include "Client.hxx"
76 #include "DrawDocShell.hxx"
77 #include "zoomlist.hxx"
78 #include "slideshow.hxx"
79 #include "drawview.hxx"
80 #include "ViewShellBase.hxx"
81 #include "ViewShellManager.hxx"
82 #include "LayerTabBar.hxx"
83 #include "fupoor.hxx"
84 #include "Window.hxx"
85 #include "fuediglu.hxx"
86 #include "fubullet.hxx"
87 #include "fuformatpaintbrush.hxx"
88 
89 using ::rtl::OUString;
90 using namespace ::com::sun::star;
91 using namespace ::com::sun::star::uno;
92 using namespace ::com::sun::star::lang;
93 using namespace ::com::sun::star::linguistic2;
94 
95 /** Create a list of clipboard formats that are supported both from the
96     current clipboard content and the DrawViewShell.
97     The list is stored in a new instance of SvxClipboardFmtItem.
98 */
99 ::std::auto_ptr<SvxClipboardFmtItem> GetSupportedClipboardFormats (
100     TransferableDataHelper& rDataHelper)
101 {
102     ::std::auto_ptr<SvxClipboardFmtItem> pResult (
103         new SvxClipboardFmtItem(SID_CLIPBOARD_FORMAT_ITEMS));
104 
105     sal_uInt32 nFormatCount (rDataHelper.GetFormatCount());
106     for (sal_uInt32 i=0; i<nFormatCount; i++)
107     {
108         const SotFormatStringId nTestFormat = rDataHelper.GetFormat(i);
109 
110         // Check if the current format is the same as one that has already
111         // been handled.
112         bool bDuplicate (false);
113         for (sal_uInt32 j=0; j<i; j++)
114         {
115             if (nTestFormat == rDataHelper.GetFormat(j))
116             {
117                 bDuplicate = true;
118                 break;
119             }
120         }
121 
122         // Look up the format among those that are supported by the
123         // DrawViewShell.
124         if ( ! bDuplicate)
125         {
126             switch (nTestFormat)
127             {
128                 case SOT_FORMATSTR_ID_EMBED_SOURCE:
129                 {
130                     String sName;
131 
132                     TransferableObjectDescriptor aDescriptor;
133                     if (rDataHelper.GetTransferableObjectDescriptor(
134                         SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDescriptor))
135                         {
136                             sName = aDescriptor.maTypeName;
137                         }
138                     if (sName.Len() > 0)
139                         pResult->AddClipbrdFormat(nTestFormat, sName);
140                     else
141                         pResult->AddClipbrdFormat(nTestFormat);
142 
143                     break;
144                 }
145 
146                 case SOT_FORMATSTR_ID_LINK_SOURCE:
147                 case SOT_FORMATSTR_ID_DRAWING:
148                 case SOT_FORMATSTR_ID_SVXB:
149                 case FORMAT_GDIMETAFILE:
150                 case FORMAT_BITMAP:
151                 case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
152                 case FORMAT_STRING:
153                 case SOT_FORMATSTR_ID_HTML:
154                 case FORMAT_RTF:
155                 case SOT_FORMATSTR_ID_EDITENGINE:
156                     pResult->AddClipbrdFormat(nTestFormat);
157                     break;
158             }
159         }
160     }
161 
162     // Check some OLE formats whose names are handled differently.
163     SotFormatStringId nFormat (SOT_FORMATSTR_ID_EMBED_SOURCE_OLE);
164     bool bHasFormat (rDataHelper.HasFormat(nFormat));
165     if ( ! bHasFormat)
166     {
167         bHasFormat = rDataHelper.HasFormat(nFormat);
168     }
169     if (bHasFormat)
170     {
171         String sName;
172         String sSource;
173         if (SvPasteObjectHelper::GetEmbeddedName (rDataHelper, sName, sSource, nFormat))
174             pResult->AddClipbrdFormat (nFormat, sName);
175     }
176 
177     return pResult;
178 }
179 
180 namespace sd {
181 
182 IMPL_LINK( DrawViewShell, ClipboardChanged, TransferableDataHelper*, pDataHelper )
183 {
184 	if ( pDataHelper )
185 	{
186 		mbPastePossible = ( pDataHelper->GetFormatCount() != 0 );
187 
188         // Update the list of supported clipboard formats according to the
189         // new clipboard content.
190         // There are some stack traces that indicate the possibility of the
191         // DrawViewShell destructor called during the call to
192         // GetSupportedClipboardFormats().  If that really has happened then
193         // exit immediately.
194         TransferableDataHelper aDataHelper (
195             TransferableDataHelper::CreateFromSystemClipboard(GetActiveWindow()));
196         ::std::auto_ptr<SvxClipboardFmtItem> pFormats (GetSupportedClipboardFormats(aDataHelper));
197         if (mpDrawView == NULL)
198             return 0;
199         mpCurrentClipboardFormats = pFormats;
200 
201 		SfxBindings& rBindings = GetViewFrame()->GetBindings();
202 		rBindings.Invalidate( SID_PASTE );
203         rBindings.Invalidate( SID_PASTE_SPECIAL );
204 		rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
205 	}
206 	return 0;
207 }
208 
209 
210 
211 
212 void DrawViewShell::GetDrawAttrState(SfxItemSet& rSet)
213 {
214     const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
215 
216     SfxItemSet aSet( mpDrawView->GetGeoAttrFromMarked() );
217     rSet.Put(aSet,sal_False);
218 }
219 
220 
221 
222 
223 /*************************************************************************
224 |*
225 |* Status (Enabled/Disabled) von Menue-SfxSlots setzen
226 |*
227 \************************************************************************/
228 
229 void DrawViewShell::GetMenuState( SfxItemSet &rSet )
230 {
231     if (mpDrawView == NULL)
232     {
233         // This assertion and return are here to prevent crashes like that
234         // of issue #126202#.
235         DBG_ASSERT(mpDrawView!=NULL, "Please report this assertion to the Impress team.");
236         return;
237     }
238 
239     ViewShell::GetMenuState(rSet);
240 	sal_Bool bDisableVerticalText = !SvtLanguageOptions().IsVerticalTextEnabled();
241 
242 	if ( bDisableVerticalText )
243 	{
244 		rSet.DisableItem( SID_DRAW_FONTWORK_VERTICAL );
245 		rSet.DisableItem( SID_DRAW_CAPTION_VERTICAL );
246 		rSet.DisableItem( SID_TEXT_FITTOSIZE_VERTICAL );
247 		rSet.DisableItem( SID_DRAW_TEXT_VERTICAL );
248 	}
249 
250 	FASTBOOL bConvertToPathPossible = mpDrawView->IsConvertToPathObjPossible(sal_False);
251 
252 	const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
253 	const sal_uLong nMarkCount = rMarkList.GetMarkCount();
254 
255     //format paintbrush
256     FuFormatPaintBrush::GetMenuState( *this, rSet );
257 
258 	// Stati der SfxChild-Windows (Animator, Fontwork etc.)
259 	SetChildWindowState( rSet );
260 
261 	// Images der Toolboxen mappen (nur Zoom)
262 	UpdateToolboxImages( rSet, sal_False );
263 
264 	if(HasCurrentFunction())
265 	{
266 		sal_uInt16 nSId = GetCurrentFunction()->GetSlotID();
267 
268 		rSet.Put( SfxBoolItem( nSId, sal_True ) );
269 
270         // Bewirkt ein uncheck eines simulierten Slots
271 		sal_uInt16 nId = GetIdBySubId( nSId );
272 
273 		// Images der Toolboxen mappen
274 		UpdateToolboxImages( rSet );
275 
276 		if( nId != SID_ZOOM_TOOLBOX &&
277 			nSId != SID_DRAWTBX_INSERT &&
278 			nSId != SID_POSITION &&
279 			nSId != SID_OBJECT_ALIGN )
280 		{
281 			if( nId != SID_OBJECT_CHOOSE_MODE )
282 				rSet.Put( TbxImageItem( SID_OBJECT_CHOOSE_MODE, 0 ) );
283 			if( nId != SID_DRAWTBX_TEXT )
284 				rSet.Put( TbxImageItem( SID_DRAWTBX_TEXT, 0 ) );
285 			if( nId != SID_DRAWTBX_RECTANGLES )
286 				rSet.Put( TbxImageItem( SID_DRAWTBX_RECTANGLES, 0 ) );
287 			if( nId != SID_DRAWTBX_ELLIPSES )
288 				rSet.Put( TbxImageItem( SID_DRAWTBX_ELLIPSES, 0 ) );
289 			if( nId != SID_DRAWTBX_LINES )
290 				rSet.Put( TbxImageItem( SID_DRAWTBX_LINES, 0 ) );
291 			if( nId != SID_DRAWTBX_ARROWS )
292 				rSet.Put( TbxImageItem( SID_DRAWTBX_ARROWS, 0 ) );
293 			if( nId != SID_DRAWTBX_3D_OBJECTS )
294 				rSet.Put( TbxImageItem( SID_DRAWTBX_3D_OBJECTS, 0 ) );
295             if( nId != SID_DRAWTBX_CONNECTORS )
296                 rSet.Put( TbxImageItem( SID_DRAWTBX_CONNECTORS, 0 ) );
297         }
298 	}
299 
300 	SdrPageView* pPageView = mpDrawView->GetSdrPageView();
301 
302 	GetMenuStateSel(rSet);
303 
304 	if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ASSIGN_LAYOUT))
305 	{
306         bool bDisable = true;
307 		if( pPageView )
308 		{
309 			SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
310 
311 			if( pPage && !pPage->IsMasterPage() )
312 			{
313 				rSet.Put( SfxUInt32Item( SID_ASSIGN_LAYOUT, static_cast< sal_uInt32 >(pPage->GetAutoLayout()) ) );
314 				bDisable = false;
315 			}
316 		}
317 
318         if(bDisable)
319         {
320             rSet.DisableItem(SID_ASSIGN_LAYOUT);
321         }
322 	}
323 
324     if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_EXPAND_PAGE))
325     {
326         bool bDisable = true;
327 		if( pPageView )
328 		{
329 			SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
330 
331 			if( pPage && (pPage->GetPageKind() == PK_STANDARD) && !pPage->IsMasterPage() )
332 			{
333 				SdrObject* pObj = pPage->GetPresObj(PRESOBJ_OUTLINE);
334 
335                 if (pObj!=NULL )
336 				{
337 					if( !pObj->IsEmptyPresObj() )
338 					{
339 						bDisable = false;
340 					}
341 					else
342 					{
343 						// check if the object is in edit, than its temporarely not empty
344 						SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
345 						if( pTextObj )
346 						{
347 							OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
348 							if( pParaObj )
349 							{
350 								delete pParaObj;
351 								bDisable = false;
352 							}
353 						}
354 					}
355 				}
356 			}
357 		}
358 
359         if(bDisable)
360         {
361             rSet.DisableItem(SID_EXPAND_PAGE);
362         }
363     }
364 
365     if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_SUMMARY_PAGE))
366     {
367         bool bDisable = true;
368 		if( pPageView )
369 		{
370 			SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
371 
372 			if( pPage && (pPage->GetPageKind() == PK_STANDARD) && !pPage->IsMasterPage() )
373 			{
374 				SdrObject* pObj = pPage->GetPresObj(PRESOBJ_TITLE);
375 
376 				if(pObj && !pObj->IsEmptyPresObj())
377 				{
378 					bDisable = false;
379 				}
380 			}
381 		}
382 
383         if(bDisable)
384         {
385             rSet.DisableItem(SID_SUMMARY_PAGE);
386         }
387     }
388 
389     if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ASSIGN_LAYOUT))
390     {
391         bool bDisable = true;
392 		if( pPageView )
393 		{
394 			SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
395 
396 			if( pPage && !pPage->IsMasterPage() )
397 			{
398 				rSet.Put( SfxUInt32Item(SID_ASSIGN_LAYOUT, pPage->GetAutoLayout()) );
399 				bDisable = false;
400 			}
401 		}
402 
403         if(bDisable)
404         {
405             rSet.DisableItem(SID_ASSIGN_LAYOUT);
406         }
407     }
408 
409 	// Starten der Praesentation moeglich?
410 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PRESENTATION ) ||
411 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_REHEARSE_TIMINGS ) )
412     {
413         sal_Bool bDisable = sal_True;
414         sal_uInt16 nCount = GetDoc()->GetSdPageCount( PK_STANDARD );
415 
416         for( sal_uInt16 i = 0; i < nCount && bDisable; i++ )
417         {
418             SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
419 
420             if( !pPage->IsExcluded() )
421 				bDisable = sal_False;
422         }
423 
424         if( bDisable || GetDocSh()->IsPreview())
425 		{
426             rSet.DisableItem( SID_PRESENTATION );
427             rSet.DisableItem( SID_REHEARSE_TIMINGS );
428 		}
429     }
430 
431     // Klebepunkte
432 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_EDITMODE ) ||
433 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_INSERT_POINT ) ||
434 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_PERCENT ) ||
435 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR ) ||
436 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_LEFT ) ||
437 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_RIGHT ) ||
438 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_TOP ) ||
439 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_BOTTOM ) ||
440 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_HORZALIGN_CENTER ) ||
441 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_HORZALIGN_LEFT ) ||
442 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_HORZALIGN_RIGHT ) ||
443 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_VERTALIGN_CENTER ) ||
444 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_VERTALIGN_TOP ) ||
445 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_VERTALIGN_BOTTOM ) )
446 	{
447 		// Prozent
448 		TRISTATE eState = mpDrawView->IsMarkedGluePointsPercent();
449 		if( eState == STATE_DONTKNOW )
450 			rSet.InvalidateItem( SID_GLUE_PERCENT );
451 		else
452 			rSet.Put( SfxBoolItem( SID_GLUE_PERCENT, eState == STATE_CHECK ) );
453 
454 		// Bei Prozent hat Alignment keinen Effekt
455 		if( eState == STATE_CHECK )
456 		{
457 			rSet.DisableItem( SID_GLUE_HORZALIGN_CENTER );
458 			rSet.DisableItem( SID_GLUE_HORZALIGN_LEFT );
459 			rSet.DisableItem( SID_GLUE_HORZALIGN_RIGHT );
460 			rSet.DisableItem( SID_GLUE_VERTALIGN_CENTER );
461 			rSet.DisableItem( SID_GLUE_VERTALIGN_TOP );
462 			rSet.DisableItem( SID_GLUE_VERTALIGN_BOTTOM );
463 		}
464 		else
465 		{
466 			// Horizontale Ausrichtung
467 			sal_uInt16 nHorz = mpDrawView->GetMarkedGluePointsAlign( sal_False );
468 			rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_CENTER, nHorz == SDRHORZALIGN_CENTER ) );
469 			rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_LEFT,   nHorz == SDRHORZALIGN_LEFT ) );
470 			rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_RIGHT,  nHorz == SDRHORZALIGN_RIGHT ) );
471 			// Vertikale Ausrichtung
472 			sal_uInt16 nVert = mpDrawView->GetMarkedGluePointsAlign( sal_True );
473 			rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_CENTER, nVert == SDRVERTALIGN_CENTER ) );
474 			rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_TOP,	  nVert == SDRVERTALIGN_TOP ) );
475 			rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_BOTTOM, nVert == SDRVERTALIGN_BOTTOM ) );
476 		}
477 
478 		// Punkt einfuegen
479 		rSet.Put( SfxBoolItem( SID_GLUE_INSERT_POINT, mpDrawView->IsInsGluePointMode() ) );
480 
481 		// Autrittsrichtung
482 		// Links
483 		eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_LEFT );
484 		if( eState == STATE_DONTKNOW )
485 			rSet.InvalidateItem( SID_GLUE_ESCDIR_LEFT );
486 		else
487 			rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_LEFT, eState == STATE_CHECK ) );
488 		// Rechts
489 		eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_RIGHT );
490 		if( eState == STATE_DONTKNOW )
491 			rSet.InvalidateItem( SID_GLUE_ESCDIR_RIGHT );
492 		else
493 			rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_RIGHT, eState == STATE_CHECK ) );
494 		// Oben
495 		eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_TOP );
496 		if( eState == STATE_DONTKNOW )
497 			rSet.InvalidateItem( SID_GLUE_ESCDIR_TOP );
498 		else
499 			rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_TOP, eState == STATE_CHECK ) );
500 		// Unten
501 		eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_BOTTOM );
502 		if( eState == STATE_DONTKNOW )
503 			rSet.InvalidateItem( SID_GLUE_ESCDIR_BOTTOM );
504 		else
505 			rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_BOTTOM, eState == STATE_CHECK ) );
506 	}
507 
508 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GRID_FRONT ) ||
509 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_HELPLINES_FRONT ) )
510 	{
511 		rSet.Put( SfxBoolItem( SID_GRID_FRONT, mpDrawView->IsGridFront() ) );
512 		rSet.Put( SfxBoolItem( SID_HELPLINES_FRONT, mpDrawView->IsHlplFront() ) );
513 	}
514 
515 	if (!mpDrawView->IsFrameDragSingles())
516         rSet.Put(SfxBoolItem(SID_BEZIER_EDIT, sal_True));
517     else
518         rSet.Put(SfxBoolItem(SID_BEZIER_EDIT, sal_False));
519 
520     if(dynamic_cast<FuEditGluePoints*>( GetCurrentFunction().get()))
521         rSet.Put(SfxBoolItem(SID_GLUE_EDITMODE, sal_True));
522     else
523         rSet.Put(SfxBoolItem(SID_GLUE_EDITMODE, sal_False));
524 
525     if( !mpDrawView->IsMirrorAllowed( sal_True, sal_True ) )
526 	{
527 		rSet.DisableItem( SID_HORIZONTAL );
528 		rSet.DisableItem( SID_VERTICAL );
529 		rSet.DisableItem( SID_FLIP_HORIZONTAL );
530 		rSet.DisableItem( SID_FLIP_VERTICAL );
531     }
532 
533     if( !mpDrawView->IsMirrorAllowed() )
534 	{
535         rSet.DisableItem( SID_OBJECT_MIRROR );
536 //        rSet.DisableItem( SID_CONVERT_TO_3D_LATHE );
537 //        rSet.DisableItem( SID_CONVERT_TO_3D_LATHE_FAST );
538     }
539 
540 	// interactive transparence control
541     if(!mpDrawView->IsTransparenceAllowed())
542 	{
543         rSet.DisableItem( SID_OBJECT_TRANSPARENCE );
544     }
545 
546 	// interactive gradient control
547     if(!mpDrawView->IsGradientAllowed())
548 	{
549         rSet.DisableItem( SID_OBJECT_GRADIENT );
550     }
551 
552 	// Morphen ggf. disablen
553 	if ( !mpDrawView->IsMorphingAllowed() )
554 		rSet.DisableItem( SID_POLYGON_MORPHING );
555 
556 	// Vectorize ggf. disablen
557 	if ( !mpDrawView->IsVectorizeAllowed() )
558 		rSet.DisableItem( SID_VECTORIZE );
559 
560 	if( !mpDrawView->IsReverseOrderPossible() )
561 	{
562 		rSet.DisableItem( SID_REVERSE_ORDER );
563 	}
564 
565 	if ( !bConvertToPathPossible &&
566 		 !mpDrawView->IsCrookAllowed( mpDrawView->IsCrookNoContortion() ) )
567 	{
568 		// Implizite Wandlung in Kurve nicht moeglich
569 		rSet.DisableItem(SID_OBJECT_CROOK_ROTATE);
570 		rSet.DisableItem(SID_OBJECT_CROOK_SLANT);
571 		rSet.DisableItem(SID_OBJECT_CROOK_STRETCH);
572 	}
573 
574 	if ( !mpDrawView->IsGroupEntered() )
575 	{
576 		rSet.DisableItem( SID_LEAVE_GROUP );
577 		rSet.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS, sal_False ) );
578 		rSet.ClearItem( SID_LEAVE_ALL_GROUPS );
579 		rSet.DisableItem( SID_LEAVE_ALL_GROUPS );
580 	}
581 	else
582 		rSet.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS, sal_True ) );
583 
584     if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_THESAURUS ) )
585 	{
586 		if ( !mpDrawView->IsTextEdit() )
587 		{
588 			rSet.DisableItem( SID_THESAURUS );
589 		}
590 		else
591 		{
592 			LanguageType            eLang = GetDoc()->GetLanguage( EE_CHAR_LANGUAGE );
593 	        Reference< XThesaurus > xThesaurus( LinguMgr::GetThesaurus() );
594 			Locale                  aLocale;
595 
596             SvxLanguageToLocale( aLocale, eLang );
597 
598             if (!xThesaurus.is() || eLang == LANGUAGE_NONE || !xThesaurus->hasLocale(aLocale) )
599 				rSet.DisableItem( SID_THESAURUS );
600 		}
601 	}
602 
603 	if ( !mpDrawView->IsTextEdit() )
604 	{
605 		rSet.DisableItem( SID_THESAURUS );
606 	}
607 
608 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SELECTALL ) ||
609 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SIZE_ALL ) )
610 	{
611 		if( pPageView && pPageView->GetObjList()->GetObjCount() == 0 )
612 		{
613 			// Sollte disabled sein, wenn kein Objekt auf der Zeichenflaeche ist:
614 			rSet.DisableItem( SID_SELECTALL );
615 			rSet.DisableItem( SID_SIZE_ALL );
616 		}
617 	}
618 
619 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONTEXT ) )
620 		rSet.Put( SfxStringItem( SID_CONTEXT, mpDrawView->GetStatusText() ) );
621 
622 	// clipboard (paste)
623     if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE ) ||
624         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE_SPECIAL ) ||
625 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) )
626 	{
627 		if ( !mpClipEvtLstnr )
628 		{
629             // SSA: #108717# avoid clipboard initialization for
630             // read-only presentation views (workaround for NT4.0
631             // clipboard prob...)
632 			if( !ISA(PresentationViewShell) )
633 			{
634 				// create listener
635 				mpClipEvtLstnr = new TransferableClipboardListener( LINK( this, DrawViewShell, ClipboardChanged ) );
636 				mpClipEvtLstnr->acquire();
637 				mpClipEvtLstnr->AddRemoveListener( GetActiveWindow(), sal_True );
638 
639 			    // get initial state
640 			    TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
641 			    mbPastePossible = ( aDataHelper.GetFormatCount() != 0 );
642 			}
643             else
644 			    mbPastePossible = sal_False;
645 		}
646 
647 		if( !mbPastePossible )
648 		{
649 			rSet.DisableItem( SID_PASTE );
650             rSet.DisableItem( SID_PASTE_SPECIAL );
651             rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
652 		}
653 		else if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) )
654 		{
655             if (mpCurrentClipboardFormats.get() != NULL)
656                 rSet.Put(*mpCurrentClipboardFormats);
657 		}
658 	}
659 
660 	if ( !bConvertToPathPossible )
661 	{
662 		rSet.DisableItem(SID_CHANGEBEZIER);
663 	}
664 
665     if (mpDrawView == NULL)
666     {
667         // When we come to this line then we probably have another
668         // incarnation of issue #126202#.  The mpDrawView was not NULL but is
669         // now.  The reason for this may be that the DrawViewShell has been
670         // destroyed in the mean time.
671         // We can only return immediately and hope that the deleted
672         // DrawViewShell is not called again.
673         DBG_ASSERT(mpDrawView!=NULL, "Please report this assertion to the Impress team.");
674         return;
675     }
676 
677 	if( !( mpDrawView->IsConvertToPolyObjPossible(sal_False) || mpDrawView->IsVectorizeAllowed() ) )
678         rSet.DisableItem(SID_CHANGEPOLYGON);
679 
680 	if( !( mpDrawView->IsConvertToPolyObjPossible(sal_False) || mpDrawView->IsConvertToContourPossible() ) )
681         rSet.DisableItem(SID_CONVERT_TO_CONTOUR);
682 
683 	if ( !mpDrawView->IsConvertTo3DObjPossible() )
684 	{
685 		rSet.DisableItem(SID_CONVERT_TO_3D);
686 		rSet.DisableItem(SID_CONVERT_TO_3D_LATHE);
687 		rSet.DisableItem(SID_CONVERT_TO_3D_LATHE_FAST);
688 	}
689 
690     if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MANAGE_LINKS ) )
691 	{
692 		if ( GetDoc()->GetLinkCount() == 0 )
693 		{
694 			rSet.DisableItem(SID_MANAGE_LINKS);
695 		}
696 	}
697 
698 	if (mePageKind == PK_HANDOUT)
699 	{
700 		rSet.DisableItem(SID_PRESENTATION_LAYOUT);
701 		rSet.DisableItem(SID_SELECT_BACKGROUND);
702 	}
703 
704 	if (mePageKind == PK_NOTES)
705 	{
706 		rSet.DisableItem(SID_INSERTPAGE);
707 		rSet.DisableItem(SID_RENAMEPAGE);
708 		rSet.DisableItem(SID_RENAMEPAGE_QUICK);
709         rSet.DisableItem(SID_DUPLICATE_PAGE);
710 		rSet.ClearItem(SID_ANIMATION_OBJECTS);
711 		rSet.DisableItem(SID_ANIMATION_OBJECTS);
712 		rSet.DisableItem(SID_ANIMATION_EFFECTS);
713 
714 		if (meEditMode == EM_MASTERPAGE)
715 			rSet.DisableItem(SID_MODIFYPAGE);
716 
717 		rSet.DisableItem(SID_SELECT_BACKGROUND);
718 		rSet.DisableItem(SID_INSERTLAYER);
719 		rSet.DisableItem(SID_LAYERMODE);
720 		rSet.DisableItem(SID_INSERTFILE);
721 	}
722 	else if (mePageKind == PK_HANDOUT)
723 	{
724 		rSet.DisableItem(SID_INSERTPAGE);
725         rSet.DisableItem(SID_DUPLICATE_PAGE);
726 		rSet.ClearItem(SID_ANIMATION_OBJECTS);
727 		rSet.DisableItem(SID_ANIMATION_OBJECTS);
728 		rSet.DisableItem(SID_ANIMATION_EFFECTS);
729 		rSet.DisableItem(SID_RENAMEPAGE);
730 		rSet.DisableItem(SID_RENAMEPAGE_QUICK);
731 		rSet.DisableItem(SID_INSERTLAYER);
732 		rSet.DisableItem(SID_MODIFYLAYER);
733 		rSet.DisableItem(SID_RENAMELAYER);
734 		rSet.DisableItem(SID_LAYERMODE);
735 		rSet.DisableItem(SID_INSERTFILE);
736 		rSet.DisableItem(SID_PAGEMODE);
737 		rSet.DisableItem(SID_SELECT_BACKGROUND);
738 	}
739 	else
740 	{
741 		if (meEditMode == EM_MASTERPAGE)
742 		{
743 			rSet.DisableItem(SID_INSERTPAGE);
744             rSet.DisableItem(SID_DUPLICATE_PAGE);
745 			rSet.DisableItem(SID_MODIFYPAGE);
746 			rSet.ClearItem(SID_ANIMATION_OBJECTS);
747 			rSet.DisableItem(SID_ANIMATION_OBJECTS);
748 		}
749 
750 		rSet.Put (SfxBoolItem (SID_LAYERMODE, IsLayerModeActive()));
751 	}
752 
753 	if ( ! IsLayerModeActive())
754 	{
755 		rSet.DisableItem( SID_INSERTLAYER );
756 		rSet.DisableItem( SID_MODIFYLAYER );
757 		rSet.DisableItem( SID_DELETE_LAYER );
758 		rSet.DisableItem( SID_RENAMELAYER );
759 	}
760 
761 	if (meEditMode == EM_PAGE)
762 	{
763         /**********************************************************************
764         * Seiten-Modus
765         **********************************************************************/
766 		rSet.Put(SfxBoolItem(SID_PAGEMODE, sal_True));
767 		rSet.Put(SfxBoolItem(SID_MASTERPAGE, sal_False));
768         rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, sal_False));
769         rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, sal_False));
770         rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, sal_False));
771 
772         if (mePageKind == PK_STANDARD &&
773             rSet.GetItemState(SID_TITLE_MASTERPAGE) == SFX_ITEM_AVAILABLE)
774         {
775             // Gibt es eine Seite mit dem AutoLayout "Titel"?
776             sal_Bool bDisable = sal_True;
777             sal_uInt16 i = 0;
778             sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
779 
780             while (i < nCount && bDisable)
781             {
782                 SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
783 
784                 if (pPage->GetAutoLayout() == AUTOLAYOUT_TITLE)
785                 {
786                     bDisable = sal_False;
787                 }
788 
789                 i++;
790             }
791 
792             if (bDisable)
793             {
794                 rSet.DisableItem(SID_TITLE_MASTERPAGE);
795             }
796             else
797             {
798                 rSet.Put(SfxBoolItem(SID_TITLE_MASTERPAGE, sal_False));
799             }
800         }
801         else
802         {
803             rSet.DisableItem(SID_TITLE_MASTERPAGE);
804         }
805 
806         rSet.DisableItem (SID_INSERT_MASTER_PAGE);
807         rSet.DisableItem (SID_DELETE_MASTER_PAGE);
808         rSet.DisableItem (SID_RENAME_MASTER_PAGE);
809         rSet.DisableItem (SID_CLOSE_MASTER_VIEW);
810 	}
811 	else
812 	{
813 		rSet.Put(SfxBoolItem(SID_PAGEMODE, sal_False));
814 		rSet.Put(SfxBoolItem(SID_MASTERPAGE, sal_True));
815 
816         /**********************************************************************
817         * Hintergrundseiten-Modus
818         **********************************************************************/
819         if (mePageKind == PK_STANDARD)
820         {
821             rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, sal_True));
822             rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, sal_False));
823             rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, sal_False));
824 
825             if (rSet.GetItemState(SID_TITLE_MASTERPAGE) == SFX_ITEM_AVAILABLE)
826             {
827 				sal_Bool bCheck = sal_False;
828 				sal_Bool bDisable = sal_True;
829 				if( pPageView )
830 				{
831 					SdPage* pMPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
832 
833 					sal_uInt16 i = 0;
834 					sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
835 
836 					// Referenziert eine Seite mit dem AutoLayout "Titel" die
837 					// aktuelle MasterPage?
838 					while (i < nCount && !bCheck && bDisable)
839 					{
840 						SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
841 
842 						// Seite referenziert aktuelle MasterPage
843 						if (pPage->GetAutoLayout() == AUTOLAYOUT_TITLE)
844 						{
845 							// Eine Seite hat das AutoLayout "Titel"
846 							bDisable = sal_False;
847 
848 							SdPage& rRefMPage = (SdPage&)(pPage->TRG_GetMasterPage());
849 
850 							if(&rRefMPage == pMPage)
851 							{
852 								// Eine Seite mit dem AutoLayout "Titel"
853 								// referenziert die aktuelle MasterPage
854 								bCheck = sal_True;
855 							}
856 						}
857 
858 						i++;
859 					}
860 				}
861 
862 				if (bCheck)
863 				{
864 					rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, sal_False));
865 				}
866 
867 				rSet.Put(SfxBoolItem(SID_TITLE_MASTERPAGE, bCheck));
868 
869 				if (bDisable)
870 				{
871 					rSet.ClearItem(SID_TITLE_MASTERPAGE);
872 					rSet.DisableItem(SID_TITLE_MASTERPAGE);
873 				}
874             }
875         }
876         else if (mePageKind == PK_NOTES)
877         {
878             rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, sal_False));
879             rSet.DisableItem(SID_TITLE_MASTERPAGE);
880             rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, sal_True));
881             rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, sal_False));
882         }
883         else if (mePageKind == PK_HANDOUT)
884         {
885             rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, sal_False));
886             rSet.DisableItem(SID_TITLE_MASTERPAGE);
887             rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, sal_False));
888             rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, sal_True));
889         }
890     }
891 
892     // Status der Lineale setzen
893     if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_RULER ) )
894 		rSet.Put( SfxBoolItem( SID_RULER, HasRuler() ) );
895 
896 	// nicht die letzte Seite oder eine Masterpage loeschen
897 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_PAGE )
898         || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_MASTER_PAGE ) )
899 	{
900 		if (maTabControl.GetPageCount() == 1 ||
901 			meEditMode == EM_MASTERPAGE		||
902 			mePageKind == PK_NOTES			||
903 			mePageKind == PK_HANDOUT 		||
904 			(GetShellType()!=ST_DRAW&&IsLayerModeActive()))
905 		{
906             if (rSet.GetItemState(SID_DELETE_PAGE) == SFX_ITEM_AVAILABLE)
907                 rSet.DisableItem(SID_DELETE_PAGE);
908             if (rSet.GetItemState(SID_DELETE_MASTER_PAGE)==SFX_ITEM_AVAILABLE)
909                 rSet.DisableItem(SID_DELETE_MASTER_PAGE);
910 		}
911 	}
912 
913 	// darf der aktuelle Layer geloescht werden?
914 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_LAYER ) )
915 	{
916 		sal_uInt16		  nCurrentLayer = GetLayerTabControl()->GetCurPageId();
917 		const String& rName 		= GetLayerTabControl()->GetPageText(nCurrentLayer);
918 
919 		sal_Bool bDisableIt = !IsLayerModeActive();
920         bDisableIt |= (rName == String(SdResId(STR_LAYER_LAYOUT)));
921         bDisableIt |= (rName == String(SdResId(STR_LAYER_BCKGRND)));
922         bDisableIt |= (rName == String(SdResId(STR_LAYER_BCKGRNDOBJ)));
923         bDisableIt |= (rName == String(SdResId(STR_LAYER_CONTROLS)));
924         bDisableIt |= (rName == String(SdResId(STR_LAYER_MEASURELINES)));
925 
926 		if (bDisableIt)
927 		{
928 			rSet.DisableItem(SID_DELETE_LAYER);
929             rSet.DisableItem(SID_RENAMELAYER);
930 		}
931 	}
932 
933 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CUT ) ||
934 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_COPY ) ||
935 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTLINE_BULLET ))
936 	{
937 		OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
938 
939 		// Sonderbehandlung f�r SID_OUTLINE_BULLET wenn Objekte
940 		// mit unterschiedlichen arten von NumBullet Items markiert
941 		// sind
942 		sal_Bool bHasOutliner = sal_False;
943 		sal_Bool bHasOther    = sal_False;
944 		for(sal_uLong nNum = 0; nNum < nMarkCount; nNum++)
945 		{
946 		    SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
947 			if( pObj->GetObjInventor() == SdrInventor )
948 			{
949 				if( pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
950 				{
951 					bHasOutliner = sal_True;
952 					if(bHasOther)
953 						break;
954 				}
955 				else
956 				{
957 					bHasOther = sal_True;
958 					if(bHasOutliner)
959 						break;
960 				}
961 			}
962 		}
963 
964 		if( bHasOther && bHasOutliner )
965 			rSet.DisableItem( SID_OUTLINE_BULLET );
966 
967 		if (pOlView)
968 		{
969 			if ( pOlView->GetSelected().Len() == 0 )
970 			{
971 				rSet.DisableItem( SID_CUT );
972 				rSet.DisableItem( SID_COPY );
973 			}
974 		}
975 
976 	}
977 
978 	FuBullet::GetSlotState( rSet, this, GetViewFrame() );
979 
980 	if ( GetDocSh()->IsUIActive() )
981 	{
982 		rSet.DisableItem( SID_INSERT_OBJECT );
983         rSet.DisableItem( SID_INSERT_PLUGIN );
984         rSet.DisableItem( SID_INSERT_SOUND );
985         rSet.DisableItem( SID_INSERT_VIDEO );
986         rSet.DisableItem( SID_INSERT_FLOATINGFRAME );
987 		rSet.DisableItem( SID_INSERT_MATH );
988 		rSet.DisableItem( SID_INSERT_DIAGRAM );
989 		rSet.DisableItem( SID_ATTR_TABLE );
990 		rSet.DisableItem( SID_SIZE_REAL );
991 		rSet.DisableItem( SID_SIZE_OPTIMAL );
992 		rSet.DisableItem( SID_SIZE_ALL );
993 		rSet.DisableItem( SID_SIZE_PAGE_WIDTH );
994 		rSet.DisableItem( SID_SIZE_PAGE );
995         rSet.DisableItem( SID_DUPLICATE_PAGE );
996         rSet.DisableItem( SID_ZOOM_TOOLBOX );
997 	}
998 
999 	// Zoom-Stati
1000 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_IN ) ||
1001 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_OUT )||
1002 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_PANNING ) )
1003 	{
1004 		if( GetActiveWindow()->GetZoom() <= GetActiveWindow()->GetMinZoom() || GetDocSh()->IsUIActive() )
1005 		{
1006 			rSet.DisableItem( SID_ZOOM_IN );
1007 			rSet.DisableItem( SID_ZOOM_PANNING );
1008 		}
1009 		if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() )
1010 			rSet.DisableItem( SID_ZOOM_OUT );
1011 	}
1012 
1013 	if (!mpZoomList->IsNextPossible())
1014 	{
1015 	   rSet.DisableItem(SID_ZOOM_NEXT);
1016 	}
1017 	if (!mpZoomList->IsPreviousPossible())
1018 	{
1019 	   rSet.DisableItem(SID_ZOOM_PREV);
1020 	}
1021 
1022 	// EditText aktiv
1023     if (GetViewShellBase().GetViewShellManager()->GetShell(RID_DRAW_TEXT_TOOLBOX) != NULL)
1024     {
1025         sal_uInt16 nCurrentSId = SID_ATTR_CHAR;
1026 
1027         if(HasCurrentFunction())
1028         {
1029             nCurrentSId = GetCurrentFunction()->GetSlotID();
1030         }
1031         if( nCurrentSId != SID_TEXT_FITTOSIZE &&
1032             nCurrentSId != SID_TEXT_FITTOSIZE_VERTICAL &&
1033             nCurrentSId != SID_ATTR_CHAR_VERTICAL )
1034             nCurrentSId = SID_ATTR_CHAR;
1035 
1036         rSet.Put( SfxBoolItem( nCurrentSId, sal_True ) );
1037 
1038         // Kurzform von UpdateToolboxImages()
1039         rSet.Put( TbxImageItem( SID_DRAWTBX_TEXT, nCurrentSId ) );
1040     }
1041 
1042 	if ( GetDocSh()->IsReadOnly() )
1043 	{
1044 		rSet.DisableItem( SID_AUTOSPELL_CHECK );
1045 	}
1046 	else
1047 	{
1048 	    if (GetDoc()->GetOnlineSpell())
1049     	{
1050         	rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, sal_True));
1051 	    }
1052     	else
1053 	    {
1054     	    rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, sal_False));
1055     	}
1056 	}
1057 
1058 	SdrPageView* pPV = mpDrawView->GetSdrPageView();
1059 	String aActiveLayer = mpDrawView->GetActiveLayer();
1060 
1061 	if ( ( aActiveLayer.Len() != 0 && pPV && ( pPV->IsLayerLocked(aActiveLayer) ||
1062 		  !pPV->IsLayerVisible(aActiveLayer) ) ) ||
1063           SD_MOD()->GetWaterCan() )
1064 	{
1065 		rSet.DisableItem( SID_PASTE );
1066         rSet.DisableItem( SID_PASTE_SPECIAL );
1067         rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
1068 
1069         rSet.DisableItem( SID_INSERT_FLD_DATE_FIX );
1070         rSet.DisableItem( SID_INSERT_FLD_DATE_VAR );
1071         rSet.DisableItem( SID_INSERT_FLD_TIME_FIX );
1072         rSet.DisableItem( SID_INSERT_FLD_TIME_VAR );
1073         rSet.DisableItem( SID_INSERT_FLD_AUTHOR );
1074         rSet.DisableItem( SID_INSERT_FLD_PAGE );
1075         rSet.DisableItem( SID_INSERT_FLD_PAGES );
1076         rSet.DisableItem( SID_INSERT_FLD_FILE );
1077 
1078 		rSet.DisableItem( SID_INSERT_GRAPHIC );
1079 		rSet.DisableItem( SID_INSERT_AVMEDIA );
1080 		rSet.DisableItem( SID_INSERT_DIAGRAM );
1081 		rSet.DisableItem( SID_INSERT_OBJECT );
1082         rSet.DisableItem( SID_INSERT_PLUGIN );
1083         rSet.DisableItem( SID_INSERT_SOUND );
1084         rSet.DisableItem( SID_INSERT_VIDEO );
1085         rSet.DisableItem( SID_INSERT_FLOATINGFRAME );
1086 
1087 		rSet.DisableItem( SID_INSERT_MATH );
1088 		rSet.DisableItem( SID_INSERT_FRAME );
1089 		rSet.DisableItem( SID_INSERTFILE );
1090 		rSet.DisableItem( SID_ATTR_TABLE );
1091 		rSet.DisableItem( SID_COPYOBJECTS );
1092 
1093 		rSet.DisableItem( SID_SCAN );
1094 		rSet.DisableItem( SID_TWAIN_SELECT );
1095 		rSet.DisableItem( SID_TWAIN_TRANSFER );
1096 
1097 //        rSet.DisableItem( SID_BEZIER_EDIT );
1098 		rSet.DisableItem( SID_GLUE_EDITMODE );
1099 		rSet.DisableItem( SID_OBJECT_ROTATE );
1100 		rSet.DisableItem( SID_OBJECT_SHEAR );
1101 		rSet.DisableItem( SID_OBJECT_MIRROR );
1102 		rSet.DisableItem( SID_OBJECT_CROP );
1103 		rSet.DisableItem( SID_ATTR_GRAF_CROP );
1104 		rSet.DisableItem( SID_OBJECT_TRANSPARENCE );
1105 		rSet.DisableItem( SID_OBJECT_GRADIENT );
1106 		rSet.DisableItem( SID_OBJECT_CROOK_ROTATE );
1107 		rSet.DisableItem( SID_OBJECT_CROOK_SLANT );
1108 		rSet.DisableItem( SID_OBJECT_CROOK_STRETCH );
1109 
1110 		// Alle objekterzeugenden Werkzeuge disablen
1111 		rSet.ClearItem( SID_ATTR_CHAR );
1112 		rSet.DisableItem( SID_ATTR_CHAR );
1113 		rSet.ClearItem( SID_ATTR_CHAR_VERTICAL );
1114 		rSet.DisableItem( SID_ATTR_CHAR_VERTICAL );
1115 		rSet.ClearItem(SID_DRAW_LINE);
1116 		rSet.DisableItem(SID_DRAW_LINE);
1117         rSet.ClearItem(SID_DRAW_MEASURELINE);
1118         rSet.DisableItem(SID_DRAW_MEASURELINE);
1119         rSet.ClearItem(SID_DRAW_XLINE);
1120 		rSet.DisableItem(SID_DRAW_XLINE);
1121 		rSet.ClearItem( SID_LINE_ARROW_START );
1122 		rSet.DisableItem( SID_LINE_ARROW_START );
1123 		rSet.ClearItem( SID_LINE_ARROW_END );
1124 		rSet.DisableItem( SID_LINE_ARROW_END );
1125 		rSet.ClearItem( SID_LINE_ARROWS );
1126 		rSet.DisableItem( SID_LINE_ARROWS );
1127 		rSet.ClearItem( SID_LINE_ARROW_CIRCLE );
1128 		rSet.DisableItem( SID_LINE_ARROW_CIRCLE );
1129 		rSet.ClearItem( SID_LINE_CIRCLE_ARROW );
1130 		rSet.DisableItem( SID_LINE_CIRCLE_ARROW );
1131 		rSet.ClearItem( SID_LINE_ARROW_SQUARE );
1132 		rSet.DisableItem( SID_LINE_ARROW_SQUARE );
1133 		rSet.ClearItem( SID_LINE_SQUARE_ARROW );
1134 		rSet.DisableItem( SID_LINE_SQUARE_ARROW );
1135 
1136 		rSet.ClearItem(SID_DRAW_RECT);
1137 		rSet.DisableItem(SID_DRAW_RECT);
1138 		rSet.ClearItem(SID_DRAW_RECT_NOFILL);
1139 		rSet.DisableItem(SID_DRAW_RECT_NOFILL);
1140 		rSet.ClearItem(SID_DRAW_RECT_ROUND);
1141 		rSet.DisableItem(SID_DRAW_RECT_ROUND);
1142 		rSet.ClearItem(SID_DRAW_RECT_ROUND_NOFILL);
1143 		rSet.DisableItem(SID_DRAW_RECT_ROUND_NOFILL);
1144 		rSet.ClearItem(SID_DRAW_SQUARE);
1145 		rSet.DisableItem(SID_DRAW_SQUARE);
1146 		rSet.ClearItem(SID_DRAW_SQUARE_NOFILL);
1147 		rSet.DisableItem(SID_DRAW_SQUARE_NOFILL);
1148 		rSet.ClearItem(SID_DRAW_SQUARE_ROUND);
1149 		rSet.DisableItem(SID_DRAW_SQUARE_ROUND);
1150 		rSet.ClearItem(SID_DRAW_SQUARE_ROUND_NOFILL);
1151 		rSet.DisableItem(SID_DRAW_SQUARE_ROUND_NOFILL);
1152 		rSet.ClearItem(SID_DRAW_ELLIPSE);
1153 		rSet.DisableItem(SID_DRAW_ELLIPSE);
1154 		rSet.ClearItem(SID_DRAW_ELLIPSE_NOFILL);
1155 		rSet.DisableItem(SID_DRAW_ELLIPSE_NOFILL);
1156 		rSet.ClearItem(SID_DRAW_CIRCLE);
1157 		rSet.DisableItem(SID_DRAW_CIRCLE);
1158 		rSet.ClearItem(SID_DRAW_CIRCLE_NOFILL);
1159 		rSet.DisableItem(SID_DRAW_CIRCLE_NOFILL);
1160 		rSet.ClearItem(SID_DRAW_CAPTION);
1161 		rSet.DisableItem(SID_DRAW_CAPTION);
1162 		rSet.ClearItem(SID_DRAW_FONTWORK);
1163 		rSet.DisableItem(SID_DRAW_FONTWORK);
1164 		rSet.ClearItem(SID_DRAW_FONTWORK_VERTICAL);
1165 		rSet.DisableItem(SID_DRAW_FONTWORK_VERTICAL);
1166 		rSet.ClearItem(SID_DRAW_CAPTION_VERTICAL);
1167 		rSet.DisableItem(SID_DRAW_CAPTION_VERTICAL);
1168 		rSet.ClearItem(SID_TEXT_FITTOSIZE);
1169 		rSet.DisableItem(SID_TEXT_FITTOSIZE);
1170 		rSet.ClearItem(SID_TEXT_FITTOSIZE_VERTICAL);
1171 		rSet.DisableItem(SID_TEXT_FITTOSIZE_VERTICAL);
1172 		rSet.ClearItem(SID_TOOL_CONNECTOR);
1173 		rSet.DisableItem(SID_TOOL_CONNECTOR);
1174         rSet.ClearItem(SID_CONNECTOR_ARROW_START);
1175         rSet.DisableItem(SID_CONNECTOR_ARROW_START);
1176         rSet.ClearItem(SID_CONNECTOR_ARROW_END);
1177         rSet.DisableItem(SID_CONNECTOR_ARROW_END);
1178         rSet.ClearItem(SID_CONNECTOR_ARROWS);
1179         rSet.DisableItem(SID_CONNECTOR_ARROWS);
1180         rSet.ClearItem(SID_CONNECTOR_CIRCLE_START);
1181         rSet.DisableItem(SID_CONNECTOR_CIRCLE_START);
1182         rSet.ClearItem(SID_CONNECTOR_CIRCLE_END);
1183         rSet.DisableItem(SID_CONNECTOR_CIRCLE_END);
1184         rSet.ClearItem(SID_CONNECTOR_CIRCLES);
1185         rSet.DisableItem(SID_CONNECTOR_CIRCLES);
1186         rSet.ClearItem(SID_CONNECTOR_LINE);
1187         rSet.DisableItem(SID_CONNECTOR_LINE);
1188         rSet.ClearItem(SID_CONNECTOR_LINE_ARROW_START);
1189         rSet.DisableItem(SID_CONNECTOR_LINE_ARROW_START);
1190         rSet.ClearItem(SID_CONNECTOR_LINE_ARROW_END);
1191         rSet.DisableItem(SID_CONNECTOR_LINE_ARROW_END);
1192         rSet.ClearItem(SID_CONNECTOR_LINE_ARROWS);
1193         rSet.DisableItem(SID_CONNECTOR_LINE_ARROWS);
1194         rSet.ClearItem(SID_CONNECTOR_LINE_CIRCLE_START);
1195         rSet.DisableItem(SID_CONNECTOR_LINE_CIRCLE_START);
1196         rSet.ClearItem(SID_CONNECTOR_LINE_CIRCLE_END);
1197         rSet.DisableItem(SID_CONNECTOR_LINE_CIRCLE_END);
1198         rSet.ClearItem(SID_CONNECTOR_LINE_CIRCLES);
1199         rSet.DisableItem(SID_CONNECTOR_LINE_CIRCLES);
1200         rSet.ClearItem(SID_CONNECTOR_CURVE);
1201         rSet.DisableItem(SID_CONNECTOR_CURVE);
1202         rSet.ClearItem(SID_CONNECTOR_CURVE_ARROW_START);
1203         rSet.DisableItem(SID_CONNECTOR_CURVE_ARROW_START);
1204         rSet.ClearItem(SID_CONNECTOR_CURVE_ARROW_END);
1205         rSet.DisableItem(SID_CONNECTOR_CURVE_ARROW_END);
1206         rSet.ClearItem(SID_CONNECTOR_CURVE_ARROWS);
1207         rSet.DisableItem(SID_CONNECTOR_CURVE_ARROWS);
1208         rSet.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_START);
1209         rSet.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_START);
1210         rSet.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_END);
1211         rSet.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_END);
1212         rSet.ClearItem(SID_CONNECTOR_CURVE_CIRCLES);
1213         rSet.DisableItem(SID_CONNECTOR_CURVE_CIRCLES);
1214         rSet.ClearItem(SID_CONNECTOR_LINES);
1215         rSet.DisableItem(SID_CONNECTOR_LINES);
1216         rSet.ClearItem(SID_CONNECTOR_LINES_ARROW_START);
1217         rSet.DisableItem(SID_CONNECTOR_LINES_ARROW_START);
1218         rSet.ClearItem(SID_CONNECTOR_LINES_ARROW_END);
1219         rSet.DisableItem(SID_CONNECTOR_LINES_ARROW_END);
1220         rSet.ClearItem(SID_CONNECTOR_LINES_ARROWS);
1221         rSet.DisableItem(SID_CONNECTOR_LINES_ARROWS);
1222         rSet.ClearItem(SID_CONNECTOR_LINES_CIRCLE_START);
1223         rSet.DisableItem(SID_CONNECTOR_LINES_CIRCLE_START);
1224         rSet.ClearItem(SID_CONNECTOR_LINES_CIRCLE_END);
1225         rSet.DisableItem(SID_CONNECTOR_LINES_CIRCLE_END);
1226         rSet.ClearItem(SID_CONNECTOR_LINES_CIRCLES);
1227         rSet.DisableItem(SID_CONNECTOR_LINES_CIRCLES);
1228         rSet.ClearItem(SID_DRAW_ARC);
1229 		rSet.DisableItem(SID_DRAW_ARC);
1230 		rSet.ClearItem(SID_DRAW_CIRCLEARC);
1231 		rSet.DisableItem(SID_DRAW_CIRCLEARC);
1232 		rSet.ClearItem(SID_DRAW_PIE);
1233 		rSet.DisableItem(SID_DRAW_PIE);
1234 		rSet.ClearItem(SID_DRAW_PIE_NOFILL);
1235 		rSet.DisableItem(SID_DRAW_PIE_NOFILL);
1236 		rSet.ClearItem(SID_DRAW_CIRCLEPIE);
1237 		rSet.DisableItem(SID_DRAW_CIRCLEPIE);
1238 		rSet.ClearItem(SID_DRAW_CIRCLEPIE_NOFILL);
1239 		rSet.DisableItem(SID_DRAW_CIRCLEPIE_NOFILL);
1240 		rSet.ClearItem(SID_DRAW_ELLIPSECUT);
1241 		rSet.DisableItem(SID_DRAW_ELLIPSECUT);
1242 		rSet.ClearItem(SID_DRAW_ELLIPSECUT_NOFILL);
1243 		rSet.DisableItem(SID_DRAW_ELLIPSECUT_NOFILL);
1244 		rSet.ClearItem(SID_DRAW_CIRCLECUT);
1245 		rSet.DisableItem(SID_DRAW_CIRCLECUT);
1246 		rSet.ClearItem(SID_DRAW_CIRCLECUT_NOFILL);
1247 		rSet.DisableItem(SID_DRAW_CIRCLECUT_NOFILL);
1248 		rSet.ClearItem(SID_DRAW_POLYGON);
1249 		rSet.DisableItem(SID_DRAW_POLYGON);
1250 		rSet.ClearItem(SID_DRAW_POLYGON_NOFILL);
1251 		rSet.DisableItem(SID_DRAW_POLYGON_NOFILL);
1252         rSet.ClearItem(SID_DRAW_FREELINE);
1253         rSet.DisableItem(SID_DRAW_FREELINE);
1254         rSet.ClearItem(SID_DRAW_FREELINE_NOFILL);
1255         rSet.DisableItem(SID_DRAW_FREELINE_NOFILL);
1256         rSet.ClearItem(SID_DRAW_XPOLYGON);
1257         rSet.DisableItem(SID_DRAW_XPOLYGON);
1258         rSet.ClearItem(SID_DRAW_XPOLYGON_NOFILL);
1259 		rSet.DisableItem(SID_DRAW_XPOLYGON_NOFILL);
1260         rSet.ClearItem(SID_DRAW_BEZIER_FILL);
1261         rSet.DisableItem(SID_DRAW_BEZIER_FILL);
1262         rSet.ClearItem(SID_DRAW_BEZIER_NOFILL);
1263         rSet.DisableItem(SID_DRAW_BEZIER_NOFILL);
1264 		rSet.ClearItem(SID_3D_CUBE);
1265 		rSet.DisableItem(SID_3D_CUBE);
1266 		rSet.ClearItem(SID_3D_SHELL);
1267 		rSet.DisableItem(SID_3D_SHELL);
1268 		rSet.ClearItem(SID_3D_SPHERE);
1269 		rSet.DisableItem(SID_3D_SPHERE);
1270 		rSet.ClearItem(SID_3D_HALF_SPHERE);
1271 		rSet.DisableItem(SID_3D_HALF_SPHERE);
1272 		rSet.ClearItem(SID_3D_CYLINDER);
1273 		rSet.DisableItem(SID_3D_CYLINDER);
1274 		rSet.ClearItem(SID_3D_CONE);
1275 		rSet.DisableItem(SID_3D_CONE);
1276 		rSet.ClearItem(SID_3D_TORUS);
1277 		rSet.DisableItem(SID_3D_TORUS);
1278 		rSet.ClearItem(SID_3D_PYRAMID);
1279 		rSet.DisableItem(SID_3D_PYRAMID);
1280 	}
1281 
1282 	// Sind die Module verfuegbar?
1283 
1284 	if (!SvtModuleOptions().IsCalc())
1285 	{
1286         // remove menu entry if module is not available
1287         rSet.Put( SfxVisibilityItem( SID_ATTR_TABLE, sal_False ) );
1288 	}
1289 	if (!SvtModuleOptions().IsChart())
1290 	{
1291 		rSet.DisableItem( SID_INSERT_DIAGRAM );
1292 	}
1293 #ifdef STARIMAGE_AVAILABLE
1294 	if (!(pApp->HasFeature(SFX_FEATURE_SIMAGE)))
1295 	{
1296 		rSet.DisableItem( SID_INSERT_IMAGE );
1297 	}
1298 #endif
1299 	if (!SvtModuleOptions().IsMath())
1300 	{
1301 		rSet.DisableItem( SID_INSERT_MATH );
1302 	}
1303 
1304 	rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
1305 	if( (xSlideshow.is() && xSlideshow->isRunning() && (xSlideshow->getAnimationMode() != ANIMATIONMODE_PREVIEW) ) || GetDocSh()->IsPreview() )
1306 	{
1307 		// Eigene Slots
1308 		rSet.DisableItem( SID_PRESENTATION );
1309 		rSet.DisableItem( SID_ZOOM_IN );
1310 		rSet.DisableItem( SID_ZOOM_OUT );
1311 		rSet.DisableItem( SID_ZOOM_PANNING );
1312 		rSet.DisableItem( SID_ZOOM_NEXT );
1313 		rSet.DisableItem( SID_ZOOM_PREV );
1314 		rSet.DisableItem( SID_SIZE_REAL );
1315 		rSet.DisableItem( SID_SIZE_OPTIMAL );
1316 		rSet.DisableItem( SID_SIZE_ALL );
1317 		rSet.DisableItem( SID_SIZE_PAGE_WIDTH );
1318 		rSet.DisableItem( SID_SIZE_PAGE );
1319 		rSet.DisableItem( SID_INSERTPAGE );
1320         rSet.DisableItem( SID_DUPLICATE_PAGE );
1321 		rSet.DisableItem( SID_MODIFYPAGE );
1322 		rSet.DisableItem( SID_RENAMEPAGE );
1323 		rSet.DisableItem( SID_RENAMEPAGE_QUICK );
1324 		rSet.DisableItem( SID_DELETE_PAGE );
1325 		rSet.DisableItem( SID_PAGESETUP );
1326 
1327 		if( xSlideshow.is() && xSlideshow->isRunning() )
1328 		{
1329 			rSet.ClearItem(SID_OBJECT_ALIGN);
1330 			rSet.ClearItem(SID_ZOOM_TOOLBOX);
1331 			rSet.ClearItem(SID_OBJECT_CHOOSE_MODE);
1332 			rSet.ClearItem(SID_DRAWTBX_TEXT);
1333 			rSet.ClearItem(SID_DRAWTBX_RECTANGLES);
1334 			rSet.ClearItem(SID_DRAWTBX_ELLIPSES);
1335 			rSet.ClearItem(SID_DRAWTBX_LINES);
1336 			rSet.ClearItem(SID_DRAWTBX_ARROWS);
1337 			rSet.ClearItem(SID_DRAWTBX_3D_OBJECTS);
1338 		    rSet.ClearItem(SID_DRAWTBX_CONNECTORS);
1339 			rSet.ClearItem(SID_OBJECT_CHOOSE_MODE );
1340 			rSet.ClearItem(SID_DRAWTBX_INSERT);
1341 			rSet.ClearItem(SID_INSERTFILE);
1342 			rSet.ClearItem(SID_OBJECT_ROTATE);
1343 			rSet.ClearItem(SID_OBJECT_ALIGN);
1344 			rSet.ClearItem(SID_POSITION);
1345 			rSet.ClearItem(SID_FM_CONFIG);
1346 			rSet.ClearItem(SID_ANIMATION_EFFECTS);
1347 			rSet.ClearItem(SID_ANIMATION_OBJECTS);
1348 			rSet.ClearItem(SID_3D_WIN);
1349 
1350 			rSet.DisableItem(SID_OBJECT_ALIGN);
1351 			rSet.DisableItem(SID_ZOOM_TOOLBOX);
1352 			rSet.DisableItem(SID_OBJECT_CHOOSE_MODE);
1353 			rSet.DisableItem(SID_DRAWTBX_TEXT);
1354 			rSet.DisableItem(SID_DRAWTBX_RECTANGLES);
1355 			rSet.DisableItem(SID_DRAWTBX_ELLIPSES);
1356 			rSet.DisableItem(SID_DRAWTBX_LINES);
1357 			rSet.DisableItem(SID_DRAWTBX_ARROWS);
1358 			rSet.DisableItem(SID_DRAWTBX_3D_OBJECTS);
1359 		    rSet.DisableItem(SID_DRAWTBX_CONNECTORS);
1360 			rSet.DisableItem(SID_OBJECT_CHOOSE_MODE );
1361 			rSet.DisableItem(SID_DRAWTBX_INSERT);
1362 			rSet.DisableItem(SID_INSERTFILE);
1363 			rSet.DisableItem(SID_OBJECT_ROTATE);
1364 			rSet.DisableItem(SID_OBJECT_ALIGN);
1365 			rSet.DisableItem(SID_POSITION);
1366 			rSet.DisableItem(SID_FM_CONFIG);
1367 			rSet.DisableItem(SID_ANIMATION_EFFECTS);
1368 			rSet.DisableItem(SID_ANIMATION_OBJECTS);
1369 			rSet.DisableItem(SID_3D_WIN);
1370 		}
1371 	}
1372 
1373     // #i102735# discussed with CL: removed for performance reasons
1374     #if 0
1375 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_SOUND ) ||
1376 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_VIDEO ) )
1377 	{
1378 		///////////////////////////////////////////////////////////////////////
1379 		// Menuoption : Insert->Object->Sound and Insert->Object->Video
1380 		//              diable, if there isn't installed any appropriate plugin
1381 		//
1382 		if (!SvxPluginFileDlg::IsAvailable (SID_INSERT_SOUND))
1383 			rSet.DisableItem (SID_INSERT_SOUND);
1384 		if (!SvxPluginFileDlg::IsAvailable (SID_INSERT_VIDEO))
1385 			rSet.DisableItem (SID_INSERT_VIDEO);
1386 	}
1387     #endif
1388 
1389 	///////////////////////////////////////////////////////////////////////
1390 	// Menuoption: Change->Convert->To Bitmap, Change->Convert->To Metafile
1391 	//             disable, if there only Bitmap or Metafiles marked
1392 	// Menuoption: Format->Area, Format->Line
1393 	//             disabled, if the marked objects not able to handle
1394 	//             these attributes
1395 	//
1396 
1397 	bool bSingleGraphicSelected = false;
1398 
1399 	if (!mpDrawView->AreObjectsMarked())
1400 	{
1401 		rSet.DisableItem (SID_CONVERT_TO_METAFILE);
1402 		rSet.DisableItem (SID_CONVERT_TO_BITMAP);
1403 	}
1404 	else
1405 	{
1406 		// get marklist
1407 		SdrMarkList aMarkList = mpDrawView->GetMarkedObjectList();
1408 
1409 		sal_Bool bFoundBitmap         = sal_False;
1410 		sal_Bool bFoundMetafile       = sal_False;
1411 		sal_Bool bFoundObjNoLine      = sal_False;
1412 		sal_Bool bFoundObjNoArea      = sal_False;
1413 		sal_Bool bFoundNoGraphicObj = sal_False;
1414 		sal_Bool bFoundAny            = sal_False;
1415 		bool bFoundTable = false;
1416 
1417 //		const int nMarkCount = (int) aMarkList.GetMarkCount();
1418 		for (sal_uLong i=0; i < nMarkCount && !bFoundAny; i++)
1419 		{
1420 			SdrObject* pObj=  aMarkList.GetMark(i)->GetMarkedSdrObj();
1421 			sal_uInt16 nId = pObj->GetObjIdentifier();
1422 			sal_uInt32 nInv = pObj->GetObjInventor();
1423 
1424 			if(nInv == SdrInventor)
1425 			{
1426 				// 2D objects
1427 				switch( nId )
1428 				{
1429 					case OBJ_PATHLINE :
1430 					case OBJ_PLIN :
1431 					case OBJ_LINE:
1432 					case OBJ_FREELINE :
1433 					case OBJ_EDGE:
1434 					case OBJ_CARC :
1435 						bFoundObjNoArea      = sal_True;
1436 						bFoundNoGraphicObj = sal_True;
1437 						break;
1438 					case OBJ_OLE2 :
1439 						// #i118485# #i118525# Allow Line, Area and Graphic (Metafile, Bitmap)
1440 						bSingleGraphicSelected = nMarkCount == 1;
1441     					bFoundBitmap = true;
1442     					bFoundMetafile = true;
1443 						break;
1444 					case OBJ_GRAF :
1445                     {
1446 						bSingleGraphicSelected = nMarkCount == 1;
1447                         const SdrGrafObj* pSdrGrafObj = static_cast< const SdrGrafObj* >(pObj);
1448 						switch(pSdrGrafObj->GetGraphicType())
1449 						{
1450 							case GRAPHIC_BITMAP :
1451 								bFoundBitmap = sal_True;
1452                                 if(pSdrGrafObj->isEmbeddedSvg())
1453                                 {
1454                                     bFoundMetafile = true;
1455                                 }
1456 								break;
1457 							case GRAPHIC_GDIMETAFILE :
1458 								bFoundMetafile = sal_True;
1459 								break;
1460 							default:
1461 								break;
1462 						}
1463 
1464 						// #i25616# bFoundObjNoLine = sal_True;
1465 						// #i25616# bFoundObjNoArea = sal_True;
1466 						break;
1467                     }
1468 					case OBJ_TABLE:
1469 						bFoundTable = true;
1470 						break;
1471 					default :
1472 						bFoundAny = sal_True;
1473 				}
1474 			}
1475 			else if(nInv == E3dInventor)
1476 			{
1477 				// 3D objects
1478 				bFoundAny = sal_True;
1479 			}
1480 		}
1481 
1482 		if( bFoundTable )
1483 			rSet.DisableItem( SID_ATTRIBUTES_LINE );
1484 
1485 		if (!bFoundAny)
1486 		{
1487 			// Disable menuitem for area-dialog
1488 			if( bFoundObjNoArea ) // #i25616#
1489 				rSet.DisableItem( SID_ATTRIBUTES_AREA );
1490 
1491 			// Disable menuitem for line-dialog
1492 			if( bFoundObjNoLine )
1493 				rSet.DisableItem( SID_ATTRIBUTES_LINE );
1494 
1495 			if( bFoundBitmap && !bFoundMetafile && !bFoundNoGraphicObj )	// only Bitmaps marked
1496 				rSet.DisableItem( SID_CONVERT_TO_BITMAP );
1497 			else if( !bFoundBitmap && bFoundMetafile && !bFoundNoGraphicObj )	// only Metafiles marked
1498 				rSet.DisableItem( SID_CONVERT_TO_METAFILE );
1499 			else if( !bFoundBitmap && !bFoundMetafile && !bFoundNoGraphicObj )	// nothing to do
1500 			{
1501 				rSet.DisableItem( SID_CONVERT_TO_BITMAP );
1502 				rSet.DisableItem( SID_CONVERT_TO_METAFILE );
1503 			}
1504 		}
1505 	}
1506 
1507 	if( !bSingleGraphicSelected )
1508 	{
1509 		rSet.DisableItem (SID_OBJECT_CROP);
1510 		rSet.DisableItem (SID_ATTR_GRAF_CROP);
1511 	}
1512 
1513 	// #96090# moved SID_UNDO to ViewShell::GetMenuState()
1514 	// #96090# moved SID_REDO to ViewShell::GetMenuState()
1515 	// #96090# moved SID_GETUNDOSTRINGS to ViewShell::GetMenuState()
1516 	// #96090# moved SID_GETREDOSTRINGS to ViewShell::GetMenuState()
1517 
1518 	///////////////////////////////////////////////////////////////////////
1519 	// Menuoption: Edit->Hyperlink
1520 	// Disable, if there is no hyperlink
1521 	//
1522     sal_Bool bDisableEditHyperlink = sal_True;
1523 	if( mpDrawView->AreObjectsMarked() && ( mpDrawView->GetMarkedObjectList().GetMarkCount() == 1 ) )
1524 	{
1525 		if( mpDrawView->IsTextEdit() )
1526 		{
1527 			OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
1528 			if (pOLV)
1529 			{
1530 				const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
1531 				if (pFieldItem)
1532 				{
1533                     ESelection aSel = pOLV->GetSelection();
1534                     if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 )
1535                     {
1536 					    const SvxFieldData* pField = pFieldItem->GetField();
1537 					    if ( pField->ISA(SvxURLField) )
1538                             bDisableEditHyperlink = sal_False;
1539                     }
1540 				}
1541 			}
1542 		}
1543 		else
1544 		{
1545 			SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj());
1546 
1547 			if ( pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor() )
1548 			{
1549 				uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel() );
1550 				if( xControlModel.is() )
1551 				{
1552 					uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY );
1553 					if( xPropSet.is() )
1554 					{
1555 						uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo() );
1556 						if( xPropInfo.is() && xPropInfo->hasPropertyByName(
1557 							rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL"))))
1558 						{
1559 							bDisableEditHyperlink = sal_False;
1560 						}
1561 					}
1562 				}
1563 			}
1564 		}
1565 	}
1566 
1567 	//highlight selected custom shape
1568 	{
1569 		sal_uInt16 nCurrentSId = 0;
1570 		if(HasCurrentFunction())
1571 			nCurrentSId = GetCurrentFunction()->GetSlotID();
1572 
1573 		if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_BASIC ) )
1574 			rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_BASIC, SID_DRAWTBX_CS_BASIC == nCurrentSId ));
1575 		if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_SYMBOL ) )
1576 			rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_SYMBOL, SID_DRAWTBX_CS_SYMBOL == nCurrentSId ));
1577 		if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_ARROW ) )
1578 			rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_ARROW, SID_DRAWTBX_CS_ARROW == nCurrentSId ));
1579 		if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_FLOWCHART ) )
1580 			rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_FLOWCHART, SID_DRAWTBX_CS_FLOWCHART == nCurrentSId ));
1581 		if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_CALLOUT ) )
1582 			rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_CALLOUT,SID_DRAWTBX_CS_CALLOUT == nCurrentSId ));
1583 		if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_STAR ) )
1584 			rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_STAR, SID_DRAWTBX_CS_STAR == nCurrentSId ));
1585 	}
1586 
1587     if ( bDisableEditHyperlink || GetDocSh()->IsReadOnly() )
1588         rSet.DisableItem( SID_EDIT_HYPERLINK );
1589 
1590 	if ( bDisableEditHyperlink )
1591 		rSet.DisableItem( SID_OPEN_HYPERLINK );
1592 
1593 #if defined WNT || defined UNX
1594 	if( !mxScannerManager.is() )
1595 	{
1596 		rSet.DisableItem( SID_TWAIN_SELECT );
1597 		rSet.DisableItem( SID_TWAIN_TRANSFER );
1598 	}
1599 #endif
1600 
1601     // Set the state of two entries in the 'Slide' context sub-menu
1602     // concerning the visibility of master page background and master page
1603     // shapes.
1604     if (rSet.GetItemState(SID_DISPLAY_MASTER_BACKGROUND) == SFX_ITEM_AVAILABLE
1605         || rSet.GetItemState(SID_DISPLAY_MASTER_OBJECTS) == SFX_ITEM_AVAILABLE)
1606     {
1607         SdPage* pPage = GetActualPage();
1608         if (pPage != NULL
1609             && GetDoc() != NULL)
1610         {
1611             SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
1612             SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
1613             sal_uInt8 aBackgroundId = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
1614             sal_uInt8 aObjectId = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
1615             rSet.Put(SfxBoolItem(SID_DISPLAY_MASTER_BACKGROUND,
1616                     aVisibleLayers.IsSet(aBackgroundId)));
1617             rSet.Put(SfxBoolItem(SID_DISPLAY_MASTER_OBJECTS,
1618                     aVisibleLayers.IsSet(aObjectId)));
1619         }
1620     }
1621 
1622     GetModeSwitchingMenuState (rSet);
1623 }
1624 
1625 void DrawViewShell::GetModeSwitchingMenuState (SfxItemSet &rSet)
1626 {
1627     //draview
1628 	rSet.Put(SfxBoolItem(SID_DIAMODE, sal_False));
1629 	rSet.Put(SfxBoolItem(SID_OUTLINEMODE, sal_False));
1630 	if (mePageKind == PK_NOTES)
1631 	{
1632 		rSet.Put(SfxBoolItem(SID_DRAWINGMODE, sal_False));
1633 		rSet.Put(SfxBoolItem(SID_NOTESMODE, sal_True));
1634 		rSet.Put(SfxBoolItem(SID_HANDOUTMODE, sal_False));
1635     }
1636 	else if (mePageKind == PK_HANDOUT)
1637 	{
1638 		rSet.Put(SfxBoolItem(SID_DRAWINGMODE, sal_False));
1639 		rSet.Put(SfxBoolItem(SID_NOTESMODE, sal_False));
1640 		rSet.Put(SfxBoolItem(SID_HANDOUTMODE, sal_True));
1641     }
1642     else
1643     {
1644 		rSet.Put(SfxBoolItem(SID_DRAWINGMODE, sal_True));
1645 		rSet.Put(SfxBoolItem(SID_NOTESMODE, sal_False));
1646 		rSet.Put(SfxBoolItem(SID_HANDOUTMODE, sal_False));
1647     }
1648 
1649     // #101976# Removed [GetDocSh()->GetCurrentFunction() ||] from the following
1650     // clause because the current function of the docshell can only be
1651     // search and replace or spell checking and in that case switching the
1652     // view mode is allowed.
1653 	const bool bIsRunning = SlideShow::IsRunning(GetViewShellBase());
1654 
1655     if (GetViewFrame()->GetFrame().IsInPlace() || bIsRunning)
1656 	{
1657         if ( !GetViewFrame()->GetFrame().IsInPlace() )
1658 		{
1659 			rSet.ClearItem( SID_DRAWINGMODE );
1660 			rSet.DisableItem( SID_DRAWINGMODE );
1661 		}
1662 
1663 		rSet.ClearItem( SID_NOTESMODE );
1664 		rSet.DisableItem( SID_NOTESMODE );
1665 
1666 		rSet.ClearItem( SID_HANDOUTMODE );
1667 		rSet.DisableItem( SID_HANDOUTMODE );
1668 
1669 		rSet.ClearItem( SID_OUTLINEMODE );
1670 		rSet.DisableItem( SID_OUTLINEMODE );
1671 
1672 		rSet.ClearItem( SID_DIAMODE );
1673 		rSet.DisableItem( SID_DIAMODE );
1674 	}
1675 
1676 	if (GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED)
1677 	{
1678 		// Outplace-Edit: Kein Umschalten erlauben
1679 		rSet.ClearItem( SID_OUTLINEMODE );
1680 		rSet.DisableItem( SID_OUTLINEMODE );
1681 
1682 		rSet.ClearItem( SID_DIAMODE );
1683 		rSet.DisableItem( SID_DIAMODE );
1684 
1685 		rSet.ClearItem( SID_NOTESMODE );
1686 		rSet.DisableItem( SID_NOTESMODE );
1687 
1688 		rSet.ClearItem( SID_HANDOUTMODE );
1689 		rSet.DisableItem( SID_HANDOUTMODE );
1690 	}
1691 
1692 	svx::ExtrusionBar::getState( mpDrawView, rSet );
1693 	svx::FontworkBar::getState( mpDrawView, rSet );
1694 }
1695 
1696 
1697 
1698 void DrawViewShell::GetState (SfxItemSet& rSet)
1699 {
1700     // Iterate over all requested items in the set.
1701 	SfxWhichIter aIter( rSet );
1702 	sal_uInt16 nWhich = aIter.FirstWhich();
1703 	while (nWhich)
1704 	{
1705 		switch (nWhich)
1706 		{
1707 			case SID_SEARCH_ITEM:
1708 			case SID_SEARCH_OPTIONS:
1709                 // Forward this request to the the common (old) code of the
1710                 // document shell.
1711                 GetDocSh()->GetState (rSet);
1712                 break;
1713 			default:
1714                 OSL_TRACE ("DrawViewShell::GetState(): can not handle which id %d", nWhich);
1715                 break;
1716 		}
1717 		nWhich = aIter.NextWhich();
1718 	}
1719 }
1720 
1721 
1722 
1723 
1724 void DrawViewShell::Execute (SfxRequest& rReq)
1725 {
1726 	if(SlideShow::IsRunning(GetViewShellBase()))
1727     {
1728         // Do not execute anything during a native slide show.
1729         return;
1730 	}
1731 
1732 	switch (rReq.GetSlot())
1733 	{
1734 		case SID_SEARCH_ITEM:
1735             // Forward this request to the the common (old) code of the
1736             // document shell.
1737             GetDocSh()->Execute (rReq);
1738 		break;
1739 
1740         case SID_SPELL_DIALOG:
1741         {
1742             SfxViewFrame* pViewFrame = GetViewFrame();
1743             if (rReq.GetArgs() != NULL)
1744                 pViewFrame->SetChildWindow (SID_SPELL_DIALOG,
1745                     ((const SfxBoolItem&) (rReq.GetArgs()->
1746                         Get(SID_SPELL_DIALOG))).GetValue());
1747             else
1748                 pViewFrame->ToggleChildWindow(SID_SPELL_DIALOG);
1749 
1750             pViewFrame->GetBindings().Invalidate(SID_SPELL_DIALOG);
1751             rReq.Ignore ();
1752         }
1753         break;
1754 
1755 		default:
1756             OSL_TRACE ("DrawViewShell::Execute(): can not handle slot %d", rReq.GetSlot());
1757             break;
1758 	}
1759 }
1760 
1761 } // end of namespace sd
1762