Update ooo320-m1
[ooovba.git] / sd / source / ui / view / drviews7.cxx
blobc4864e51df5746cbf2bde4e4d0c859147357dfb9
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drviews7.cxx,v $
10 * $Revision: 1.78 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <com/sun/star/lang/Locale.hpp>
35 #include <com/sun/star/linguistic2/XThesaurus.hpp>
36 #include <svx/fmglob.hxx>
37 #include <svx/globl3d.hxx>
38 #include <svx/svdouno.hxx>
39 #include <svx/eeitem.hxx>
40 #ifndef _FLDITEM_HXX
41 #include <svx/flditem.hxx>
42 #endif
43 #ifndef _SVXIDS_HXX
44 #include <svx/svxids.hrc>
45 #endif
46 #include <svx/svdpagv.hxx>
47 #include <svx/clipfmtitem.hxx>
48 #include <svx/fmshell.hxx>
49 #include <svtools/eitem.hxx>
50 #include <svtools/aeitem.hxx>
51 #include <svtools/stritem.hxx>
52 #include <svtools/visitem.hxx>
53 #include <svtools/whiter.hxx>
54 #include <sfx2/dispatch.hxx>
55 #include <svx/svdograf.hxx>
56 #include <svx/unolingu.hxx>
57 #include <svx/extrusionbar.hxx>
58 #include <svx/fontworkbar.hxx>
60 // #UndoRedo#
61 #include <svtools/slstitm.hxx>
62 #include <sfx2/app.hxx>
63 #include <svtools/insdlg.hxx>
64 #include <svtools/moduleoptions.hxx>
65 #include <svtools/languageoptions.hxx>
66 #include <comphelper/processfactory.hxx>
67 #include <sfx2/request.hxx>
70 #include <svx/pfiledlg.hxx>
71 #include <svx/grafctrl.hxx>
72 #include <svtools/cliplistener.hxx>
73 #include <sfx2/viewfrm.hxx>
75 #include "app.hrc"
76 #include "glob.hrc"
77 #include "res_bmp.hrc"
78 #include "PresentationViewShell.hxx"
80 #include "misc.hxx"
81 #include "Outliner.hxx"
82 #include "drawdoc.hxx"
83 #include "sdresid.hxx"
84 #include "sdpage.hxx"
85 #include "Client.hxx"
86 #include "DrawDocShell.hxx"
87 #include "zoomlist.hxx"
88 #include "slideshow.hxx"
89 #include "drawview.hxx"
90 #include "formatclipboard.hxx"
91 #include "ViewShellBase.hxx"
92 #include "ViewShellManager.hxx"
93 #include "LayerTabBar.hxx"
94 #include "fupoor.hxx"
95 #include "Window.hxx"
96 #include "fuediglu.hxx"
97 #include "fubullet.hxx"
99 using ::rtl::OUString;
100 using namespace ::com::sun::star;
101 using namespace ::com::sun::star::uno;
102 using namespace ::com::sun::star::lang;
103 using namespace ::com::sun::star::linguistic2;
105 /** Create a list of clipboard formats that are supported both from the
106 current clipboard content and the DrawViewShell.
107 The list is stored in a new instance of SvxClipboardFmtItem.
109 ::std::auto_ptr<SvxClipboardFmtItem> GetSupportedClipboardFormats (
110 TransferableDataHelper& rDataHelper)
112 ::std::auto_ptr<SvxClipboardFmtItem> pResult (
113 new SvxClipboardFmtItem(SID_CLIPBOARD_FORMAT_ITEMS));
115 sal_uInt32 nFormatCount (rDataHelper.GetFormatCount());
116 for (sal_uInt32 i=0; i<nFormatCount; i++)
118 const SotFormatStringId nTestFormat = rDataHelper.GetFormat(i);
120 // Check if the current format is the same as one that has already
121 // been handled.
122 bool bDuplicate (false);
123 for (sal_uInt32 j=0; j<i; j++)
125 if (nTestFormat == rDataHelper.GetFormat(j))
127 bDuplicate = true;
128 break;
132 // Look up the format among those that are supported by the
133 // DrawViewShell.
134 if ( ! bDuplicate)
136 switch (nTestFormat)
138 case SOT_FORMATSTR_ID_EMBED_SOURCE:
140 String sName;
142 TransferableObjectDescriptor aDescriptor;
143 if (rDataHelper.GetTransferableObjectDescriptor(
144 SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDescriptor))
146 sName = aDescriptor.maTypeName;
148 if (sName.Len() > 0)
149 pResult->AddClipbrdFormat(nTestFormat, sName);
150 else
151 pResult->AddClipbrdFormat(nTestFormat);
153 break;
156 case SOT_FORMATSTR_ID_LINK_SOURCE:
157 case SOT_FORMATSTR_ID_DRAWING:
158 case SOT_FORMATSTR_ID_SVXB:
159 case FORMAT_GDIMETAFILE:
160 case FORMAT_BITMAP:
161 case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
162 case FORMAT_STRING:
163 case SOT_FORMATSTR_ID_HTML:
164 case FORMAT_RTF:
165 case SOT_FORMATSTR_ID_EDITENGINE:
166 pResult->AddClipbrdFormat(nTestFormat);
167 break;
172 // Check some OLE formats whose names are handled differently.
173 SotFormatStringId nFormat (SOT_FORMATSTR_ID_EMBED_SOURCE_OLE);
174 bool bHasFormat (rDataHelper.HasFormat(nFormat));
175 if ( ! bHasFormat)
177 bHasFormat = rDataHelper.HasFormat(nFormat);
179 if (bHasFormat)
181 String sName;
182 String sSource;
183 if (SvPasteObjectHelper::GetEmbeddedName (rDataHelper, sName, sSource, nFormat))
184 pResult->AddClipbrdFormat (nFormat, sName);
187 return pResult;
190 namespace sd {
192 IMPL_LINK( DrawViewShell, ClipboardChanged, TransferableDataHelper*, pDataHelper )
194 if ( pDataHelper )
196 mbPastePossible = ( pDataHelper->GetFormatCount() != 0 );
198 // Update the list of supported clipboard formats according to the
199 // new clipboard content.
200 // There are some stack traces that indicate the possibility of the
201 // DrawViewShell destructor called during the call to
202 // GetSupportedClipboardFormats(). If that really has happened then
203 // exit immediately.
204 TransferableDataHelper aDataHelper (
205 TransferableDataHelper::CreateFromSystemClipboard(GetActiveWindow()));
206 ::std::auto_ptr<SvxClipboardFmtItem> pFormats (GetSupportedClipboardFormats(aDataHelper));
207 if (mpDrawView == NULL)
208 return 0;
209 mpCurrentClipboardFormats = pFormats;
211 SfxBindings& rBindings = GetViewFrame()->GetBindings();
212 rBindings.Invalidate( SID_PASTE );
213 rBindings.Invalidate( SID_PASTE_SPECIAL );
214 rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
216 return 0;
219 /*************************************************************************
221 |* Status (Enabled/Disabled) von Menue-SfxSlots setzen
223 \************************************************************************/
225 void DrawViewShell::GetMenuState( SfxItemSet &rSet )
227 if (mpDrawView == NULL)
229 // This assertion and return are here to prevent crashes like that
230 // of issue #126202#.
231 DBG_ASSERT(mpDrawView!=NULL, "Please report this assertion to the Impress team.");
232 return;
235 ViewShell::GetMenuState(rSet);
236 BOOL bDisableVerticalText = !SvtLanguageOptions().IsVerticalTextEnabled();
238 if ( bDisableVerticalText )
240 rSet.DisableItem( SID_DRAW_FONTWORK_VERTICAL );
241 rSet.DisableItem( SID_DRAW_CAPTION_VERTICAL );
242 rSet.DisableItem( SID_TEXT_FITTOSIZE_VERTICAL );
243 rSet.DisableItem( SID_DRAW_TEXT_VERTICAL );
246 FASTBOOL bConvertToPathPossible = mpDrawView->IsConvertToPathObjPossible(FALSE);
248 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
249 const ULONG nMarkCount = rMarkList.GetMarkCount();
251 //format paintbrush
253 SdFormatClipboard* pFormatClipboard = GetDocSh()->mpFormatClipboard;
254 bool bHasContent = pFormatClipboard && pFormatClipboard->HasContent();
255 rSet.Put(SfxBoolItem(SID_FORMATPAINTBRUSH,bHasContent));
256 if( ( nMarkCount!=1 && !bHasContent ) || mpDrawView->IsTextEdit() )
257 rSet.DisableItem( SID_FORMATPAINTBRUSH );
258 if( !bHasContent && nMarkCount==1 )
260 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
261 if( !pFormatClipboard->CanCopyThisType(pObj->GetObjInventor(),pObj->GetObjIdentifier()) )
262 rSet.DisableItem( SID_FORMATPAINTBRUSH );
266 // Stati der SfxChild-Windows (Animator, Fontwork etc.)
267 SetChildWindowState( rSet );
269 // Images der Toolboxen mappen (nur Zoom)
270 UpdateToolboxImages( rSet, FALSE );
272 if(HasCurrentFunction())
274 USHORT nSId = GetCurrentFunction()->GetSlotID();
276 rSet.Put( SfxBoolItem( nSId, TRUE ) );
278 // Bewirkt ein uncheck eines simulierten Slots
279 USHORT nId = GetIdBySubId( nSId );
281 // Images der Toolboxen mappen
282 UpdateToolboxImages( rSet );
284 if( nId != SID_ZOOM_TOOLBOX &&
285 nSId != SID_DRAWTBX_INSERT &&
286 nSId != SID_POSITION &&
287 nSId != SID_OBJECT_ALIGN )
289 if( nId != SID_OBJECT_CHOOSE_MODE )
290 rSet.Put( TbxImageItem( SID_OBJECT_CHOOSE_MODE, 0 ) );
291 if( nId != SID_DRAWTBX_TEXT )
292 rSet.Put( TbxImageItem( SID_DRAWTBX_TEXT, 0 ) );
293 if( nId != SID_DRAWTBX_RECTANGLES )
294 rSet.Put( TbxImageItem( SID_DRAWTBX_RECTANGLES, 0 ) );
295 if( nId != SID_DRAWTBX_ELLIPSES )
296 rSet.Put( TbxImageItem( SID_DRAWTBX_ELLIPSES, 0 ) );
297 if( nId != SID_DRAWTBX_LINES )
298 rSet.Put( TbxImageItem( SID_DRAWTBX_LINES, 0 ) );
299 if( nId != SID_DRAWTBX_ARROWS )
300 rSet.Put( TbxImageItem( SID_DRAWTBX_ARROWS, 0 ) );
301 if( nId != SID_DRAWTBX_3D_OBJECTS )
302 rSet.Put( TbxImageItem( SID_DRAWTBX_3D_OBJECTS, 0 ) );
303 if( nId != SID_DRAWTBX_CONNECTORS )
304 rSet.Put( TbxImageItem( SID_DRAWTBX_CONNECTORS, 0 ) );
308 SdrPageView* pPageView = mpDrawView->GetSdrPageView();
310 GetMenuStateSel(rSet);
312 if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_EXPAND_PAGE))
314 bool bDisable = true;
315 if( pPageView )
317 SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
319 if( pPage && (pPage->GetPageKind() == PK_STANDARD) && !pPage->IsMasterPage() )
321 SdrObject* pObj = pPage->GetPresObj(PRESOBJ_OUTLINE);
323 if(pObj && !pObj->IsEmptyPresObj())
325 bDisable = false;
330 if(bDisable)
332 rSet.DisableItem(SID_EXPAND_PAGE);
336 if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_SUMMARY_PAGE))
338 bool bDisable = true;
339 if( pPageView )
341 SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
343 if( pPage && (pPage->GetPageKind() == PK_STANDARD) && !pPage->IsMasterPage() )
345 SdrObject* pObj = pPage->GetPresObj(PRESOBJ_TITLE);
347 if(pObj && !pObj->IsEmptyPresObj())
349 bDisable = false;
354 if(bDisable)
356 rSet.DisableItem(SID_SUMMARY_PAGE);
360 // Starten der Praesentation moeglich?
361 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PRESENTATION ) ||
362 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_REHEARSE_TIMINGS ) )
364 BOOL bDisable = TRUE;
365 USHORT nCount = GetDoc()->GetSdPageCount( PK_STANDARD );
367 for( USHORT i = 0; i < nCount && bDisable; i++ )
369 SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
371 if( !pPage->IsExcluded() )
372 bDisable = FALSE;
375 if( bDisable || GetDocSh()->IsPreview())
377 rSet.DisableItem( SID_PRESENTATION );
378 rSet.DisableItem( SID_REHEARSE_TIMINGS );
382 // Klebepunkte
383 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_EDITMODE ) ||
384 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_INSERT_POINT ) ||
385 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_PERCENT ) ||
386 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR ) ||
387 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_LEFT ) ||
388 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_RIGHT ) ||
389 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_TOP ) ||
390 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_BOTTOM ) ||
391 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_HORZALIGN_CENTER ) ||
392 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_HORZALIGN_LEFT ) ||
393 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_HORZALIGN_RIGHT ) ||
394 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_VERTALIGN_CENTER ) ||
395 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_VERTALIGN_TOP ) ||
396 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_VERTALIGN_BOTTOM ) )
398 // Prozent
399 TRISTATE eState = mpDrawView->IsMarkedGluePointsPercent();
400 if( eState == STATE_DONTKNOW )
401 rSet.InvalidateItem( SID_GLUE_PERCENT );
402 else
403 rSet.Put( SfxBoolItem( SID_GLUE_PERCENT, eState == STATE_CHECK ) );
405 // Bei Prozent hat Alignment keinen Effekt
406 if( eState == STATE_CHECK )
408 rSet.DisableItem( SID_GLUE_HORZALIGN_CENTER );
409 rSet.DisableItem( SID_GLUE_HORZALIGN_LEFT );
410 rSet.DisableItem( SID_GLUE_HORZALIGN_RIGHT );
411 rSet.DisableItem( SID_GLUE_VERTALIGN_CENTER );
412 rSet.DisableItem( SID_GLUE_VERTALIGN_TOP );
413 rSet.DisableItem( SID_GLUE_VERTALIGN_BOTTOM );
415 else
417 // Horizontale Ausrichtung
418 USHORT nHorz = mpDrawView->GetMarkedGluePointsAlign( FALSE );
419 rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_CENTER, nHorz == SDRHORZALIGN_CENTER ) );
420 rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_LEFT, nHorz == SDRHORZALIGN_LEFT ) );
421 rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_RIGHT, nHorz == SDRHORZALIGN_RIGHT ) );
422 // Vertikale Ausrichtung
423 USHORT nVert = mpDrawView->GetMarkedGluePointsAlign( TRUE );
424 rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_CENTER, nVert == SDRVERTALIGN_CENTER ) );
425 rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_TOP, nVert == SDRVERTALIGN_TOP ) );
426 rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_BOTTOM, nVert == SDRVERTALIGN_BOTTOM ) );
429 // Punkt einfuegen
430 rSet.Put( SfxBoolItem( SID_GLUE_INSERT_POINT, mpDrawView->IsInsGluePointMode() ) );
432 // Autrittsrichtung
433 // Links
434 eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_LEFT );
435 if( eState == STATE_DONTKNOW )
436 rSet.InvalidateItem( SID_GLUE_ESCDIR_LEFT );
437 else
438 rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_LEFT, eState == STATE_CHECK ) );
439 // Rechts
440 eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_RIGHT );
441 if( eState == STATE_DONTKNOW )
442 rSet.InvalidateItem( SID_GLUE_ESCDIR_RIGHT );
443 else
444 rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_RIGHT, eState == STATE_CHECK ) );
445 // Oben
446 eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_TOP );
447 if( eState == STATE_DONTKNOW )
448 rSet.InvalidateItem( SID_GLUE_ESCDIR_TOP );
449 else
450 rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_TOP, eState == STATE_CHECK ) );
451 // Unten
452 eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_BOTTOM );
453 if( eState == STATE_DONTKNOW )
454 rSet.InvalidateItem( SID_GLUE_ESCDIR_BOTTOM );
455 else
456 rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_BOTTOM, eState == STATE_CHECK ) );
459 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GRID_FRONT ) ||
460 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_HELPLINES_FRONT ) )
462 rSet.Put( SfxBoolItem( SID_GRID_FRONT, mpDrawView->IsGridFront() ) );
463 rSet.Put( SfxBoolItem( SID_HELPLINES_FRONT, mpDrawView->IsHlplFront() ) );
466 if (!mpDrawView->IsFrameDragSingles())
467 rSet.Put(SfxBoolItem(SID_BEZIER_EDIT, TRUE));
468 else
469 rSet.Put(SfxBoolItem(SID_BEZIER_EDIT, FALSE));
471 if(dynamic_cast<FuEditGluePoints*>( GetCurrentFunction().get()))
472 rSet.Put(SfxBoolItem(SID_GLUE_EDITMODE, TRUE));
473 else
474 rSet.Put(SfxBoolItem(SID_GLUE_EDITMODE, FALSE));
476 if( !mpDrawView->IsMirrorAllowed( TRUE, TRUE ) )
478 rSet.DisableItem( SID_HORIZONTAL );
479 rSet.DisableItem( SID_VERTICAL );
482 if( !mpDrawView->IsMirrorAllowed() )
484 rSet.DisableItem( SID_OBJECT_MIRROR );
485 // rSet.DisableItem( SID_CONVERT_TO_3D_LATHE );
486 // rSet.DisableItem( SID_CONVERT_TO_3D_LATHE_FAST );
489 // interactive transparence control
490 if(!mpDrawView->IsTransparenceAllowed())
492 rSet.DisableItem( SID_OBJECT_TRANSPARENCE );
495 // interactive gradient control
496 if(!mpDrawView->IsGradientAllowed())
498 rSet.DisableItem( SID_OBJECT_GRADIENT );
501 // Morphen ggf. disablen
502 if ( !mpDrawView->IsMorphingAllowed() )
503 rSet.DisableItem( SID_POLYGON_MORPHING );
505 // Vectorize ggf. disablen
506 if ( !mpDrawView->IsVectorizeAllowed() )
507 rSet.DisableItem( SID_VECTORIZE );
509 if( !mpDrawView->IsReverseOrderPossible() )
511 rSet.DisableItem( SID_REVERSE_ORDER );
514 if ( !bConvertToPathPossible &&
515 !mpDrawView->IsCrookAllowed( mpDrawView->IsCrookNoContortion() ) )
517 // Implizite Wandlung in Kurve nicht moeglich
518 rSet.DisableItem(SID_OBJECT_CROOK_ROTATE);
519 rSet.DisableItem(SID_OBJECT_CROOK_SLANT);
520 rSet.DisableItem(SID_OBJECT_CROOK_STRETCH);
523 if ( !mpDrawView->IsGroupEntered() )
525 rSet.DisableItem( SID_LEAVE_GROUP );
526 rSet.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS, FALSE ) );
527 rSet.ClearItem( SID_LEAVE_ALL_GROUPS );
528 rSet.DisableItem( SID_LEAVE_ALL_GROUPS );
530 else
531 rSet.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS, TRUE ) );
533 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_THESAURUS ) )
535 if ( !mpDrawView->IsTextEdit() )
537 rSet.DisableItem( SID_THESAURUS );
539 else
541 LanguageType eLang = GetDoc()->GetLanguage( EE_CHAR_LANGUAGE );
542 Reference< XThesaurus > xThesaurus( LinguMgr::GetThesaurus() );
543 Locale aLocale;
545 SvxLanguageToLocale( aLocale, eLang );
547 if (!xThesaurus.is() || eLang == LANGUAGE_NONE || !xThesaurus->hasLocale(aLocale) )
548 rSet.DisableItem( SID_THESAURUS );
552 if ( !mpDrawView->IsTextEdit() )
554 rSet.DisableItem( SID_THESAURUS );
557 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SELECTALL ) ||
558 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SIZE_ALL ) )
560 if( pPageView && pPageView->GetObjList()->GetObjCount() == 0 )
562 // Sollte disabled sein, wenn kein Objekt auf der Zeichenflaeche ist:
563 rSet.DisableItem( SID_SELECTALL );
564 rSet.DisableItem( SID_SIZE_ALL );
568 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONTEXT ) )
569 rSet.Put( SfxStringItem( SID_CONTEXT, mpDrawView->GetStatusText() ) );
571 // clipboard (paste)
572 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE ) ||
573 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE_SPECIAL ) ||
574 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) )
576 if ( !mpClipEvtLstnr )
578 // SSA: #108717# avoid clipboard initialization for
579 // read-only presentation views (workaround for NT4.0
580 // clipboard prob...)
581 if( !ISA(PresentationViewShell) )
583 // create listener
584 mpClipEvtLstnr = new TransferableClipboardListener( LINK( this, DrawViewShell, ClipboardChanged ) );
585 mpClipEvtLstnr->acquire();
586 mpClipEvtLstnr->AddRemoveListener( GetActiveWindow(), TRUE );
588 // get initial state
589 TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
590 mbPastePossible = ( aDataHelper.GetFormatCount() != 0 );
592 else
593 mbPastePossible = FALSE;
596 if( !mbPastePossible )
598 rSet.DisableItem( SID_PASTE );
599 rSet.DisableItem( SID_PASTE_SPECIAL );
600 rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
602 else if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) )
604 if (mpCurrentClipboardFormats.get() != NULL)
605 rSet.Put(*mpCurrentClipboardFormats);
609 if ( !bConvertToPathPossible )
611 rSet.DisableItem(SID_CHANGEBEZIER);
614 if (mpDrawView == NULL)
616 // When we come to this line then we probably have another
617 // incarnation of issue #126202#. The mpDrawView was not NULL but is
618 // now. The reason for this may be that the DrawViewShell has been
619 // destroyed in the mean time.
620 // We can only return immediately and hope that the deleted
621 // DrawViewShell is not called again.
622 DBG_ASSERT(mpDrawView!=NULL, "Please report this assertion to the Impress team.");
623 return;
626 if( !( mpDrawView->IsConvertToPolyObjPossible(FALSE) || mpDrawView->IsVectorizeAllowed() ) )
627 rSet.DisableItem(SID_CHANGEPOLYGON);
629 if( !( mpDrawView->IsConvertToPolyObjPossible(FALSE) || mpDrawView->IsConvertToContourPossible() ) )
630 rSet.DisableItem(SID_CONVERT_TO_CONTOUR);
632 if ( !mpDrawView->IsConvertTo3DObjPossible() )
634 rSet.DisableItem(SID_CONVERT_TO_3D);
635 rSet.DisableItem(SID_CONVERT_TO_3D_LATHE);
636 rSet.DisableItem(SID_CONVERT_TO_3D_LATHE_FAST);
639 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MANAGE_LINKS ) )
641 if ( GetDoc()->GetLinkCount() == 0 )
643 rSet.DisableItem(SID_MANAGE_LINKS);
647 if (mePageKind == PK_HANDOUT)
649 rSet.DisableItem(SID_PRESENTATION_LAYOUT);
650 rSet.DisableItem(SID_SELECT_BACKGROUND);
653 if (mePageKind == PK_NOTES)
655 rSet.DisableItem(SID_INSERTPAGE);
656 rSet.DisableItem(SID_RENAMEPAGE);
657 rSet.DisableItem(SID_RENAMEPAGE_QUICK);
658 rSet.DisableItem(SID_DUPLICATE_PAGE);
659 rSet.ClearItem(SID_ANIMATION_OBJECTS);
660 rSet.DisableItem(SID_ANIMATION_OBJECTS);
661 rSet.DisableItem(SID_ANIMATION_EFFECTS);
663 if (meEditMode == EM_MASTERPAGE)
664 rSet.DisableItem(SID_MODIFYPAGE);
666 rSet.DisableItem(SID_SELECT_BACKGROUND);
667 rSet.DisableItem(SID_INSERTLAYER);
668 rSet.DisableItem(SID_LAYERMODE);
669 rSet.DisableItem(SID_INSERTFILE);
671 else if (mePageKind == PK_HANDOUT)
673 rSet.DisableItem(SID_INSERTPAGE);
674 rSet.DisableItem(SID_DUPLICATE_PAGE);
675 rSet.ClearItem(SID_ANIMATION_OBJECTS);
676 rSet.DisableItem(SID_ANIMATION_OBJECTS);
677 rSet.DisableItem(SID_ANIMATION_EFFECTS);
678 rSet.DisableItem(SID_RENAMEPAGE);
679 rSet.DisableItem(SID_RENAMEPAGE_QUICK);
680 rSet.DisableItem(SID_INSERTLAYER);
681 rSet.DisableItem(SID_MODIFYLAYER);
682 rSet.DisableItem(SID_RENAMELAYER);
683 rSet.DisableItem(SID_LAYERMODE);
684 rSet.DisableItem(SID_INSERTFILE);
685 rSet.DisableItem(SID_PAGEMODE);
686 rSet.DisableItem(SID_SELECT_BACKGROUND);
688 else
690 if (meEditMode == EM_MASTERPAGE)
692 rSet.DisableItem(SID_INSERTPAGE);
693 rSet.DisableItem(SID_DUPLICATE_PAGE);
694 rSet.DisableItem(SID_MODIFYPAGE);
695 rSet.ClearItem(SID_ANIMATION_OBJECTS);
696 rSet.DisableItem(SID_ANIMATION_OBJECTS);
699 rSet.Put (SfxBoolItem (SID_LAYERMODE, IsLayerModeActive()));
702 if ( ! IsLayerModeActive())
704 rSet.DisableItem( SID_INSERTLAYER );
705 rSet.DisableItem( SID_MODIFYLAYER );
706 rSet.DisableItem( SID_DELETE_LAYER );
707 rSet.DisableItem( SID_RENAMELAYER );
710 if (meEditMode == EM_PAGE)
712 /**********************************************************************
713 * Seiten-Modus
714 **********************************************************************/
715 rSet.Put(SfxBoolItem(SID_PAGEMODE, TRUE));
716 rSet.Put(SfxBoolItem(SID_MASTERPAGE, FALSE));
717 rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, FALSE));
718 rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, FALSE));
719 rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, FALSE));
721 if (mePageKind == PK_STANDARD &&
722 rSet.GetItemState(SID_TITLE_MASTERPAGE) == SFX_ITEM_AVAILABLE)
724 // Gibt es eine Seite mit dem AutoLayout "Titel"?
725 BOOL bDisable = TRUE;
726 USHORT i = 0;
727 USHORT nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
729 while (i < nCount && bDisable)
731 SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
733 if (pPage->GetAutoLayout() == AUTOLAYOUT_TITLE)
735 bDisable = FALSE;
738 i++;
741 if (bDisable)
743 rSet.DisableItem(SID_TITLE_MASTERPAGE);
745 else
747 rSet.Put(SfxBoolItem(SID_TITLE_MASTERPAGE, FALSE));
750 else
752 rSet.DisableItem(SID_TITLE_MASTERPAGE);
755 rSet.DisableItem (SID_INSERT_MASTER_PAGE);
756 rSet.DisableItem (SID_DELETE_MASTER_PAGE);
757 rSet.DisableItem (SID_RENAME_MASTER_PAGE);
758 rSet.DisableItem (SID_CLOSE_MASTER_VIEW);
760 else
762 rSet.Put(SfxBoolItem(SID_PAGEMODE, FALSE));
763 rSet.Put(SfxBoolItem(SID_MASTERPAGE, TRUE));
765 /**********************************************************************
766 * Hintergrundseiten-Modus
767 **********************************************************************/
768 if (mePageKind == PK_STANDARD)
770 rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, TRUE));
771 rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, FALSE));
772 rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, FALSE));
774 if (rSet.GetItemState(SID_TITLE_MASTERPAGE) == SFX_ITEM_AVAILABLE)
776 BOOL bCheck = FALSE;
777 BOOL bDisable = TRUE;
778 if( pPageView )
780 SdPage* pMPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
782 USHORT i = 0;
783 USHORT nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
785 // Referenziert eine Seite mit dem AutoLayout "Titel" die
786 // aktuelle MasterPage?
787 while (i < nCount && !bCheck && bDisable)
789 SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
791 // Seite referenziert aktuelle MasterPage
792 if (pPage->GetAutoLayout() == AUTOLAYOUT_TITLE)
794 // Eine Seite hat das AutoLayout "Titel"
795 bDisable = FALSE;
797 SdPage& rRefMPage = (SdPage&)(pPage->TRG_GetMasterPage());
799 if(&rRefMPage == pMPage)
801 // Eine Seite mit dem AutoLayout "Titel"
802 // referenziert die aktuelle MasterPage
803 bCheck = TRUE;
807 i++;
811 if (bCheck)
813 rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, FALSE));
816 rSet.Put(SfxBoolItem(SID_TITLE_MASTERPAGE, bCheck));
818 if (bDisable)
820 rSet.ClearItem(SID_TITLE_MASTERPAGE);
821 rSet.DisableItem(SID_TITLE_MASTERPAGE);
825 else if (mePageKind == PK_NOTES)
827 rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, FALSE));
828 rSet.DisableItem(SID_TITLE_MASTERPAGE);
829 rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, TRUE));
830 rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, FALSE));
832 else if (mePageKind == PK_HANDOUT)
834 rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, FALSE));
835 rSet.DisableItem(SID_TITLE_MASTERPAGE);
836 rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, FALSE));
837 rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, TRUE));
841 // Status der Lineale setzen
842 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_RULER ) )
843 rSet.Put( SfxBoolItem( SID_RULER, HasRuler() ) );
845 // nicht die letzte Seite oder eine Masterpage loeschen
846 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_PAGE )
847 || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_MASTER_PAGE ) )
849 if (maTabControl.GetPageCount() == 1 ||
850 meEditMode == EM_MASTERPAGE ||
851 mePageKind == PK_NOTES ||
852 mePageKind == PK_HANDOUT ||
853 (GetShellType()!=ST_DRAW&&IsLayerModeActive()))
855 if (rSet.GetItemState(SID_DELETE_PAGE) == SFX_ITEM_AVAILABLE)
856 rSet.DisableItem(SID_DELETE_PAGE);
857 if (rSet.GetItemState(SID_DELETE_MASTER_PAGE)==SFX_ITEM_AVAILABLE)
858 rSet.DisableItem(SID_DELETE_MASTER_PAGE);
862 // darf der aktuelle Layer geloescht werden?
863 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_LAYER ) )
865 USHORT nCurrentLayer = GetLayerTabControl()->GetCurPageId();
866 const String& rName = GetLayerTabControl()->GetPageText(nCurrentLayer);
868 BOOL bDisableIt = !IsLayerModeActive();
869 bDisableIt |= (rName == String(SdResId(STR_LAYER_LAYOUT)));
870 bDisableIt |= (rName == String(SdResId(STR_LAYER_BCKGRND)));
871 bDisableIt |= (rName == String(SdResId(STR_LAYER_BCKGRNDOBJ)));
872 bDisableIt |= (rName == String(SdResId(STR_LAYER_CONTROLS)));
873 bDisableIt |= (rName == String(SdResId(STR_LAYER_MEASURELINES)));
875 if (bDisableIt)
877 rSet.DisableItem(SID_DELETE_LAYER);
878 rSet.DisableItem(SID_RENAMELAYER);
882 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CUT ) ||
883 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_COPY ) ||
884 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTLINE_BULLET ))
886 OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
888 // Sonderbehandlung für SID_OUTLINE_BULLET wenn Objekte
889 // mit unterschiedlichen arten von NumBullet Items markiert
890 // sind
891 BOOL bHasOutliner = FALSE;
892 BOOL bHasOther = FALSE;
893 for(ULONG nNum = 0; nNum < nMarkCount; nNum++)
895 SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
896 if( pObj->GetObjInventor() == SdrInventor )
898 if( pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
900 bHasOutliner = TRUE;
901 if(bHasOther)
902 break;
904 else
906 bHasOther = TRUE;
907 if(bHasOutliner)
908 break;
913 if( bHasOther && bHasOutliner )
914 rSet.DisableItem( SID_OUTLINE_BULLET );
916 if (pOlView)
918 if ( pOlView->GetSelected().Len() == 0 )
920 rSet.DisableItem( SID_CUT );
921 rSet.DisableItem( SID_COPY );
927 FuBullet::GetSlotState( rSet, this, GetViewFrame() );
929 if ( GetDocSh()->IsUIActive() )
931 rSet.DisableItem( SID_INSERT_OBJECT );
932 rSet.DisableItem( SID_INSERT_PLUGIN );
933 rSet.DisableItem( SID_INSERT_SOUND );
934 rSet.DisableItem( SID_INSERT_VIDEO );
935 rSet.DisableItem( SID_INSERT_APPLET );
936 rSet.DisableItem( SID_INSERT_FLOATINGFRAME );
937 #ifdef STARIMAGE_AVAILABLE
938 rSet.DisableItem( SID_INSERT_IMAGE );
939 #endif
940 rSet.DisableItem( SID_INSERT_MATH );
941 rSet.DisableItem( SID_INSERT_DIAGRAM );
942 rSet.DisableItem( SID_ATTR_TABLE );
943 rSet.DisableItem( SID_SIZE_REAL );
944 rSet.DisableItem( SID_SIZE_OPTIMAL );
945 rSet.DisableItem( SID_SIZE_ALL );
946 rSet.DisableItem( SID_SIZE_PAGE_WIDTH );
947 rSet.DisableItem( SID_SIZE_PAGE );
948 // rSet.DisableItem( SID_INSERTPAGE );
949 rSet.DisableItem( SID_DUPLICATE_PAGE );
950 rSet.DisableItem( SID_ZOOM_TOOLBOX );
953 // Zoom-Stati
954 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_IN ) ||
955 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_OUT )||
956 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_PANNING ) )
958 if( GetActiveWindow()->GetZoom() <= GetActiveWindow()->GetMinZoom() || GetDocSh()->IsUIActive() )
960 rSet.DisableItem( SID_ZOOM_IN );
961 rSet.DisableItem( SID_ZOOM_PANNING );
963 if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() )
964 rSet.DisableItem( SID_ZOOM_OUT );
967 if (!mpZoomList->IsNextPossible())
969 rSet.DisableItem(SID_ZOOM_NEXT);
971 if (!mpZoomList->IsPreviousPossible())
973 rSet.DisableItem(SID_ZOOM_PREV);
976 // EditText aktiv
977 if (GetViewShellBase().GetViewShellManager()->GetShell(RID_DRAW_TEXT_TOOLBOX) != NULL)
979 USHORT nCurrentSId = SID_ATTR_CHAR;
981 if(HasCurrentFunction())
983 nCurrentSId = GetCurrentFunction()->GetSlotID();
985 if( nCurrentSId != SID_TEXT_FITTOSIZE &&
986 nCurrentSId != SID_TEXT_FITTOSIZE_VERTICAL &&
987 nCurrentSId != SID_ATTR_CHAR_VERTICAL )
988 nCurrentSId = SID_ATTR_CHAR;
990 rSet.Put( SfxBoolItem( nCurrentSId, TRUE ) );
992 // Kurzform von UpdateToolboxImages()
993 rSet.Put( TbxImageItem( SID_DRAWTBX_TEXT, nCurrentSId ) );
996 if ( GetDocSh()->IsReadOnly() )
998 rSet.DisableItem( SID_AUTOSPELL_CHECK );
1000 else
1002 if (GetDoc()->GetOnlineSpell())
1004 rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, TRUE));
1006 else
1008 rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, FALSE));
1012 SdrPageView* pPV = mpDrawView->GetSdrPageView();
1013 String aActiveLayer = mpDrawView->GetActiveLayer();
1015 if ( ( aActiveLayer.Len() != 0 && pPV && ( pPV->IsLayerLocked(aActiveLayer) ||
1016 !pPV->IsLayerVisible(aActiveLayer) ) ) ||
1017 SD_MOD()->GetWaterCan() )
1019 rSet.DisableItem( SID_PASTE );
1020 rSet.DisableItem( SID_PASTE_SPECIAL );
1021 rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
1023 rSet.DisableItem( SID_INSERT_FLD_DATE_FIX );
1024 rSet.DisableItem( SID_INSERT_FLD_DATE_VAR );
1025 rSet.DisableItem( SID_INSERT_FLD_TIME_FIX );
1026 rSet.DisableItem( SID_INSERT_FLD_TIME_VAR );
1027 rSet.DisableItem( SID_INSERT_FLD_AUTHOR );
1028 rSet.DisableItem( SID_INSERT_FLD_PAGE );
1029 rSet.DisableItem( SID_INSERT_FLD_PAGES );
1030 rSet.DisableItem( SID_INSERT_FLD_FILE );
1032 rSet.DisableItem( SID_INSERT_GRAPHIC );
1033 rSet.DisableItem( SID_INSERT_AVMEDIA );
1034 rSet.DisableItem( SID_INSERT_DIAGRAM );
1035 rSet.DisableItem( SID_INSERT_OBJECT );
1036 rSet.DisableItem( SID_INSERT_PLUGIN );
1037 rSet.DisableItem( SID_INSERT_SOUND );
1038 rSet.DisableItem( SID_INSERT_VIDEO );
1039 rSet.DisableItem( SID_INSERT_APPLET );
1040 rSet.DisableItem( SID_INSERT_FLOATINGFRAME );
1042 #ifdef STARIMAGE_AVAILABLE
1043 rSet.DisableItem( SID_INSERT_IMAGE );
1044 #endif
1045 rSet.DisableItem( SID_INSERT_MATH );
1046 rSet.DisableItem( SID_INSERT_FRAME );
1047 rSet.DisableItem( SID_INSERTFILE );
1048 rSet.DisableItem( SID_ATTR_TABLE );
1049 rSet.DisableItem( SID_COPYOBJECTS );
1051 rSet.DisableItem( SID_SCAN );
1052 rSet.DisableItem( SID_TWAIN_SELECT );
1053 rSet.DisableItem( SID_TWAIN_TRANSFER );
1055 // rSet.DisableItem( SID_BEZIER_EDIT );
1056 rSet.DisableItem( SID_GLUE_EDITMODE );
1057 rSet.DisableItem( SID_OBJECT_ROTATE );
1058 rSet.DisableItem( SID_OBJECT_SHEAR );
1059 rSet.DisableItem( SID_OBJECT_MIRROR );
1060 rSet.DisableItem( SID_OBJECT_CROP );
1061 rSet.DisableItem( SID_ATTR_GRAF_CROP );
1062 rSet.DisableItem( SID_OBJECT_TRANSPARENCE );
1063 rSet.DisableItem( SID_OBJECT_GRADIENT );
1064 rSet.DisableItem( SID_OBJECT_CROOK_ROTATE );
1065 rSet.DisableItem( SID_OBJECT_CROOK_SLANT );
1066 rSet.DisableItem( SID_OBJECT_CROOK_STRETCH );
1068 // Alle objekterzeugenden Werkzeuge disablen
1069 rSet.ClearItem( SID_ATTR_CHAR );
1070 rSet.DisableItem( SID_ATTR_CHAR );
1071 rSet.ClearItem( SID_ATTR_CHAR_VERTICAL );
1072 rSet.DisableItem( SID_ATTR_CHAR_VERTICAL );
1073 rSet.ClearItem(SID_DRAW_LINE);
1074 rSet.DisableItem(SID_DRAW_LINE);
1075 rSet.ClearItem(SID_DRAW_MEASURELINE);
1076 rSet.DisableItem(SID_DRAW_MEASURELINE);
1077 rSet.ClearItem(SID_DRAW_XLINE);
1078 rSet.DisableItem(SID_DRAW_XLINE);
1079 rSet.ClearItem( SID_LINE_ARROW_START );
1080 rSet.DisableItem( SID_LINE_ARROW_START );
1081 rSet.ClearItem( SID_LINE_ARROW_END );
1082 rSet.DisableItem( SID_LINE_ARROW_END );
1083 rSet.ClearItem( SID_LINE_ARROWS );
1084 rSet.DisableItem( SID_LINE_ARROWS );
1085 rSet.ClearItem( SID_LINE_ARROW_CIRCLE );
1086 rSet.DisableItem( SID_LINE_ARROW_CIRCLE );
1087 rSet.ClearItem( SID_LINE_CIRCLE_ARROW );
1088 rSet.DisableItem( SID_LINE_CIRCLE_ARROW );
1089 rSet.ClearItem( SID_LINE_ARROW_SQUARE );
1090 rSet.DisableItem( SID_LINE_ARROW_SQUARE );
1091 rSet.ClearItem( SID_LINE_SQUARE_ARROW );
1092 rSet.DisableItem( SID_LINE_SQUARE_ARROW );
1094 rSet.ClearItem(SID_DRAW_RECT);
1095 rSet.DisableItem(SID_DRAW_RECT);
1096 rSet.ClearItem(SID_DRAW_RECT_NOFILL);
1097 rSet.DisableItem(SID_DRAW_RECT_NOFILL);
1098 rSet.ClearItem(SID_DRAW_RECT_ROUND);
1099 rSet.DisableItem(SID_DRAW_RECT_ROUND);
1100 rSet.ClearItem(SID_DRAW_RECT_ROUND_NOFILL);
1101 rSet.DisableItem(SID_DRAW_RECT_ROUND_NOFILL);
1102 rSet.ClearItem(SID_DRAW_SQUARE);
1103 rSet.DisableItem(SID_DRAW_SQUARE);
1104 rSet.ClearItem(SID_DRAW_SQUARE_NOFILL);
1105 rSet.DisableItem(SID_DRAW_SQUARE_NOFILL);
1106 rSet.ClearItem(SID_DRAW_SQUARE_ROUND);
1107 rSet.DisableItem(SID_DRAW_SQUARE_ROUND);
1108 rSet.ClearItem(SID_DRAW_SQUARE_ROUND_NOFILL);
1109 rSet.DisableItem(SID_DRAW_SQUARE_ROUND_NOFILL);
1110 rSet.ClearItem(SID_DRAW_ELLIPSE);
1111 rSet.DisableItem(SID_DRAW_ELLIPSE);
1112 rSet.ClearItem(SID_DRAW_ELLIPSE_NOFILL);
1113 rSet.DisableItem(SID_DRAW_ELLIPSE_NOFILL);
1114 rSet.ClearItem(SID_DRAW_CIRCLE);
1115 rSet.DisableItem(SID_DRAW_CIRCLE);
1116 rSet.ClearItem(SID_DRAW_CIRCLE_NOFILL);
1117 rSet.DisableItem(SID_DRAW_CIRCLE_NOFILL);
1118 rSet.ClearItem(SID_DRAW_CAPTION);
1119 rSet.DisableItem(SID_DRAW_CAPTION);
1120 rSet.ClearItem(SID_DRAW_FONTWORK);
1121 rSet.DisableItem(SID_DRAW_FONTWORK);
1122 rSet.ClearItem(SID_DRAW_FONTWORK_VERTICAL);
1123 rSet.DisableItem(SID_DRAW_FONTWORK_VERTICAL);
1124 rSet.ClearItem(SID_DRAW_CAPTION_VERTICAL);
1125 rSet.DisableItem(SID_DRAW_CAPTION_VERTICAL);
1126 rSet.ClearItem(SID_TEXT_FITTOSIZE);
1127 rSet.DisableItem(SID_TEXT_FITTOSIZE);
1128 rSet.ClearItem(SID_TEXT_FITTOSIZE_VERTICAL);
1129 rSet.DisableItem(SID_TEXT_FITTOSIZE_VERTICAL);
1130 rSet.ClearItem(SID_TOOL_CONNECTOR);
1131 rSet.DisableItem(SID_TOOL_CONNECTOR);
1132 rSet.ClearItem(SID_CONNECTOR_ARROW_START);
1133 rSet.DisableItem(SID_CONNECTOR_ARROW_START);
1134 rSet.ClearItem(SID_CONNECTOR_ARROW_END);
1135 rSet.DisableItem(SID_CONNECTOR_ARROW_END);
1136 rSet.ClearItem(SID_CONNECTOR_ARROWS);
1137 rSet.DisableItem(SID_CONNECTOR_ARROWS);
1138 rSet.ClearItem(SID_CONNECTOR_CIRCLE_START);
1139 rSet.DisableItem(SID_CONNECTOR_CIRCLE_START);
1140 rSet.ClearItem(SID_CONNECTOR_CIRCLE_END);
1141 rSet.DisableItem(SID_CONNECTOR_CIRCLE_END);
1142 rSet.ClearItem(SID_CONNECTOR_CIRCLES);
1143 rSet.DisableItem(SID_CONNECTOR_CIRCLES);
1144 rSet.ClearItem(SID_CONNECTOR_LINE);
1145 rSet.DisableItem(SID_CONNECTOR_LINE);
1146 rSet.ClearItem(SID_CONNECTOR_LINE_ARROW_START);
1147 rSet.DisableItem(SID_CONNECTOR_LINE_ARROW_START);
1148 rSet.ClearItem(SID_CONNECTOR_LINE_ARROW_END);
1149 rSet.DisableItem(SID_CONNECTOR_LINE_ARROW_END);
1150 rSet.ClearItem(SID_CONNECTOR_LINE_ARROWS);
1151 rSet.DisableItem(SID_CONNECTOR_LINE_ARROWS);
1152 rSet.ClearItem(SID_CONNECTOR_LINE_CIRCLE_START);
1153 rSet.DisableItem(SID_CONNECTOR_LINE_CIRCLE_START);
1154 rSet.ClearItem(SID_CONNECTOR_LINE_CIRCLE_END);
1155 rSet.DisableItem(SID_CONNECTOR_LINE_CIRCLE_END);
1156 rSet.ClearItem(SID_CONNECTOR_LINE_CIRCLES);
1157 rSet.DisableItem(SID_CONNECTOR_LINE_CIRCLES);
1158 rSet.ClearItem(SID_CONNECTOR_CURVE);
1159 rSet.DisableItem(SID_CONNECTOR_CURVE);
1160 rSet.ClearItem(SID_CONNECTOR_CURVE_ARROW_START);
1161 rSet.DisableItem(SID_CONNECTOR_CURVE_ARROW_START);
1162 rSet.ClearItem(SID_CONNECTOR_CURVE_ARROW_END);
1163 rSet.DisableItem(SID_CONNECTOR_CURVE_ARROW_END);
1164 rSet.ClearItem(SID_CONNECTOR_CURVE_ARROWS);
1165 rSet.DisableItem(SID_CONNECTOR_CURVE_ARROWS);
1166 rSet.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_START);
1167 rSet.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_START);
1168 rSet.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_END);
1169 rSet.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_END);
1170 rSet.ClearItem(SID_CONNECTOR_CURVE_CIRCLES);
1171 rSet.DisableItem(SID_CONNECTOR_CURVE_CIRCLES);
1172 rSet.ClearItem(SID_CONNECTOR_LINES);
1173 rSet.DisableItem(SID_CONNECTOR_LINES);
1174 rSet.ClearItem(SID_CONNECTOR_LINES_ARROW_START);
1175 rSet.DisableItem(SID_CONNECTOR_LINES_ARROW_START);
1176 rSet.ClearItem(SID_CONNECTOR_LINES_ARROW_END);
1177 rSet.DisableItem(SID_CONNECTOR_LINES_ARROW_END);
1178 rSet.ClearItem(SID_CONNECTOR_LINES_ARROWS);
1179 rSet.DisableItem(SID_CONNECTOR_LINES_ARROWS);
1180 rSet.ClearItem(SID_CONNECTOR_LINES_CIRCLE_START);
1181 rSet.DisableItem(SID_CONNECTOR_LINES_CIRCLE_START);
1182 rSet.ClearItem(SID_CONNECTOR_LINES_CIRCLE_END);
1183 rSet.DisableItem(SID_CONNECTOR_LINES_CIRCLE_END);
1184 rSet.ClearItem(SID_CONNECTOR_LINES_CIRCLES);
1185 rSet.DisableItem(SID_CONNECTOR_LINES_CIRCLES);
1186 rSet.ClearItem(SID_DRAW_ARC);
1187 rSet.DisableItem(SID_DRAW_ARC);
1188 rSet.ClearItem(SID_DRAW_CIRCLEARC);
1189 rSet.DisableItem(SID_DRAW_CIRCLEARC);
1190 rSet.ClearItem(SID_DRAW_PIE);
1191 rSet.DisableItem(SID_DRAW_PIE);
1192 rSet.ClearItem(SID_DRAW_PIE_NOFILL);
1193 rSet.DisableItem(SID_DRAW_PIE_NOFILL);
1194 rSet.ClearItem(SID_DRAW_CIRCLEPIE);
1195 rSet.DisableItem(SID_DRAW_CIRCLEPIE);
1196 rSet.ClearItem(SID_DRAW_CIRCLEPIE_NOFILL);
1197 rSet.DisableItem(SID_DRAW_CIRCLEPIE_NOFILL);
1198 rSet.ClearItem(SID_DRAW_ELLIPSECUT);
1199 rSet.DisableItem(SID_DRAW_ELLIPSECUT);
1200 rSet.ClearItem(SID_DRAW_ELLIPSECUT_NOFILL);
1201 rSet.DisableItem(SID_DRAW_ELLIPSECUT_NOFILL);
1202 rSet.ClearItem(SID_DRAW_CIRCLECUT);
1203 rSet.DisableItem(SID_DRAW_CIRCLECUT);
1204 rSet.ClearItem(SID_DRAW_CIRCLECUT_NOFILL);
1205 rSet.DisableItem(SID_DRAW_CIRCLECUT_NOFILL);
1206 rSet.ClearItem(SID_DRAW_POLYGON);
1207 rSet.DisableItem(SID_DRAW_POLYGON);
1208 rSet.ClearItem(SID_DRAW_POLYGON_NOFILL);
1209 rSet.DisableItem(SID_DRAW_POLYGON_NOFILL);
1210 rSet.ClearItem(SID_DRAW_FREELINE);
1211 rSet.DisableItem(SID_DRAW_FREELINE);
1212 rSet.ClearItem(SID_DRAW_FREELINE_NOFILL);
1213 rSet.DisableItem(SID_DRAW_FREELINE_NOFILL);
1214 rSet.ClearItem(SID_DRAW_XPOLYGON);
1215 rSet.DisableItem(SID_DRAW_XPOLYGON);
1216 rSet.ClearItem(SID_DRAW_XPOLYGON_NOFILL);
1217 rSet.DisableItem(SID_DRAW_XPOLYGON_NOFILL);
1218 rSet.ClearItem(SID_DRAW_BEZIER_FILL);
1219 rSet.DisableItem(SID_DRAW_BEZIER_FILL);
1220 rSet.ClearItem(SID_DRAW_BEZIER_NOFILL);
1221 rSet.DisableItem(SID_DRAW_BEZIER_NOFILL);
1222 rSet.ClearItem(SID_3D_CUBE);
1223 rSet.DisableItem(SID_3D_CUBE);
1224 rSet.ClearItem(SID_3D_SHELL);
1225 rSet.DisableItem(SID_3D_SHELL);
1226 rSet.ClearItem(SID_3D_SPHERE);
1227 rSet.DisableItem(SID_3D_SPHERE);
1228 rSet.ClearItem(SID_3D_HALF_SPHERE);
1229 rSet.DisableItem(SID_3D_HALF_SPHERE);
1230 rSet.ClearItem(SID_3D_CYLINDER);
1231 rSet.DisableItem(SID_3D_CYLINDER);
1232 rSet.ClearItem(SID_3D_CONE);
1233 rSet.DisableItem(SID_3D_CONE);
1234 rSet.ClearItem(SID_3D_TORUS);
1235 rSet.DisableItem(SID_3D_TORUS);
1236 rSet.ClearItem(SID_3D_PYRAMID);
1237 rSet.DisableItem(SID_3D_PYRAMID);
1240 // Sind die Module verfuegbar?
1242 if (!SvtModuleOptions().IsCalc())
1244 // remove menu entry if module is not available
1245 rSet.Put( SfxVisibilityItem( SID_ATTR_TABLE, sal_False ) );
1247 if (!SvtModuleOptions().IsChart())
1249 rSet.DisableItem( SID_INSERT_DIAGRAM );
1251 #ifdef STARIMAGE_AVAILABLE
1252 if (!(pApp->HasFeature(SFX_FEATURE_SIMAGE)))
1254 rSet.DisableItem( SID_INSERT_IMAGE );
1256 #endif
1257 if (!SvtModuleOptions().IsMath())
1259 rSet.DisableItem( SID_INSERT_MATH );
1262 rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
1263 if( (xSlideshow.is() && xSlideshow->isRunning() && (xSlideshow->getAnimationMode() != ANIMATIONMODE_PREVIEW) ) || GetDocSh()->IsPreview() )
1265 // Eigene Slots
1266 rSet.DisableItem( SID_PRESENTATION );
1267 rSet.DisableItem( SID_ZOOM_IN );
1268 rSet.DisableItem( SID_ZOOM_OUT );
1269 rSet.DisableItem( SID_ZOOM_PANNING );
1270 rSet.DisableItem( SID_ZOOM_NEXT );
1271 rSet.DisableItem( SID_ZOOM_PREV );
1272 rSet.DisableItem( SID_SIZE_REAL );
1273 rSet.DisableItem( SID_SIZE_OPTIMAL );
1274 rSet.DisableItem( SID_SIZE_ALL );
1275 rSet.DisableItem( SID_SIZE_PAGE_WIDTH );
1276 rSet.DisableItem( SID_SIZE_PAGE );
1277 rSet.DisableItem( SID_INSERTPAGE );
1278 rSet.DisableItem( SID_DUPLICATE_PAGE );
1279 rSet.DisableItem( SID_MODIFYPAGE );
1280 rSet.DisableItem( SID_RENAMEPAGE );
1281 rSet.DisableItem( SID_RENAMEPAGE_QUICK );
1282 rSet.DisableItem( SID_DELETE_PAGE );
1283 rSet.DisableItem( SID_PAGESETUP );
1285 if( xSlideshow.is() && xSlideshow->isRunning() )
1287 rSet.ClearItem(SID_OBJECT_ALIGN);
1288 rSet.ClearItem(SID_ZOOM_TOOLBOX);
1289 rSet.ClearItem(SID_OBJECT_CHOOSE_MODE);
1290 rSet.ClearItem(SID_DRAWTBX_TEXT);
1291 rSet.ClearItem(SID_DRAWTBX_RECTANGLES);
1292 rSet.ClearItem(SID_DRAWTBX_ELLIPSES);
1293 rSet.ClearItem(SID_DRAWTBX_LINES);
1294 rSet.ClearItem(SID_DRAWTBX_ARROWS);
1295 rSet.ClearItem(SID_DRAWTBX_3D_OBJECTS);
1296 rSet.ClearItem(SID_DRAWTBX_CONNECTORS);
1297 rSet.ClearItem(SID_OBJECT_CHOOSE_MODE );
1298 rSet.ClearItem(SID_DRAWTBX_INSERT);
1299 rSet.ClearItem(SID_INSERTFILE);
1300 rSet.ClearItem(SID_OBJECT_ROTATE);
1301 rSet.ClearItem(SID_OBJECT_ALIGN);
1302 rSet.ClearItem(SID_POSITION);
1303 rSet.ClearItem(SID_FM_CONFIG);
1304 rSet.ClearItem(SID_ANIMATION_EFFECTS);
1305 rSet.ClearItem(SID_ANIMATION_OBJECTS);
1306 rSet.ClearItem(SID_3D_WIN);
1308 rSet.DisableItem(SID_OBJECT_ALIGN);
1309 rSet.DisableItem(SID_ZOOM_TOOLBOX);
1310 rSet.DisableItem(SID_OBJECT_CHOOSE_MODE);
1311 rSet.DisableItem(SID_DRAWTBX_TEXT);
1312 rSet.DisableItem(SID_DRAWTBX_RECTANGLES);
1313 rSet.DisableItem(SID_DRAWTBX_ELLIPSES);
1314 rSet.DisableItem(SID_DRAWTBX_LINES);
1315 rSet.DisableItem(SID_DRAWTBX_ARROWS);
1316 rSet.DisableItem(SID_DRAWTBX_3D_OBJECTS);
1317 rSet.DisableItem(SID_DRAWTBX_CONNECTORS);
1318 rSet.DisableItem(SID_OBJECT_CHOOSE_MODE );
1319 rSet.DisableItem(SID_DRAWTBX_INSERT);
1320 rSet.DisableItem(SID_INSERTFILE);
1321 rSet.DisableItem(SID_OBJECT_ROTATE);
1322 rSet.DisableItem(SID_OBJECT_ALIGN);
1323 rSet.DisableItem(SID_POSITION);
1324 rSet.DisableItem(SID_FM_CONFIG);
1325 rSet.DisableItem(SID_ANIMATION_EFFECTS);
1326 rSet.DisableItem(SID_ANIMATION_OBJECTS);
1327 rSet.DisableItem(SID_3D_WIN);
1331 // #i102735# discussed with CL: removed for performance reasons
1332 #if 0
1333 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_SOUND ) ||
1334 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_VIDEO ) )
1336 ///////////////////////////////////////////////////////////////////////
1337 // Menuoption : Insert->Object->Sound and Insert->Object->Video
1338 // diable, if there isn't installed any appropriate plugin
1340 if (!SvxPluginFileDlg::IsAvailable (SID_INSERT_SOUND))
1341 rSet.DisableItem (SID_INSERT_SOUND);
1342 if (!SvxPluginFileDlg::IsAvailable (SID_INSERT_VIDEO))
1343 rSet.DisableItem (SID_INSERT_VIDEO);
1345 #endif
1347 ///////////////////////////////////////////////////////////////////////
1348 // Menuoption: Change->Convert->To Bitmap, Change->Convert->To Metafile
1349 // disable, if there only Bitmap or Metafiles marked
1350 // Menuoption: Format->Area, Format->Line
1351 // disabled, if the marked objects not able to handle
1352 // these attributes
1355 bool bSingleGraphicSelected = false;
1357 if (!mpDrawView->AreObjectsMarked())
1359 rSet.DisableItem (SID_CONVERT_TO_METAFILE);
1360 rSet.DisableItem (SID_CONVERT_TO_BITMAP);
1362 else
1364 // get marklist
1365 SdrMarkList aMarkList = mpDrawView->GetMarkedObjectList();
1367 BOOL bFoundBitmap = FALSE;
1368 BOOL bFoundMetafile = FALSE;
1369 BOOL bFoundObjNoLine = FALSE;
1370 BOOL bFoundObjNoArea = FALSE;
1371 BOOL bFoundNoGraphicObj = FALSE;
1372 BOOL bFoundAny = FALSE;
1373 bool bFoundTable = false;
1375 // const int nMarkCount = (int) aMarkList.GetMarkCount();
1376 for (ULONG i=0; i < nMarkCount && !bFoundAny; i++)
1378 SdrObject* pObj= aMarkList.GetMark(i)->GetMarkedSdrObj();
1379 UINT16 nId = pObj->GetObjIdentifier();
1380 UINT32 nInv = pObj->GetObjInventor();
1382 if(nInv == SdrInventor)
1384 // 2D objects
1385 switch( nId )
1387 case OBJ_PATHLINE :
1388 case OBJ_PLIN :
1389 case OBJ_LINE:
1390 case OBJ_FREELINE :
1391 case OBJ_EDGE:
1392 case OBJ_CARC :
1393 bFoundObjNoArea = TRUE;
1394 bFoundNoGraphicObj = TRUE;
1395 break;
1396 case OBJ_OLE2 :
1397 bFoundObjNoLine = TRUE;
1398 bFoundObjNoArea = TRUE;
1399 bFoundNoGraphicObj = TRUE;
1400 break;
1401 case OBJ_GRAF :
1402 bSingleGraphicSelected = nMarkCount == 1;
1403 switch ( ((SdrGrafObj*)pObj)->GetGraphicType() )
1405 case GRAPHIC_BITMAP :
1406 bFoundBitmap = TRUE;
1407 break;
1408 case GRAPHIC_GDIMETAFILE :
1409 bFoundMetafile = TRUE;
1410 break;
1411 default:
1412 break;
1415 // #i25616# bFoundObjNoLine = TRUE;
1416 // #i25616# bFoundObjNoArea = TRUE;
1417 break;
1418 case OBJ_TABLE:
1419 bFoundTable = true;
1420 break;
1421 default :
1422 bFoundAny = TRUE;
1425 else if(nInv == E3dInventor)
1427 // 3D objects
1428 bFoundAny = TRUE;
1432 if( bFoundTable )
1433 rSet.DisableItem( SID_ATTRIBUTES_LINE );
1435 if (!bFoundAny)
1437 // Disable menuitem for area-dialog
1438 if( bFoundObjNoArea ) // #i25616#
1439 rSet.DisableItem( SID_ATTRIBUTES_AREA );
1441 // Disable menuitem for line-dialog
1442 if( bFoundObjNoLine )
1443 rSet.DisableItem( SID_ATTRIBUTES_LINE );
1445 if( bFoundBitmap && !bFoundMetafile && !bFoundNoGraphicObj ) // only Bitmaps marked
1446 rSet.DisableItem( SID_CONVERT_TO_BITMAP );
1447 else if( !bFoundBitmap && bFoundMetafile && !bFoundNoGraphicObj ) // only Metafiles marked
1448 rSet.DisableItem( SID_CONVERT_TO_METAFILE );
1449 else if( !bFoundBitmap && !bFoundMetafile && !bFoundNoGraphicObj ) // nothing to do
1451 rSet.DisableItem( SID_CONVERT_TO_BITMAP );
1452 rSet.DisableItem( SID_CONVERT_TO_METAFILE );
1457 if( !bSingleGraphicSelected )
1459 rSet.DisableItem (SID_OBJECT_CROP);
1460 rSet.DisableItem (SID_ATTR_GRAF_CROP);
1463 // #96090# moved SID_UNDO to ViewShell::GetMenuState()
1464 // #96090# moved SID_REDO to ViewShell::GetMenuState()
1465 // #96090# moved SID_GETUNDOSTRINGS to ViewShell::GetMenuState()
1466 // #96090# moved SID_GETREDOSTRINGS to ViewShell::GetMenuState()
1468 ///////////////////////////////////////////////////////////////////////
1469 // Menuoption: Edit->Hyperlink
1470 // Disable, if there is no hyperlink
1472 sal_Bool bDisableEditHyperlink = sal_True;
1473 if( mpDrawView->AreObjectsMarked() && ( mpDrawView->GetMarkedObjectList().GetMarkCount() == 1 ) )
1475 if( mpDrawView->IsTextEdit() )
1477 OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
1478 if (pOLV)
1480 const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
1481 if (pFieldItem)
1483 ESelection aSel = pOLV->GetSelection();
1484 if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 )
1486 const SvxFieldData* pField = pFieldItem->GetField();
1487 if ( pField->ISA(SvxURLField) )
1488 bDisableEditHyperlink = sal_False;
1493 else
1495 SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj());
1497 if ( pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor() )
1499 uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel() );
1500 if( xControlModel.is() )
1502 uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY );
1503 if( xPropSet.is() )
1505 uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo() );
1506 if( xPropInfo.is() && xPropInfo->hasPropertyByName(
1507 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL"))))
1509 bDisableEditHyperlink = sal_False;
1517 //highlight selected custom shape
1519 USHORT nCurrentSId = 0;
1520 if(HasCurrentFunction())
1521 nCurrentSId = GetCurrentFunction()->GetSlotID();
1523 if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_BASIC ) )
1524 rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_BASIC, SID_DRAWTBX_CS_BASIC == nCurrentSId ));
1525 if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_SYMBOL ) )
1526 rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_SYMBOL, SID_DRAWTBX_CS_SYMBOL == nCurrentSId ));
1527 if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_ARROW ) )
1528 rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_ARROW, SID_DRAWTBX_CS_ARROW == nCurrentSId ));
1529 if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_FLOWCHART ) )
1530 rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_FLOWCHART, SID_DRAWTBX_CS_FLOWCHART == nCurrentSId ));
1531 if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_CALLOUT ) )
1532 rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_CALLOUT,SID_DRAWTBX_CS_CALLOUT == nCurrentSId ));
1533 if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_STAR ) )
1534 rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_STAR, SID_DRAWTBX_CS_STAR == nCurrentSId ));
1537 if ( bDisableEditHyperlink || GetDocSh()->IsReadOnly() )
1538 rSet.DisableItem( SID_EDIT_HYPERLINK );
1540 if ( bDisableEditHyperlink )
1541 rSet.DisableItem( SID_OPEN_HYPERLINK );
1543 #if defined WIN || defined WNT || defined UNX
1544 if( !mxScannerManager.is() )
1546 rSet.DisableItem( SID_TWAIN_SELECT );
1547 rSet.DisableItem( SID_TWAIN_TRANSFER );
1549 #endif
1551 // Fuer Win16
1552 #ifndef SOLAR_JAVA
1553 rSet.DisableItem( SID_INSERT_APPLET );
1554 #endif
1556 // Set the state of two entries in the 'Slide' context sub-menu
1557 // concerning the visibility of master page background and master page
1558 // shapes.
1559 if (rSet.GetItemState(SID_DISPLAY_MASTER_BACKGROUND) == SFX_ITEM_AVAILABLE
1560 || rSet.GetItemState(SID_DISPLAY_MASTER_OBJECTS) == SFX_ITEM_AVAILABLE)
1562 SdPage* pPage = GetActualPage();
1563 if (pPage != NULL
1564 && GetDoc() != NULL)
1566 SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
1567 SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
1568 BYTE aBackgroundId = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), FALSE);
1569 BYTE aObjectId = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), FALSE);
1570 rSet.Put(SfxBoolItem(SID_DISPLAY_MASTER_BACKGROUND,
1571 aVisibleLayers.IsSet(aBackgroundId)));
1572 rSet.Put(SfxBoolItem(SID_DISPLAY_MASTER_OBJECTS,
1573 aVisibleLayers.IsSet(aObjectId)));
1577 GetModeSwitchingMenuState (rSet);
1580 void DrawViewShell::GetModeSwitchingMenuState (SfxItemSet &rSet)
1582 //draview
1583 rSet.Put(SfxBoolItem(SID_DIAMODE, FALSE));
1584 rSet.Put(SfxBoolItem(SID_OUTLINEMODE, FALSE));
1585 if (mePageKind == PK_NOTES)
1587 rSet.Put(SfxBoolItem(SID_DRAWINGMODE, FALSE));
1588 rSet.Put(SfxBoolItem(SID_NOTESMODE, TRUE));
1589 rSet.Put(SfxBoolItem(SID_HANDOUTMODE, FALSE));
1591 else if (mePageKind == PK_HANDOUT)
1593 rSet.Put(SfxBoolItem(SID_DRAWINGMODE, FALSE));
1594 rSet.Put(SfxBoolItem(SID_NOTESMODE, FALSE));
1595 rSet.Put(SfxBoolItem(SID_HANDOUTMODE, TRUE));
1597 else
1599 rSet.Put(SfxBoolItem(SID_DRAWINGMODE, TRUE));
1600 rSet.Put(SfxBoolItem(SID_NOTESMODE, FALSE));
1601 rSet.Put(SfxBoolItem(SID_HANDOUTMODE, FALSE));
1604 // #101976# Removed [GetDocSh()->GetCurrentFunction() ||] from the following
1605 // clause because the current function of the docshell can only be
1606 // search and replace or spell checking and in that case switching the
1607 // view mode is allowed.
1608 const bool bIsRunning = SlideShow::IsRunning(GetViewShellBase());
1610 if (GetViewFrame()->GetFrame()->IsInPlace() || bIsRunning)
1612 if ( !GetViewFrame()->GetFrame()->IsInPlace() )
1614 rSet.ClearItem( SID_DRAWINGMODE );
1615 rSet.DisableItem( SID_DRAWINGMODE );
1618 rSet.ClearItem( SID_NOTESMODE );
1619 rSet.DisableItem( SID_NOTESMODE );
1621 rSet.ClearItem( SID_HANDOUTMODE );
1622 rSet.DisableItem( SID_HANDOUTMODE );
1624 rSet.ClearItem( SID_OUTLINEMODE );
1625 rSet.DisableItem( SID_OUTLINEMODE );
1627 rSet.ClearItem( SID_DIAMODE );
1628 rSet.DisableItem( SID_DIAMODE );
1631 if (GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED)
1633 // Outplace-Edit: Kein Umschalten erlauben
1634 rSet.ClearItem( SID_OUTLINEMODE );
1635 rSet.DisableItem( SID_OUTLINEMODE );
1637 rSet.ClearItem( SID_DIAMODE );
1638 rSet.DisableItem( SID_DIAMODE );
1640 rSet.ClearItem( SID_NOTESMODE );
1641 rSet.DisableItem( SID_NOTESMODE );
1643 rSet.ClearItem( SID_HANDOUTMODE );
1644 rSet.DisableItem( SID_HANDOUTMODE );
1647 svx::ExtrusionBar::getState( mpDrawView, rSet );
1648 svx::FontworkBar::getState( mpDrawView, rSet );
1653 void DrawViewShell::GetState (SfxItemSet& rSet)
1655 // Iterate over all requested items in the set.
1656 SfxWhichIter aIter( rSet );
1657 USHORT nWhich = aIter.FirstWhich();
1658 while (nWhich)
1660 switch (nWhich)
1662 case SID_SEARCH_ITEM:
1663 case SID_SEARCH_OPTIONS:
1664 // Forward this request to the the common (old) code of the
1665 // document shell.
1666 GetDocSh()->GetState (rSet);
1667 break;
1668 default:
1669 OSL_TRACE ("DrawViewShell::GetState(): can not handle which id %d", nWhich);
1670 break;
1672 nWhich = aIter.NextWhich();
1679 void DrawViewShell::Execute (SfxRequest& rReq)
1681 if(SlideShow::IsRunning(GetViewShellBase()))
1683 // Do not execute anything during a native slide show.
1684 return;
1687 switch (rReq.GetSlot())
1689 case SID_SEARCH_ITEM:
1690 // Forward this request to the the common (old) code of the
1691 // document shell.
1692 GetDocSh()->Execute (rReq);
1693 break;
1695 case SID_SPELL_DIALOG:
1697 SfxViewFrame* pViewFrame = GetViewFrame();
1698 if (rReq.GetArgs() != NULL)
1699 pViewFrame->SetChildWindow (SID_SPELL_DIALOG,
1700 ((const SfxBoolItem&) (rReq.GetArgs()->
1701 Get(SID_SPELL_DIALOG))).GetValue());
1702 else
1703 pViewFrame->ToggleChildWindow(SID_SPELL_DIALOG);
1705 pViewFrame->GetBindings().Invalidate(SID_SPELL_DIALOG);
1706 rReq.Ignore ();
1708 break;
1710 default:
1711 OSL_TRACE ("DrawViewShell::Execute(): can not handle slot %d", rReq.GetSlot());
1712 break;
1716 } // end of namespace sd