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