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