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