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