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