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