xref: /AOO41X/main/sd/source/ui/view/drviewsj.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sd.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "DrawViewShell.hxx"
32*cdf0e10cSrcweir #include <com/sun/star/embed/EmbedMisc.hpp>
33*cdf0e10cSrcweir #include <svl/aeitem.hxx>
34*cdf0e10cSrcweir #ifndef _SVXIDS_HRC //autogen
35*cdf0e10cSrcweir #include <svx/svxids.hrc>
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir #ifndef _GLOBL3D_HXX //autogen
38*cdf0e10cSrcweir #include <svx/globl3d.hxx>
39*cdf0e10cSrcweir #endif
40*cdf0e10cSrcweir #include <editeng/eeitem.hxx>
41*cdf0e10cSrcweir #ifndef _FLDITEM_HXX
42*cdf0e10cSrcweir #include <editeng/flditem.hxx>
43*cdf0e10cSrcweir #endif
44*cdf0e10cSrcweir #include <svx/svdogrp.hxx>
45*cdf0e10cSrcweir #include <svx/svdograf.hxx>
46*cdf0e10cSrcweir #include <svx/svdoole2.hxx>
47*cdf0e10cSrcweir #include <svx/sxelditm.hxx>
48*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
49*cdf0e10cSrcweir #include <sfx2/request.hxx>
50*cdf0e10cSrcweir #include <svx/svdopath.hxx>
51*cdf0e10cSrcweir #include <svx/polysc3d.hxx>
52*cdf0e10cSrcweir #include <svx/obj3d.hxx>
53*cdf0e10cSrcweir #include <sfx2/event.hxx>
54*cdf0e10cSrcweir #include <sfx2/docfile.hxx>
55*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir #include "app.hrc"
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir #include "Outliner.hxx"
61*cdf0e10cSrcweir #include "sdpage.hxx"
62*cdf0e10cSrcweir #include "fupoor.hxx"
63*cdf0e10cSrcweir #include "fusel.hxx"
64*cdf0e10cSrcweir #include "drawdoc.hxx"
65*cdf0e10cSrcweir #include "DrawDocShell.hxx"
66*cdf0e10cSrcweir #include "drawview.hxx"
67*cdf0e10cSrcweir #include "optsitem.hxx"
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir using namespace com::sun::star;
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir namespace sd {
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir /*************************************************************************
74*cdf0e10cSrcweir |*
75*cdf0e10cSrcweir |* Status (Enabled/Disabled) von Menue-SfxSlots setzen
76*cdf0e10cSrcweir |*
77*cdf0e10cSrcweir \************************************************************************/
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
80*cdf0e10cSrcweir {
81*cdf0e10cSrcweir 	// Status der Menueintraege, bzw. Buttons
82*cdf0e10cSrcweir 	// Einfachselektion
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir 	const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
85*cdf0e10cSrcweir 	sal_uLong nMarkCount = rMarkList.GetMarkCount();
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir 	if ( nMarkCount == 1 )
88*cdf0e10cSrcweir 	{
89*cdf0e10cSrcweir 		if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_BEZIER_EDIT ) ||
90*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_UNGROUP ) ||
91*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ENTER_GROUP ) ||
92*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_NAME_GROUP ) ||
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir 			// #i68101#
95*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_TITLE_DESCRIPTION ) ||
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_STYLE ) ||
98*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHANGEBEZIER ) ||
99*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHANGEPOLYGON ) ||
100*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_LINEEND_POLYGON ) ||
101*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( OBJ_TITLETEXT ) ||
102*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( OBJ_OUTLINETEXT ) ||
103*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MEASURE_DLG ) ||
104*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONNECTION_DLG ) ||
105*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONNECTION_NEW_ROUTING ) ||
106*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_3D_LATHE ) ||
107*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_3D_LATHE_FAST ) ||
108*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_SHEAR ) ||
109*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_1BIT_THRESHOLD ) ||
110*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_1BIT_MATRIX ) ||
111*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_4BIT_GRAYS ) ||
112*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_4BIT_COLORS ) ||
113*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_8BIT_GRAYS ) ||
114*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_8BIT_COLORS ) ||
115*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_24BIT ) ||
116*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_LEFT ) ||
117*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_CENTER ) ||
118*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_RIGHT ) ||
119*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_UP ) ||
120*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_MIDDLE ) ||
121*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_DOWN ) ||
122*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_FRAME_TO_TOP ) ||
123*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MOREFRONT ) ||
124*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MOREBACK ) ||
125*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_FRAME_TO_BOTTOM ) ||
126*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_BEFORE_OBJ ) ||
127*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_BEHIND_OBJ ) ||
128*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_REVERSE_ORDER ) ||
129*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ORIGINAL_SIZE ) ||
130*cdf0e10cSrcweir  			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SAVEGRAPHIC ) ||
131*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_TEXTATTR_DLG ) )
132*cdf0e10cSrcweir 		{
133*cdf0e10cSrcweir 			const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
134*cdf0e10cSrcweir 			sal_uInt32 nInv = pObj->GetObjInventor();
135*cdf0e10cSrcweir 			sal_uInt16 nId = pObj->GetObjIdentifier();
136*cdf0e10cSrcweir 			SdrObjTransformInfoRec aInfoRec;
137*cdf0e10cSrcweir 			pObj->TakeObjInfo( aInfoRec );
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir 			// #91929#; don't show original size entry if not possible
141*cdf0e10cSrcweir             if ( pObj->ISA( SdrOle2Obj ) )
142*cdf0e10cSrcweir 			{
143*cdf0e10cSrcweir 				SdrOle2Obj* pOleObj = PTR_CAST(SdrOle2Obj, pObj);
144*cdf0e10cSrcweir                 if (pOleObj->GetObjRef().is() &&
145*cdf0e10cSrcweir                     ((pOleObj->GetObjRef()->getStatus( pOleObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) ) )
146*cdf0e10cSrcweir 					rSet.DisableItem(SID_ORIGINAL_SIZE);
147*cdf0e10cSrcweir             }
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 			if ( !( pObj->ISA( SdrGrafObj ) ) )
150*cdf0e10cSrcweir 			{
151*cdf0e10cSrcweir 				rSet.DisableItem(SID_SAVEGRAPHIC);
152*cdf0e10cSrcweir 			}
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 			// Wenn es sich um kein Gruppenobjekt oder 3D-Objekt handelt
155*cdf0e10cSrcweir 			// wird "Gruppe betreten" disabled
156*cdf0e10cSrcweir 			if( !( ( pObj->ISA( SdrObjGroup ) && nInv == SdrInventor ) ||
157*cdf0e10cSrcweir 				(pObj->ISA (E3dPolyScene) || pObj->ISA (E3dScene) /*|| pObj->ISA (E3dCompoundObject) */) ) )
158*cdf0e10cSrcweir 			{
159*cdf0e10cSrcweir 				rSet.DisableItem( SID_ENTER_GROUP );
160*cdf0e10cSrcweir 			}
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 			// Wenn es sich um kein Gruppenobjekt handelt
163*cdf0e10cSrcweir 			// wird "Gruppierung aufheben" disabled
164*cdf0e10cSrcweir 			if (!(pObj->ISA(SdrObjGroup) && nInv == SdrInventor))
165*cdf0e10cSrcweir 			{
166*cdf0e10cSrcweir 				rSet.DisableItem(SID_UNGROUP);
167*cdf0e10cSrcweir 			}
168*cdf0e10cSrcweir /*
169*cdf0e10cSrcweir 			if (!pObj->ISA(SdrObjGroup) && !pObj->ISA(SdrGrafObj) && !pObj->ISA(SdrOle2Obj))
170*cdf0e10cSrcweir 			{
171*cdf0e10cSrcweir 				rSet.DisableItem( SID_NAME_GROUP );
172*cdf0e10cSrcweir 			}
173*cdf0e10cSrcweir */
174*cdf0e10cSrcweir 			if (!pObj->ISA(SdrGrafObj) ||
175*cdf0e10cSrcweir 				((SdrGrafObj*) pObj)->GetGraphicType() != GRAPHIC_BITMAP ||
176*cdf0e10cSrcweir 				((SdrGrafObj*) pObj)->IsLinkedGraphic())
177*cdf0e10cSrcweir 			{
178*cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_1BIT_THRESHOLD);
179*cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_1BIT_MATRIX);
180*cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_4BIT_GRAYS);
181*cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_4BIT_COLORS);
182*cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_8BIT_GRAYS);
183*cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_8BIT_COLORS);
184*cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_24BIT);
185*cdf0e10cSrcweir 			}
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir 			if( nInv == SdrInventor &&
188*cdf0e10cSrcweir 			   (nId == OBJ_LINE ||
189*cdf0e10cSrcweir 				nId == OBJ_PLIN ||
190*cdf0e10cSrcweir 				nId == OBJ_PATHLINE ||
191*cdf0e10cSrcweir 				nId == OBJ_FREELINE ))
192*cdf0e10cSrcweir 			{
193*cdf0e10cSrcweir 				//rSet.DisableItem( SID_ATTRIBUTES_AREA ); // wieder raus!
194*cdf0e10cSrcweir 				rSet.DisableItem( SID_ATTR_FILL_STYLE );
195*cdf0e10cSrcweir 			}
196*cdf0e10cSrcweir 			if( (!pObj->ISA( SdrPathObj ) && !aInfoRec.bCanConvToPath) || pObj->ISA( SdrObjGroup ) ) // Solange es JOE fehlerhaft behandelt!
197*cdf0e10cSrcweir 			{ // JOE: Ein Gruppenobjekt kann eben u.U. in ein PathObj gewandelt werden
198*cdf0e10cSrcweir 				rSet.DisableItem( SID_LINEEND_POLYGON );
199*cdf0e10cSrcweir 			}
200*cdf0e10cSrcweir 			if(nInv == SdrInventor &&
201*cdf0e10cSrcweir 			   (nId == OBJ_PATHFILL || nId == OBJ_PATHLINE || !aInfoRec.bCanConvToPath))
202*cdf0e10cSrcweir 				rSet.DisableItem( SID_CHANGEBEZIER );
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir 			if( nInv == SdrInventor &&
205*cdf0e10cSrcweir 				( nId == OBJ_POLY || nId == OBJ_PLIN || !aInfoRec.bCanConvToPoly ) &&
206*cdf0e10cSrcweir 				!GetView()->IsVectorizeAllowed() )
207*cdf0e10cSrcweir 			{
208*cdf0e10cSrcweir 				rSet.DisableItem( SID_CHANGEPOLYGON );
209*cdf0e10cSrcweir 			}
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 			if(nInv == SdrInventor && (nId == OBJ_TITLETEXT || nId == OBJ_OUTLINETEXT))
212*cdf0e10cSrcweir 				rSet.DisableItem( SID_TEXTATTR_DLG );
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 			if(nInv == SdrInventor && nId == OBJ_TABLE )
215*cdf0e10cSrcweir 			{
216*cdf0e10cSrcweir 				rSet.DisableItem( SID_TEXTATTR_DLG );
217*cdf0e10cSrcweir 			}
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir 			if( nInv != SdrInventor || nId != OBJ_MEASURE )
220*cdf0e10cSrcweir 				rSet.DisableItem( SID_MEASURE_DLG );
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 			if( nInv != SdrInventor || nId != OBJ_EDGE )
223*cdf0e10cSrcweir 				rSet.DisableItem( SID_CONNECTION_DLG );
224*cdf0e10cSrcweir 			else
225*cdf0e10cSrcweir 			{
226*cdf0e10cSrcweir 				sal_Bool bDisable = sal_True;
227*cdf0e10cSrcweir 				SfxItemSet aAttrSet( GetDoc()->GetPool() );
228*cdf0e10cSrcweir 				GetView()->GetAttributes( aAttrSet );
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir 				if( aAttrSet.GetItemState( SDRATTR_EDGELINE1DELTA ) >= SFX_ITEM_AVAILABLE &&
231*cdf0e10cSrcweir 					aAttrSet.GetItemState( SDRATTR_EDGELINE2DELTA ) >= SFX_ITEM_AVAILABLE &&
232*cdf0e10cSrcweir 					aAttrSet.GetItemState( SDRATTR_EDGELINE3DELTA ) >= SFX_ITEM_AVAILABLE )
233*cdf0e10cSrcweir 				{
234*cdf0e10cSrcweir 					long nVal1 = ( ( const SdrEdgeLine1DeltaItem& ) aAttrSet.Get( SDRATTR_EDGELINE1DELTA ) ).GetValue();
235*cdf0e10cSrcweir 					long nVal2 = ( ( const SdrEdgeLine2DeltaItem& ) aAttrSet.Get( SDRATTR_EDGELINE2DELTA ) ).GetValue();
236*cdf0e10cSrcweir 					long nVal3 = ( ( const SdrEdgeLine3DeltaItem& ) aAttrSet.Get( SDRATTR_EDGELINE3DELTA ) ).GetValue();
237*cdf0e10cSrcweir 					{
238*cdf0e10cSrcweir 						if( nVal1 != 0 || nVal2 != 0 || nVal3 != 0 )
239*cdf0e10cSrcweir 							bDisable = sal_False;
240*cdf0e10cSrcweir 					}
241*cdf0e10cSrcweir 				}
242*cdf0e10cSrcweir 				if( bDisable )
243*cdf0e10cSrcweir 					rSet.DisableItem( SID_CONNECTION_NEW_ROUTING );
244*cdf0e10cSrcweir 			}
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 			if ( nInv == E3dInventor                          ||
247*cdf0e10cSrcweir 				 (!mpDrawView->IsConvertToPathObjPossible(sal_False) &&
248*cdf0e10cSrcweir 				  !mpDrawView->IsShearAllowed()                  &&
249*cdf0e10cSrcweir 				  !mpDrawView->IsDistortAllowed()) )
250*cdf0e10cSrcweir 			{
251*cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_SHEAR );
252*cdf0e10cSrcweir 			}
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir 			if(pObj->ISA(E3dCompoundObject))
255*cdf0e10cSrcweir 			{
256*cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_LEFT );
257*cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_CENTER );
258*cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_RIGHT );
259*cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_UP );
260*cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_MIDDLE );
261*cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_DOWN );
262*cdf0e10cSrcweir 				rSet.DisableItem( SID_FRAME_TO_TOP );
263*cdf0e10cSrcweir 				rSet.DisableItem( SID_MOREFRONT );
264*cdf0e10cSrcweir 				rSet.DisableItem( SID_MOREBACK );
265*cdf0e10cSrcweir 				rSet.DisableItem( SID_FRAME_TO_BOTTOM );
266*cdf0e10cSrcweir 				rSet.DisableItem( SID_BEFORE_OBJ );
267*cdf0e10cSrcweir 				rSet.DisableItem( SID_BEHIND_OBJ );
268*cdf0e10cSrcweir 				rSet.DisableItem( SID_REVERSE_ORDER );
269*cdf0e10cSrcweir 			}
270*cdf0e10cSrcweir 		}
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir 		if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DISMANTLE ) ||
273*cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_BREAK ) )
274*cdf0e10cSrcweir 		{
275*cdf0e10cSrcweir 			if ( !mpDrawView->IsDismantlePossible(sal_False) )
276*cdf0e10cSrcweir 			{
277*cdf0e10cSrcweir 				rSet.DisableItem( SID_DISMANTLE );
278*cdf0e10cSrcweir 			}
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir 			if ( !mpDrawView->IsDismantlePossible(sal_True) &&
281*cdf0e10cSrcweir 				 !mpDrawView->IsImportMtfPossible()     &&
282*cdf0e10cSrcweir 				 !mpDrawView->IsBreak3DObjPossible() )
283*cdf0e10cSrcweir 			{
284*cdf0e10cSrcweir 				rSet.DisableItem( SID_BREAK );
285*cdf0e10cSrcweir 			}
286*cdf0e10cSrcweir 		}
287*cdf0e10cSrcweir 		if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MODIFY_FIELD ) )
288*cdf0e10cSrcweir 		{
289*cdf0e10cSrcweir 			OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir 			if( pOLV )
292*cdf0e10cSrcweir 			{
293*cdf0e10cSrcweir 				const SvxFieldItem* pFldItem = pOLV->GetFieldAtSelection();
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 				if( !( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
296*cdf0e10cSrcweir 								 pFldItem->GetField()->ISA( SvxAuthorField ) ||
297*cdf0e10cSrcweir 								 pFldItem->GetField()->ISA( SvxExtFileField ) ||
298*cdf0e10cSrcweir 								 pFldItem->GetField()->ISA( SvxExtTimeField ) ) ) )
299*cdf0e10cSrcweir 				{
300*cdf0e10cSrcweir 					rSet.DisableItem( SID_MODIFY_FIELD );
301*cdf0e10cSrcweir 				}
302*cdf0e10cSrcweir 			}
303*cdf0e10cSrcweir 			else
304*cdf0e10cSrcweir 				rSet.DisableItem( SID_MODIFY_FIELD );
305*cdf0e10cSrcweir 		}
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir 		rSet.DisableItem( SID_GROUP );
308*cdf0e10cSrcweir 		rSet.DisableItem( SID_COMBINE );
309*cdf0e10cSrcweir         rSet.DisableItem(SID_DISTRIBUTE_DLG);
310*cdf0e10cSrcweir         rSet.DisableItem(SID_POLY_MERGE);
311*cdf0e10cSrcweir         rSet.DisableItem(SID_POLY_SUBSTRACT);
312*cdf0e10cSrcweir         rSet.DisableItem(SID_POLY_INTERSECT);
313*cdf0e10cSrcweir 		rSet.DisableItem( SID_CONNECT );
314*cdf0e10cSrcweir 	}
315*cdf0e10cSrcweir 	// Mehrfachselektion
316*cdf0e10cSrcweir 	else if( nMarkCount > 1 )
317*cdf0e10cSrcweir 	{
318*cdf0e10cSrcweir 		// distribure dialog for 3+n objects
319*cdf0e10cSrcweir 		if(nMarkCount <= 2)
320*cdf0e10cSrcweir 			rSet.DisableItem(SID_DISTRIBUTE_DLG);
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir //        rSet.ClearItem( SID_BEZIER_EDIT );
323*cdf0e10cSrcweir //        rSet.DisableItem( SID_BEZIER_EDIT );
324*cdf0e10cSrcweir 		rSet.DisableItem( SID_LINEEND_POLYGON );
325*cdf0e10cSrcweir 		rSet.DisableItem( SID_ENTER_GROUP );
326*cdf0e10cSrcweir 		// Jetzt (28.10.96) muessen Namen fuer Objekte eindeutig sein
327*cdf0e10cSrcweir 		rSet.DisableItem( SID_NAME_GROUP );
328*cdf0e10cSrcweir 		// #i68101#
329*cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_TITLE_DESCRIPTION );
330*cdf0e10cSrcweir 		rSet.DisableItem( SID_MODIFY_FIELD );
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir 		if( 1 )
333*cdf0e10cSrcweir //		if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_STYLE ) ||
334*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_UNGROUP ) ||
335*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MEASURE_DLG ) ||
336*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONNECTION_DLG ) ||
337*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_COMBINE ) ||
338*cdf0e10cSrcweir //            SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_SHEAR ) ||
339*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_TEXTATTR_DLG ) ||
340*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_3D_LATHE ) ||
341*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_3D_LATHE_FAST ) ||
342*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_LEFT ) ||
343*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_CENTER ) ||
344*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_RIGHT ) ||
345*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_UP ) ||
346*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_MIDDLE ) ||
347*cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_DOWN ) )
348*cdf0e10cSrcweir 		{
349*cdf0e10cSrcweir 			sal_Bool bText = sal_False;
350*cdf0e10cSrcweir 			sal_Bool bLine = sal_False;
351*cdf0e10cSrcweir 			sal_Bool bGroup = sal_False;
352*cdf0e10cSrcweir 			sal_Bool bGraf = sal_False;
353*cdf0e10cSrcweir 			sal_Bool bDrawObj = sal_False;
354*cdf0e10cSrcweir 			sal_Bool b3dObj = sal_False;
355*cdf0e10cSrcweir 			sal_Bool bTitOutText = sal_False;
356*cdf0e10cSrcweir 			bool bTable = false;
357*cdf0e10cSrcweir 			sal_Bool bMeasureObj = sal_False;
358*cdf0e10cSrcweir 			sal_Bool bEdgeObj = sal_False; // Connector
359*cdf0e10cSrcweir 			sal_Bool bE3dCompoundObject = sal_False;
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir 			for( sal_uLong i = 0;
362*cdf0e10cSrcweir 				 i < nMarkCount && !bText && i < 50;
363*cdf0e10cSrcweir 				 i++ )
364*cdf0e10cSrcweir 			{
365*cdf0e10cSrcweir 				SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
366*cdf0e10cSrcweir 				sal_uInt32 nInv = pObj->GetObjInventor();
367*cdf0e10cSrcweir 				sal_uInt16 nId = pObj->GetObjIdentifier();
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir 				if (nInv == SdrInventor)
370*cdf0e10cSrcweir 				{
371*cdf0e10cSrcweir 					switch (nId)
372*cdf0e10cSrcweir 					{
373*cdf0e10cSrcweir 						case OBJ_TEXT: bText = sal_True; break;
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir 						case OBJ_LINE: bLine = sal_True; break;
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir 						case OBJ_EDGE: bEdgeObj = sal_True; break;
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir 						case OBJ_MEASURE: bMeasureObj = sal_True; break;
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 						case OBJ_RECT:
382*cdf0e10cSrcweir 						case OBJ_CIRC:
383*cdf0e10cSrcweir 						case OBJ_FREELINE:
384*cdf0e10cSrcweir 						case OBJ_FREEFILL:
385*cdf0e10cSrcweir 						case OBJ_PATHFILL:
386*cdf0e10cSrcweir 						case OBJ_PATHLINE:
387*cdf0e10cSrcweir 						case OBJ_SECT:
388*cdf0e10cSrcweir 						case OBJ_CARC:
389*cdf0e10cSrcweir 						case OBJ_CCUT: bDrawObj = sal_True; break;
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir 						case OBJ_GRUP: bGroup = sal_True; break;
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir 						case OBJ_GRAF: bGraf = sal_True; break;
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir 						case OBJ_TITLETEXT:
396*cdf0e10cSrcweir 						case OBJ_OUTLINETEXT: bTitOutText = sal_True; break;
397*cdf0e10cSrcweir 						case OBJ_TABLE: bTable = true; break;
398*cdf0e10cSrcweir 					}
399*cdf0e10cSrcweir 				}
400*cdf0e10cSrcweir 				else if (nInv == E3dInventor)
401*cdf0e10cSrcweir 				{
402*cdf0e10cSrcweir 					if(pObj->ISA(E3dScene))
403*cdf0e10cSrcweir 						b3dObj = sal_True;
404*cdf0e10cSrcweir 					else if(pObj->ISA(E3dCompoundObject))
405*cdf0e10cSrcweir 						bE3dCompoundObject = sal_True;
406*cdf0e10cSrcweir 				}
407*cdf0e10cSrcweir 			}
408*cdf0e10cSrcweir 			/* Kann wohl raus, da jedes(?) Objekt Text enthalten kann
409*cdf0e10cSrcweir 			if( !bText )
410*cdf0e10cSrcweir 			{
411*cdf0e10cSrcweir 				rSet.DisableItem( SID_CHAR_DLG );
412*cdf0e10cSrcweir 				rSet.DisableItem( SID_PARA_DLG );
413*cdf0e10cSrcweir 				rSet.DisableItem( SID_CHARMAP );
414*cdf0e10cSrcweir 			}
415*cdf0e10cSrcweir 			*/
416*cdf0e10cSrcweir 			if( bLine && !bText && !bDrawObj &&!b3dObj)
417*cdf0e10cSrcweir 			{
418*cdf0e10cSrcweir 				//rSet.DisableItem( SID_ATTRIBUTES_AREA );
419*cdf0e10cSrcweir 				rSet.DisableItem( SID_ATTR_FILL_STYLE );
420*cdf0e10cSrcweir 			}
421*cdf0e10cSrcweir 			if( !bEdgeObj )
422*cdf0e10cSrcweir 				rSet.DisableItem( SID_CONNECTION_DLG );
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir 			if (b3dObj)
425*cdf0e10cSrcweir 			{
426*cdf0e10cSrcweir 				rSet.DisableItem( SID_COMBINE );
427*cdf0e10cSrcweir 				rSet.DisableItem(SID_POLY_MERGE);
428*cdf0e10cSrcweir 				rSet.DisableItem(SID_POLY_SUBSTRACT);
429*cdf0e10cSrcweir 				rSet.DisableItem(SID_POLY_INTERSECT);
430*cdf0e10cSrcweir 			}
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir 			if (b3dObj                                        ||
433*cdf0e10cSrcweir 				 (!mpDrawView->IsConvertToPathObjPossible(sal_False) &&
434*cdf0e10cSrcweir 				  !mpDrawView->IsShearAllowed()                  &&
435*cdf0e10cSrcweir 				  !mpDrawView->IsDistortAllowed()) )
436*cdf0e10cSrcweir 			{
437*cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_SHEAR );
438*cdf0e10cSrcweir 			}
439*cdf0e10cSrcweir 
440*cdf0e10cSrcweir 			if( !bGroup )
441*cdf0e10cSrcweir 			{
442*cdf0e10cSrcweir 				rSet.DisableItem( SID_UNGROUP );
443*cdf0e10cSrcweir 			}
444*cdf0e10cSrcweir 			if( bTitOutText || bTable )
445*cdf0e10cSrcweir 				rSet.DisableItem( SID_TEXTATTR_DLG );
446*cdf0e10cSrcweir 
447*cdf0e10cSrcweir 			if( !bMeasureObj )
448*cdf0e10cSrcweir 				rSet.DisableItem( SID_MEASURE_DLG );
449*cdf0e10cSrcweir 
450*cdf0e10cSrcweir 			if (!bGraf)
451*cdf0e10cSrcweir 			{
452*cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_1BIT_THRESHOLD);
453*cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_1BIT_MATRIX);
454*cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_4BIT_GRAYS);
455*cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_4BIT_COLORS);
456*cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_8BIT_GRAYS);
457*cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_8BIT_COLORS);
458*cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_24BIT);
459*cdf0e10cSrcweir 			}
460*cdf0e10cSrcweir 
461*cdf0e10cSrcweir 			if(bE3dCompoundObject)
462*cdf0e10cSrcweir 			{
463*cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_LEFT );
464*cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_CENTER );
465*cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_RIGHT );
466*cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_UP );
467*cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_MIDDLE );
468*cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_DOWN );
469*cdf0e10cSrcweir 				rSet.DisableItem( SID_FRAME_TO_TOP );
470*cdf0e10cSrcweir 				rSet.DisableItem( SID_MOREFRONT );
471*cdf0e10cSrcweir 				rSet.DisableItem( SID_MOREBACK );
472*cdf0e10cSrcweir 				rSet.DisableItem( SID_FRAME_TO_BOTTOM );
473*cdf0e10cSrcweir 				rSet.DisableItem( SID_BEFORE_OBJ );
474*cdf0e10cSrcweir 				rSet.DisableItem( SID_BEHIND_OBJ );
475*cdf0e10cSrcweir 				rSet.DisableItem( SID_REVERSE_ORDER );
476*cdf0e10cSrcweir 			}
477*cdf0e10cSrcweir 		}
478*cdf0e10cSrcweir 
479*cdf0e10cSrcweir 		if ( !mpDrawView->IsDismantlePossible(sal_False) )
480*cdf0e10cSrcweir 		{
481*cdf0e10cSrcweir 			rSet.DisableItem( SID_DISMANTLE );
482*cdf0e10cSrcweir 		}
483*cdf0e10cSrcweir 		if ( !mpDrawView->IsDismantlePossible(sal_True) &&
484*cdf0e10cSrcweir 			 !mpDrawView->IsImportMtfPossible()     &&
485*cdf0e10cSrcweir 			 !mpDrawView->IsBreak3DObjPossible() )
486*cdf0e10cSrcweir 		{
487*cdf0e10cSrcweir 			rSet.DisableItem( SID_BREAK );
488*cdf0e10cSrcweir 		}
489*cdf0e10cSrcweir 		if ( !mpDrawView->IsCombinePossible(sal_False) )
490*cdf0e10cSrcweir 		{
491*cdf0e10cSrcweir 			rSet.DisableItem( SID_COMBINE );
492*cdf0e10cSrcweir 			rSet.DisableItem(SID_POLY_MERGE);
493*cdf0e10cSrcweir 			rSet.DisableItem(SID_POLY_SUBSTRACT);
494*cdf0e10cSrcweir 			rSet.DisableItem(SID_POLY_INTERSECT);
495*cdf0e10cSrcweir 		}
496*cdf0e10cSrcweir 		if ( !mpDrawView->IsCombinePossible(sal_True) )
497*cdf0e10cSrcweir 		{
498*cdf0e10cSrcweir 			rSet.DisableItem( SID_CONNECT );
499*cdf0e10cSrcweir 		}
500*cdf0e10cSrcweir 		if ( !mpDrawView->IsGroupPossible() )
501*cdf0e10cSrcweir 		{
502*cdf0e10cSrcweir 			rSet.DisableItem( SID_GROUP );
503*cdf0e10cSrcweir 		}
504*cdf0e10cSrcweir 		if ( !mpDrawView->IsUnGroupPossible() )
505*cdf0e10cSrcweir 		{
506*cdf0e10cSrcweir 			rSet.DisableItem( SID_UNGROUP );
507*cdf0e10cSrcweir 		}
508*cdf0e10cSrcweir 	}
509*cdf0e10cSrcweir 	// kein Objekt selektiert
510*cdf0e10cSrcweir 	else
511*cdf0e10cSrcweir 	{
512*cdf0e10cSrcweir //        rSet.ClearItem( SID_BEZIER_EDIT );
513*cdf0e10cSrcweir 
514*cdf0e10cSrcweir 		rSet.DisableItem( SID_ENTER_GROUP );
515*cdf0e10cSrcweir 		rSet.DisableItem( SID_CUT );
516*cdf0e10cSrcweir 		rSet.DisableItem( SID_COPY );
517*cdf0e10cSrcweir 		rSet.DisableItem( SID_DELETE );
518*cdf0e10cSrcweir 		rSet.DisableItem( SID_ATTR_TRANSFORM );
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_ALIGN_LEFT );
521*cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_ALIGN_CENTER );
522*cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_ALIGN_RIGHT );
523*cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_ALIGN_UP );
524*cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_ALIGN_MIDDLE );
525*cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_ALIGN_DOWN );
526*cdf0e10cSrcweir 
527*cdf0e10cSrcweir 		rSet.DisableItem( SID_FRAME_TO_TOP );
528*cdf0e10cSrcweir 		rSet.DisableItem( SID_MOREFRONT );
529*cdf0e10cSrcweir 		rSet.DisableItem( SID_MOREBACK );
530*cdf0e10cSrcweir 		rSet.DisableItem( SID_FRAME_TO_BOTTOM );
531*cdf0e10cSrcweir 		rSet.DisableItem( SID_BEFORE_OBJ );
532*cdf0e10cSrcweir 		rSet.DisableItem( SID_BEHIND_OBJ );
533*cdf0e10cSrcweir 		rSet.DisableItem( SID_CONVERT );
534*cdf0e10cSrcweir 
535*cdf0e10cSrcweir //		rSet.DisableItem( SID_BEZIER_EDIT );
536*cdf0e10cSrcweir 		rSet.DisableItem( SID_SIZE_OPTIMAL );
537*cdf0e10cSrcweir 		rSet.DisableItem( SID_LINEEND_POLYGON );
538*cdf0e10cSrcweir 		rSet.DisableItem( SID_COPYOBJECTS );
539*cdf0e10cSrcweir 		rSet.DisableItem( SID_HORIZONTAL );
540*cdf0e10cSrcweir 		rSet.DisableItem( SID_VERTICAL );
541*cdf0e10cSrcweir 		rSet.DisableItem( SID_GROUP );
542*cdf0e10cSrcweir 		rSet.DisableItem( SID_UNGROUP );
543*cdf0e10cSrcweir 		rSet.DisableItem( SID_NAME_GROUP );
544*cdf0e10cSrcweir 
545*cdf0e10cSrcweir 		// #i68101#
546*cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_TITLE_DESCRIPTION );
547*cdf0e10cSrcweir 
548*cdf0e10cSrcweir 		rSet.DisableItem( SID_DISMANTLE );
549*cdf0e10cSrcweir 		rSet.DisableItem( SID_BREAK );
550*cdf0e10cSrcweir 		rSet.DisableItem( SID_COMBINE );
551*cdf0e10cSrcweir         rSet.DisableItem(SID_DISTRIBUTE_DLG);
552*cdf0e10cSrcweir         rSet.DisableItem(SID_POLY_MERGE);
553*cdf0e10cSrcweir         rSet.DisableItem(SID_POLY_SUBSTRACT);
554*cdf0e10cSrcweir         rSet.DisableItem(SID_POLY_INTERSECT);
555*cdf0e10cSrcweir 		rSet.DisableItem( SID_CONNECT );
556*cdf0e10cSrcweir 		rSet.DisableItem( SID_ANIMATION_EFFECTS );
557*cdf0e10cSrcweir 		rSet.DisableItem( SID_MODIFY_FIELD );
558*cdf0e10cSrcweir 		rSet.DisableItem (SID_OBJECT_SHEAR);
559*cdf0e10cSrcweir 	}
560*cdf0e10cSrcweir 
561*cdf0e10cSrcweir }
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir 
564*cdf0e10cSrcweir } // end of namespace sd
565