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