xref: /aoo41x/main/sd/source/ui/view/drviewsj.cxx (revision ee093554)
15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
105b190011SAndrew Rist  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
195b190011SAndrew Rist  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
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 
GetMenuStateSel(SfxItemSet & rSet)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 ) ||
94d5370dc8SArmin Le Grand 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_TRANSPARENCE ) ||
95d5370dc8SArmin Le Grand 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_FLOATTRANSPARENCE ) ||
96cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHANGEBEZIER ) ||
97cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHANGEPOLYGON ) ||
98cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_LINEEND_POLYGON ) ||
99cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( OBJ_TITLETEXT ) ||
100cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( OBJ_OUTLINETEXT ) ||
101cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MEASURE_DLG ) ||
102cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONNECTION_DLG ) ||
103cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONNECTION_NEW_ROUTING ) ||
104cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_3D_LATHE ) ||
105cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_3D_LATHE_FAST ) ||
106cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_SHEAR ) ||
107cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_1BIT_THRESHOLD ) ||
108cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_1BIT_MATRIX ) ||
109cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_4BIT_GRAYS ) ||
110cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_4BIT_COLORS ) ||
111cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_8BIT_GRAYS ) ||
112cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_8BIT_COLORS ) ||
113cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_24BIT ) ||
114cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_LEFT ) ||
115cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_CENTER ) ||
116cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_RIGHT ) ||
117cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_UP ) ||
118cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_MIDDLE ) ||
119cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_DOWN ) ||
120cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_FRAME_TO_TOP ) ||
121cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MOREFRONT ) ||
122cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MOREBACK ) ||
123cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_FRAME_TO_BOTTOM ) ||
124cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_BEFORE_OBJ ) ||
125cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_BEHIND_OBJ ) ||
126cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_REVERSE_ORDER ) ||
127cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ORIGINAL_SIZE ) ||
128cdf0e10cSrcweir  			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SAVEGRAPHIC ) ||
129cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_TEXTATTR_DLG ) )
130cdf0e10cSrcweir 		{
131cdf0e10cSrcweir 			const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
132ddde725dSArmin Le Grand             const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj);
133ddde725dSArmin Le Grand             const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pObj);
134cdf0e10cSrcweir 			sal_uInt32 nInv = pObj->GetObjInventor();
135cdf0e10cSrcweir 			sal_uInt16 nId = pObj->GetObjIdentifier();
136cdf0e10cSrcweir 			SdrObjTransformInfoRec aInfoRec;
137cdf0e10cSrcweir 			pObj->TakeObjInfo( aInfoRec );
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 			// #91929#; don't show original size entry if not possible
140ddde725dSArmin Le Grand             if(pSdrOle2Obj)
141cdf0e10cSrcweir 			{
142ddde725dSArmin Le Grand                 if (pSdrOle2Obj->GetObjRef().is() &&
143ddde725dSArmin Le Grand                     ((pSdrOle2Obj->GetObjRef()->getStatus( pSdrOle2Obj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) ) )
144cdf0e10cSrcweir 					rSet.DisableItem(SID_ORIGINAL_SIZE);
145cdf0e10cSrcweir             }
146cdf0e10cSrcweir 
147ddde725dSArmin Le Grand 			if(!pSdrGrafObj)
148cdf0e10cSrcweir 			{
149cdf0e10cSrcweir 				rSet.DisableItem(SID_SAVEGRAPHIC);
150cdf0e10cSrcweir 			}
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 			// Wenn es sich um kein Gruppenobjekt oder 3D-Objekt handelt
153cdf0e10cSrcweir 			// wird "Gruppe betreten" disabled
154cdf0e10cSrcweir 			if( !( ( pObj->ISA( SdrObjGroup ) && nInv == SdrInventor ) ||
155cdf0e10cSrcweir 				(pObj->ISA (E3dPolyScene) || pObj->ISA (E3dScene) /*|| pObj->ISA (E3dCompoundObject) */) ) )
156cdf0e10cSrcweir 			{
157cdf0e10cSrcweir 				rSet.DisableItem( SID_ENTER_GROUP );
158cdf0e10cSrcweir 			}
159cdf0e10cSrcweir 
160cdf0e10cSrcweir 			// Wenn es sich um kein Gruppenobjekt handelt
161cdf0e10cSrcweir 			// wird "Gruppierung aufheben" disabled
162cdf0e10cSrcweir 			if (!(pObj->ISA(SdrObjGroup) && nInv == SdrInventor))
163cdf0e10cSrcweir 			{
164cdf0e10cSrcweir 				rSet.DisableItem(SID_UNGROUP);
165cdf0e10cSrcweir 			}
166cdf0e10cSrcweir /*
167cdf0e10cSrcweir 			if (!pObj->ISA(SdrObjGroup) && !pObj->ISA(SdrGrafObj) && !pObj->ISA(SdrOle2Obj))
168cdf0e10cSrcweir 			{
169cdf0e10cSrcweir 				rSet.DisableItem( SID_NAME_GROUP );
170cdf0e10cSrcweir 			}
171cdf0e10cSrcweir */
172ddde725dSArmin Le Grand 			if(!pSdrGrafObj ||
173ddde725dSArmin Le Grand 				pSdrGrafObj->GetGraphicType() != GRAPHIC_BITMAP ||
174ddde725dSArmin Le Grand 				pSdrGrafObj->IsLinkedGraphic() ||
175ddde725dSArmin Le Grand                 pSdrGrafObj->isEmbeddedSvg())
176cdf0e10cSrcweir 			{
177cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_1BIT_THRESHOLD);
178cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_1BIT_MATRIX);
179cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_4BIT_GRAYS);
180cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_4BIT_COLORS);
181cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_8BIT_GRAYS);
182cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_8BIT_COLORS);
183cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_24BIT);
184cdf0e10cSrcweir 			}
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 			if( nInv == SdrInventor &&
187cdf0e10cSrcweir 			   (nId == OBJ_LINE ||
188cdf0e10cSrcweir 				nId == OBJ_PLIN ||
189cdf0e10cSrcweir 				nId == OBJ_PATHLINE ||
190cdf0e10cSrcweir 				nId == OBJ_FREELINE ))
191cdf0e10cSrcweir 			{
192cdf0e10cSrcweir 				//rSet.DisableItem( SID_ATTRIBUTES_AREA ); // wieder raus!
193cdf0e10cSrcweir 				rSet.DisableItem( SID_ATTR_FILL_STYLE );
194d5370dc8SArmin Le Grand 				rSet.DisableItem( SID_ATTR_FILL_TRANSPARENCE );
195d5370dc8SArmin Le Grand 				rSet.DisableItem( SID_ATTR_FILL_FLOATTRANSPARENCE );
196cdf0e10cSrcweir 			}
197cdf0e10cSrcweir 			if( (!pObj->ISA( SdrPathObj ) && !aInfoRec.bCanConvToPath) || pObj->ISA( SdrObjGroup ) ) // Solange es JOE fehlerhaft behandelt!
198cdf0e10cSrcweir 			{ // JOE: Ein Gruppenobjekt kann eben u.U. in ein PathObj gewandelt werden
199cdf0e10cSrcweir 				rSet.DisableItem( SID_LINEEND_POLYGON );
200cdf0e10cSrcweir 			}
201cdf0e10cSrcweir 			if(nInv == SdrInventor &&
202cdf0e10cSrcweir 			   (nId == OBJ_PATHFILL || nId == OBJ_PATHLINE || !aInfoRec.bCanConvToPath))
203cdf0e10cSrcweir 				rSet.DisableItem( SID_CHANGEBEZIER );
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 			if( nInv == SdrInventor &&
206cdf0e10cSrcweir 				( nId == OBJ_POLY || nId == OBJ_PLIN || !aInfoRec.bCanConvToPoly ) &&
207cdf0e10cSrcweir 				!GetView()->IsVectorizeAllowed() )
208cdf0e10cSrcweir 			{
209cdf0e10cSrcweir 				rSet.DisableItem( SID_CHANGEPOLYGON );
210cdf0e10cSrcweir 			}
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 			if(nInv == SdrInventor && nId == OBJ_TABLE )
213cdf0e10cSrcweir 			{
214cdf0e10cSrcweir 				rSet.DisableItem( SID_TEXTATTR_DLG );
215cdf0e10cSrcweir 			}
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 			if( nInv != SdrInventor || nId != OBJ_MEASURE )
218cdf0e10cSrcweir 				rSet.DisableItem( SID_MEASURE_DLG );
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 			if( nInv != SdrInventor || nId != OBJ_EDGE )
221cdf0e10cSrcweir 				rSet.DisableItem( SID_CONNECTION_DLG );
222cdf0e10cSrcweir 			else
223cdf0e10cSrcweir 			{
224cdf0e10cSrcweir 				sal_Bool bDisable = sal_True;
225cdf0e10cSrcweir 				SfxItemSet aAttrSet( GetDoc()->GetPool() );
226cdf0e10cSrcweir 				GetView()->GetAttributes( aAttrSet );
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 				if( aAttrSet.GetItemState( SDRATTR_EDGELINE1DELTA ) >= SFX_ITEM_AVAILABLE &&
229cdf0e10cSrcweir 					aAttrSet.GetItemState( SDRATTR_EDGELINE2DELTA ) >= SFX_ITEM_AVAILABLE &&
230cdf0e10cSrcweir 					aAttrSet.GetItemState( SDRATTR_EDGELINE3DELTA ) >= SFX_ITEM_AVAILABLE )
231cdf0e10cSrcweir 				{
232cdf0e10cSrcweir 					long nVal1 = ( ( const SdrEdgeLine1DeltaItem& ) aAttrSet.Get( SDRATTR_EDGELINE1DELTA ) ).GetValue();
233cdf0e10cSrcweir 					long nVal2 = ( ( const SdrEdgeLine2DeltaItem& ) aAttrSet.Get( SDRATTR_EDGELINE2DELTA ) ).GetValue();
234cdf0e10cSrcweir 					long nVal3 = ( ( const SdrEdgeLine3DeltaItem& ) aAttrSet.Get( SDRATTR_EDGELINE3DELTA ) ).GetValue();
235cdf0e10cSrcweir 					{
236cdf0e10cSrcweir 						if( nVal1 != 0 || nVal2 != 0 || nVal3 != 0 )
237cdf0e10cSrcweir 							bDisable = sal_False;
238cdf0e10cSrcweir 					}
239cdf0e10cSrcweir 				}
240cdf0e10cSrcweir 				if( bDisable )
241cdf0e10cSrcweir 					rSet.DisableItem( SID_CONNECTION_NEW_ROUTING );
242cdf0e10cSrcweir 			}
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 			if ( nInv == E3dInventor                          ||
245cdf0e10cSrcweir 				 (!mpDrawView->IsConvertToPathObjPossible(sal_False) &&
246cdf0e10cSrcweir 				  !mpDrawView->IsShearAllowed()                  &&
247cdf0e10cSrcweir 				  !mpDrawView->IsDistortAllowed()) )
248cdf0e10cSrcweir 			{
249cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_SHEAR );
250cdf0e10cSrcweir 			}
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 			if(pObj->ISA(E3dCompoundObject))
253cdf0e10cSrcweir 			{
254cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_LEFT );
255cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_CENTER );
256cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_RIGHT );
257cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_UP );
258cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_MIDDLE );
259cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_DOWN );
260cdf0e10cSrcweir 				rSet.DisableItem( SID_FRAME_TO_TOP );
261cdf0e10cSrcweir 				rSet.DisableItem( SID_MOREFRONT );
262cdf0e10cSrcweir 				rSet.DisableItem( SID_MOREBACK );
263cdf0e10cSrcweir 				rSet.DisableItem( SID_FRAME_TO_BOTTOM );
264cdf0e10cSrcweir 				rSet.DisableItem( SID_BEFORE_OBJ );
265cdf0e10cSrcweir 				rSet.DisableItem( SID_BEHIND_OBJ );
266cdf0e10cSrcweir 				rSet.DisableItem( SID_REVERSE_ORDER );
267cdf0e10cSrcweir 			}
268cdf0e10cSrcweir 		}
269cdf0e10cSrcweir 
270cdf0e10cSrcweir 		if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DISMANTLE ) ||
271cdf0e10cSrcweir 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_BREAK ) )
272cdf0e10cSrcweir 		{
273cdf0e10cSrcweir 			if ( !mpDrawView->IsDismantlePossible(sal_False) )
274cdf0e10cSrcweir 			{
275cdf0e10cSrcweir 				rSet.DisableItem( SID_DISMANTLE );
276cdf0e10cSrcweir 			}
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 			if ( !mpDrawView->IsDismantlePossible(sal_True) &&
279cdf0e10cSrcweir 				 !mpDrawView->IsImportMtfPossible()     &&
280cdf0e10cSrcweir 				 !mpDrawView->IsBreak3DObjPossible() )
281cdf0e10cSrcweir 			{
282cdf0e10cSrcweir 				rSet.DisableItem( SID_BREAK );
283cdf0e10cSrcweir 			}
284cdf0e10cSrcweir 		}
285cdf0e10cSrcweir 		if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MODIFY_FIELD ) )
286cdf0e10cSrcweir 		{
287cdf0e10cSrcweir 			OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 			if( pOLV )
290cdf0e10cSrcweir 			{
291cdf0e10cSrcweir 				const SvxFieldItem* pFldItem = pOLV->GetFieldAtSelection();
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 				if( !( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
294cdf0e10cSrcweir 								 pFldItem->GetField()->ISA( SvxAuthorField ) ||
295cdf0e10cSrcweir 								 pFldItem->GetField()->ISA( SvxExtFileField ) ||
296cdf0e10cSrcweir 								 pFldItem->GetField()->ISA( SvxExtTimeField ) ) ) )
297cdf0e10cSrcweir 				{
298cdf0e10cSrcweir 					rSet.DisableItem( SID_MODIFY_FIELD );
299cdf0e10cSrcweir 				}
300cdf0e10cSrcweir 			}
301cdf0e10cSrcweir 			else
302cdf0e10cSrcweir 				rSet.DisableItem( SID_MODIFY_FIELD );
303cdf0e10cSrcweir 		}
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 		rSet.DisableItem( SID_GROUP );
306cdf0e10cSrcweir 		rSet.DisableItem( SID_COMBINE );
307cdf0e10cSrcweir         rSet.DisableItem(SID_DISTRIBUTE_DLG);
308cdf0e10cSrcweir         rSet.DisableItem(SID_POLY_MERGE);
309cdf0e10cSrcweir         rSet.DisableItem(SID_POLY_SUBSTRACT);
310cdf0e10cSrcweir         rSet.DisableItem(SID_POLY_INTERSECT);
311cdf0e10cSrcweir 		rSet.DisableItem( SID_CONNECT );
312cdf0e10cSrcweir 	}
313cdf0e10cSrcweir 	// Mehrfachselektion
314cdf0e10cSrcweir 	else if( nMarkCount > 1 )
315cdf0e10cSrcweir 	{
316cdf0e10cSrcweir 		// distribure dialog for 3+n objects
317cdf0e10cSrcweir 		if(nMarkCount <= 2)
318cdf0e10cSrcweir 			rSet.DisableItem(SID_DISTRIBUTE_DLG);
319cdf0e10cSrcweir 
320cdf0e10cSrcweir //        rSet.ClearItem( SID_BEZIER_EDIT );
321cdf0e10cSrcweir //        rSet.DisableItem( SID_BEZIER_EDIT );
322cdf0e10cSrcweir 		rSet.DisableItem( SID_LINEEND_POLYGON );
323cdf0e10cSrcweir 		rSet.DisableItem( SID_ENTER_GROUP );
324cdf0e10cSrcweir 		// Jetzt (28.10.96) muessen Namen fuer Objekte eindeutig sein
325cdf0e10cSrcweir 		rSet.DisableItem( SID_NAME_GROUP );
326cdf0e10cSrcweir 		// #i68101#
327cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_TITLE_DESCRIPTION );
328cdf0e10cSrcweir 		rSet.DisableItem( SID_MODIFY_FIELD );
329cdf0e10cSrcweir 
330cdf0e10cSrcweir 		if( 1 )
331cdf0e10cSrcweir //		if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_STYLE ) ||
332cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_UNGROUP ) ||
333cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MEASURE_DLG ) ||
334cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONNECTION_DLG ) ||
335cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_COMBINE ) ||
336cdf0e10cSrcweir //            SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_SHEAR ) ||
337cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_TEXTATTR_DLG ) ||
338cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_3D_LATHE ) ||
339cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONVERT_TO_3D_LATHE_FAST ) ||
340cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_LEFT ) ||
341cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_CENTER ) ||
342cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_RIGHT ) ||
343cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_UP ) ||
344cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_MIDDLE ) ||
345cdf0e10cSrcweir //			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_ALIGN_DOWN ) )
346cdf0e10cSrcweir 		{
347cdf0e10cSrcweir 			sal_Bool bText = sal_False;
348cdf0e10cSrcweir 			sal_Bool bLine = sal_False;
349cdf0e10cSrcweir 			sal_Bool bGroup = sal_False;
350cdf0e10cSrcweir 			sal_Bool bGraf = sal_False;
351cdf0e10cSrcweir 			sal_Bool bDrawObj = sal_False;
352cdf0e10cSrcweir 			sal_Bool b3dObj = sal_False;
353cdf0e10cSrcweir 			sal_Bool bTitOutText = sal_False;
354cdf0e10cSrcweir 			bool bTable = false;
355cdf0e10cSrcweir 			sal_Bool bMeasureObj = sal_False;
356cdf0e10cSrcweir 			sal_Bool bEdgeObj = sal_False; // Connector
357cdf0e10cSrcweir 			sal_Bool bE3dCompoundObject = sal_False;
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 			for( sal_uLong i = 0;
360cdf0e10cSrcweir 				 i < nMarkCount && !bText && i < 50;
361cdf0e10cSrcweir 				 i++ )
362cdf0e10cSrcweir 			{
363cdf0e10cSrcweir 				SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
364cdf0e10cSrcweir 				sal_uInt32 nInv = pObj->GetObjInventor();
365cdf0e10cSrcweir 				sal_uInt16 nId = pObj->GetObjIdentifier();
366cdf0e10cSrcweir 
367cdf0e10cSrcweir 				if (nInv == SdrInventor)
368cdf0e10cSrcweir 				{
369cdf0e10cSrcweir 					switch (nId)
370cdf0e10cSrcweir 					{
371cdf0e10cSrcweir 						case OBJ_TEXT: bText = sal_True; break;
372cdf0e10cSrcweir 
373cdf0e10cSrcweir 						case OBJ_LINE: bLine = sal_True; break;
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 						case OBJ_EDGE: bEdgeObj = sal_True; break;
376cdf0e10cSrcweir 
377cdf0e10cSrcweir 						case OBJ_MEASURE: bMeasureObj = sal_True; break;
378cdf0e10cSrcweir 
379cdf0e10cSrcweir 						case OBJ_RECT:
380cdf0e10cSrcweir 						case OBJ_CIRC:
381cdf0e10cSrcweir 						case OBJ_FREELINE:
382cdf0e10cSrcweir 						case OBJ_FREEFILL:
383cdf0e10cSrcweir 						case OBJ_PATHFILL:
384cdf0e10cSrcweir 						case OBJ_PATHLINE:
385cdf0e10cSrcweir 						case OBJ_SECT:
386cdf0e10cSrcweir 						case OBJ_CARC:
387cdf0e10cSrcweir 						case OBJ_CCUT: bDrawObj = sal_True; break;
388cdf0e10cSrcweir 
389cdf0e10cSrcweir 						case OBJ_GRUP: bGroup = sal_True; break;
390cdf0e10cSrcweir 
391cdf0e10cSrcweir 						case OBJ_GRAF: bGraf = sal_True; break;
392cdf0e10cSrcweir 
393cdf0e10cSrcweir 						case OBJ_TITLETEXT:
394cdf0e10cSrcweir 						case OBJ_OUTLINETEXT: bTitOutText = sal_True; break;
395cdf0e10cSrcweir 						case OBJ_TABLE: bTable = true; break;
396cdf0e10cSrcweir 					}
397cdf0e10cSrcweir 				}
398cdf0e10cSrcweir 				else if (nInv == E3dInventor)
399cdf0e10cSrcweir 				{
400cdf0e10cSrcweir 					if(pObj->ISA(E3dScene))
401cdf0e10cSrcweir 						b3dObj = sal_True;
402cdf0e10cSrcweir 					else if(pObj->ISA(E3dCompoundObject))
403cdf0e10cSrcweir 						bE3dCompoundObject = sal_True;
404cdf0e10cSrcweir 				}
405cdf0e10cSrcweir 			}
406cdf0e10cSrcweir 			/* Kann wohl raus, da jedes(?) Objekt Text enthalten kann
407cdf0e10cSrcweir 			if( !bText )
408cdf0e10cSrcweir 			{
409cdf0e10cSrcweir 				rSet.DisableItem( SID_CHAR_DLG );
410cdf0e10cSrcweir 				rSet.DisableItem( SID_PARA_DLG );
411cdf0e10cSrcweir 				rSet.DisableItem( SID_CHARMAP );
412cdf0e10cSrcweir 			}
413cdf0e10cSrcweir 			*/
414cdf0e10cSrcweir 			if( bLine && !bText && !bDrawObj &&!b3dObj)
415cdf0e10cSrcweir 			{
416cdf0e10cSrcweir 				//rSet.DisableItem( SID_ATTRIBUTES_AREA );
417cdf0e10cSrcweir 				rSet.DisableItem( SID_ATTR_FILL_STYLE );
418d5370dc8SArmin Le Grand 				rSet.DisableItem( SID_ATTR_FILL_TRANSPARENCE );
419d5370dc8SArmin Le Grand 				rSet.DisableItem( SID_ATTR_FILL_FLOATTRANSPARENCE );
420cdf0e10cSrcweir 			}
421cdf0e10cSrcweir 			if( !bEdgeObj )
422cdf0e10cSrcweir 				rSet.DisableItem( SID_CONNECTION_DLG );
423cdf0e10cSrcweir 
424cdf0e10cSrcweir 			if (b3dObj)
425cdf0e10cSrcweir 			{
426cdf0e10cSrcweir 				rSet.DisableItem( SID_COMBINE );
427cdf0e10cSrcweir 				rSet.DisableItem(SID_POLY_MERGE);
428cdf0e10cSrcweir 				rSet.DisableItem(SID_POLY_SUBSTRACT);
429cdf0e10cSrcweir 				rSet.DisableItem(SID_POLY_INTERSECT);
430cdf0e10cSrcweir 			}
431cdf0e10cSrcweir 
432cdf0e10cSrcweir 			if (b3dObj                                        ||
433cdf0e10cSrcweir 				 (!mpDrawView->IsConvertToPathObjPossible(sal_False) &&
434cdf0e10cSrcweir 				  !mpDrawView->IsShearAllowed()                  &&
435cdf0e10cSrcweir 				  !mpDrawView->IsDistortAllowed()) )
436cdf0e10cSrcweir 			{
437cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_SHEAR );
438cdf0e10cSrcweir 			}
439cdf0e10cSrcweir 
440cdf0e10cSrcweir 			if( !bGroup )
441cdf0e10cSrcweir 			{
442cdf0e10cSrcweir 				rSet.DisableItem( SID_UNGROUP );
443cdf0e10cSrcweir 			}
444027adb2eSEike Rathke 			if( bTable )
445cdf0e10cSrcweir 				rSet.DisableItem( SID_TEXTATTR_DLG );
446cdf0e10cSrcweir 
447cdf0e10cSrcweir 			if( !bMeasureObj )
448cdf0e10cSrcweir 				rSet.DisableItem( SID_MEASURE_DLG );
449cdf0e10cSrcweir 
450cdf0e10cSrcweir 			if (!bGraf)
451cdf0e10cSrcweir 			{
452cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_1BIT_THRESHOLD);
453cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_1BIT_MATRIX);
454cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_4BIT_GRAYS);
455cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_4BIT_COLORS);
456cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_8BIT_GRAYS);
457cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_8BIT_COLORS);
458cdf0e10cSrcweir 				rSet.DisableItem(SID_CONVERT_TO_24BIT);
459cdf0e10cSrcweir 			}
460cdf0e10cSrcweir 
461cdf0e10cSrcweir 			if(bE3dCompoundObject)
462cdf0e10cSrcweir 			{
463cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_LEFT );
464cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_CENTER );
465cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_RIGHT );
466cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_UP );
467cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_MIDDLE );
468cdf0e10cSrcweir 				rSet.DisableItem( SID_OBJECT_ALIGN_DOWN );
469cdf0e10cSrcweir 				rSet.DisableItem( SID_FRAME_TO_TOP );
470cdf0e10cSrcweir 				rSet.DisableItem( SID_MOREFRONT );
471cdf0e10cSrcweir 				rSet.DisableItem( SID_MOREBACK );
472cdf0e10cSrcweir 				rSet.DisableItem( SID_FRAME_TO_BOTTOM );
473cdf0e10cSrcweir 				rSet.DisableItem( SID_BEFORE_OBJ );
474cdf0e10cSrcweir 				rSet.DisableItem( SID_BEHIND_OBJ );
475cdf0e10cSrcweir 				rSet.DisableItem( SID_REVERSE_ORDER );
476cdf0e10cSrcweir 			}
477cdf0e10cSrcweir 		}
478cdf0e10cSrcweir 
479cdf0e10cSrcweir 		if ( !mpDrawView->IsDismantlePossible(sal_False) )
480cdf0e10cSrcweir 		{
481cdf0e10cSrcweir 			rSet.DisableItem( SID_DISMANTLE );
482cdf0e10cSrcweir 		}
483cdf0e10cSrcweir 		if ( !mpDrawView->IsDismantlePossible(sal_True) &&
484cdf0e10cSrcweir 			 !mpDrawView->IsImportMtfPossible()     &&
485cdf0e10cSrcweir 			 !mpDrawView->IsBreak3DObjPossible() )
486cdf0e10cSrcweir 		{
487cdf0e10cSrcweir 			rSet.DisableItem( SID_BREAK );
488cdf0e10cSrcweir 		}
489cdf0e10cSrcweir 		if ( !mpDrawView->IsCombinePossible(sal_False) )
490cdf0e10cSrcweir 		{
491cdf0e10cSrcweir 			rSet.DisableItem( SID_COMBINE );
492cdf0e10cSrcweir 			rSet.DisableItem(SID_POLY_MERGE);
493cdf0e10cSrcweir 			rSet.DisableItem(SID_POLY_SUBSTRACT);
494cdf0e10cSrcweir 			rSet.DisableItem(SID_POLY_INTERSECT);
495cdf0e10cSrcweir 		}
496cdf0e10cSrcweir 		if ( !mpDrawView->IsCombinePossible(sal_True) )
497cdf0e10cSrcweir 		{
498cdf0e10cSrcweir 			rSet.DisableItem( SID_CONNECT );
499cdf0e10cSrcweir 		}
500cdf0e10cSrcweir 		if ( !mpDrawView->IsGroupPossible() )
501cdf0e10cSrcweir 		{
502cdf0e10cSrcweir 			rSet.DisableItem( SID_GROUP );
503cdf0e10cSrcweir 		}
504cdf0e10cSrcweir 		if ( !mpDrawView->IsUnGroupPossible() )
505cdf0e10cSrcweir 		{
506cdf0e10cSrcweir 			rSet.DisableItem( SID_UNGROUP );
507cdf0e10cSrcweir 		}
508cdf0e10cSrcweir 	}
509cdf0e10cSrcweir 	// kein Objekt selektiert
510cdf0e10cSrcweir 	else
511cdf0e10cSrcweir 	{
512cdf0e10cSrcweir //        rSet.ClearItem( SID_BEZIER_EDIT );
513cdf0e10cSrcweir 
514cdf0e10cSrcweir 		rSet.DisableItem( SID_ENTER_GROUP );
515cdf0e10cSrcweir 		rSet.DisableItem( SID_CUT );
516cdf0e10cSrcweir 		rSet.DisableItem( SID_COPY );
517cdf0e10cSrcweir 		rSet.DisableItem( SID_DELETE );
518cdf0e10cSrcweir 		rSet.DisableItem( SID_ATTR_TRANSFORM );
519cdf0e10cSrcweir 
520cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_ALIGN_LEFT );
521cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_ALIGN_CENTER );
522cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_ALIGN_RIGHT );
523cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_ALIGN_UP );
524cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_ALIGN_MIDDLE );
525cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_ALIGN_DOWN );
526cdf0e10cSrcweir 
527cdf0e10cSrcweir 		rSet.DisableItem( SID_FRAME_TO_TOP );
528cdf0e10cSrcweir 		rSet.DisableItem( SID_MOREFRONT );
529cdf0e10cSrcweir 		rSet.DisableItem( SID_MOREBACK );
530cdf0e10cSrcweir 		rSet.DisableItem( SID_FRAME_TO_BOTTOM );
531cdf0e10cSrcweir 		rSet.DisableItem( SID_BEFORE_OBJ );
532cdf0e10cSrcweir 		rSet.DisableItem( SID_BEHIND_OBJ );
533cdf0e10cSrcweir 		rSet.DisableItem( SID_CONVERT );
534cdf0e10cSrcweir 
535cdf0e10cSrcweir //		rSet.DisableItem( SID_BEZIER_EDIT );
536cdf0e10cSrcweir 		rSet.DisableItem( SID_SIZE_OPTIMAL );
537cdf0e10cSrcweir 		rSet.DisableItem( SID_LINEEND_POLYGON );
538cdf0e10cSrcweir 		rSet.DisableItem( SID_COPYOBJECTS );
539cdf0e10cSrcweir 		rSet.DisableItem( SID_HORIZONTAL );
540cdf0e10cSrcweir 		rSet.DisableItem( SID_VERTICAL );
541*ee093554SAndre Fischer 		rSet.DisableItem( SID_FLIP_HORIZONTAL );
542*ee093554SAndre Fischer 		rSet.DisableItem( SID_FLIP_VERTICAL );
543cdf0e10cSrcweir 		rSet.DisableItem( SID_GROUP );
544cdf0e10cSrcweir 		rSet.DisableItem( SID_UNGROUP );
545cdf0e10cSrcweir 		rSet.DisableItem( SID_NAME_GROUP );
546cdf0e10cSrcweir 
547cdf0e10cSrcweir 		// #i68101#
548cdf0e10cSrcweir 		rSet.DisableItem( SID_OBJECT_TITLE_DESCRIPTION );
549cdf0e10cSrcweir 
550cdf0e10cSrcweir 		rSet.DisableItem( SID_DISMANTLE );
551cdf0e10cSrcweir 		rSet.DisableItem( SID_BREAK );
552cdf0e10cSrcweir 		rSet.DisableItem( SID_COMBINE );
553cdf0e10cSrcweir         rSet.DisableItem(SID_DISTRIBUTE_DLG);
554cdf0e10cSrcweir         rSet.DisableItem(SID_POLY_MERGE);
555cdf0e10cSrcweir         rSet.DisableItem(SID_POLY_SUBSTRACT);
556cdf0e10cSrcweir         rSet.DisableItem(SID_POLY_INTERSECT);
557cdf0e10cSrcweir 		rSet.DisableItem( SID_CONNECT );
558cdf0e10cSrcweir 		rSet.DisableItem( SID_ANIMATION_EFFECTS );
559cdf0e10cSrcweir 		rSet.DisableItem( SID_MODIFY_FIELD );
560cdf0e10cSrcweir 		rSet.DisableItem (SID_OBJECT_SHEAR);
561cdf0e10cSrcweir 	}
562cdf0e10cSrcweir 
563cdf0e10cSrcweir }
564cdf0e10cSrcweir 
565cdf0e10cSrcweir 
566cdf0e10cSrcweir } // end of namespace sd
567