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