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