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