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