1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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 <officecfg/Office/Common.hxx>
30 #include <officecfg/Office/Impress.hxx>
31 #include <svx/svxids.hrc>
32 #include <svx/svdpagv.hxx>
33 #include <svx/clipfmtitem.hxx>
34 #include <svx/fmshell.hxx>
35 #include <svl/eitem.hxx>
36 #include <svl/aeitem.hxx>
37 #include <svl/stritem.hxx>
38 #include <svl/visitem.hxx>
39 #include <svl/whiter.hxx>
40 #include <sfx2/dispatch.hxx>
41 #include <svx/svdograf.hxx>
42 #include <editeng/unolingu.hxx>
43 #include <svx/extrusionbar.hxx>
44 #include <svx/fontworkbar.hxx>
47 #include <svl/slstitm.hxx>
48 #include <sfx2/app.hxx>
49 #include <svtools/insdlg.hxx>
50 #include <unotools/moduleoptions.hxx>
51 #include <svl/languageoptions.hxx>
52 #include <comphelper/processfactory.hxx>
53 #include <sfx2/request.hxx>
55 #include <svx/pfiledlg.hxx>
56 #include <svx/grafctrl.hxx>
57 #include <svtools/cliplistener.hxx>
58 #include <sfx2/viewfrm.hxx>
62 #include "res_bmp.hrc"
63 #include "PresentationViewShell.hxx"
65 #include "Outliner.hxx"
66 #include "drawdoc.hxx"
67 #include "sdresid.hxx"
70 #include "DrawDocShell.hxx"
71 #include "zoomlist.hxx"
72 #include "slideshow.hxx"
73 #include "drawview.hxx"
74 #include "ViewShellBase.hxx"
75 #include "ViewShellManager.hxx"
76 #include "LayerTabBar.hxx"
79 #include "fuediglu.hxx"
80 #include "fubullet.hxx"
81 #include "fuformatpaintbrush.hxx"
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
;
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.
92 SAL_WNODEPRECATED_DECLARATIONS_PUSH
93 ::std::auto_ptr
<SvxClipboardFmtItem
> GetSupportedClipboardFormats (
94 TransferableDataHelper
& rDataHelper
)
96 ::std::auto_ptr
<SvxClipboardFmtItem
> pResult (
97 new SvxClipboardFmtItem(SID_CLIPBOARD_FORMAT_ITEMS
));
99 sal_uInt32
nFormatCount (rDataHelper
.GetFormatCount());
100 for (sal_uInt32 i
=0; i
<nFormatCount
; i
++)
102 const SotFormatStringId nTestFormat
= rDataHelper
.GetFormat(i
);
104 // Check if the current format is the same as one that has already
106 bool bDuplicate (false);
107 for (sal_uInt32 j
=0; j
<i
; j
++)
109 if (nTestFormat
== rDataHelper
.GetFormat(j
))
116 // Look up the format among those that are supported by the
122 case SOT_FORMATSTR_ID_EMBED_SOURCE
:
126 TransferableObjectDescriptor aDescriptor
;
127 if (rDataHelper
.GetTransferableObjectDescriptor(
128 SOT_FORMATSTR_ID_OBJECTDESCRIPTOR
, aDescriptor
))
130 sName
= aDescriptor
.maTypeName
;
133 pResult
->AddClipbrdFormat(nTestFormat
, sName
);
135 pResult
->AddClipbrdFormat(nTestFormat
);
140 case SOT_FORMATSTR_ID_LINK_SOURCE
:
141 case SOT_FORMATSTR_ID_DRAWING
:
142 case SOT_FORMATSTR_ID_SVXB
:
143 case FORMAT_GDIMETAFILE
:
145 case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK
:
147 case SOT_FORMATSTR_ID_HTML
:
149 case SOT_FORMATSTR_ID_EDITENGINE
:
150 pResult
->AddClipbrdFormat(nTestFormat
);
156 // Check some OLE formats whose names are handled differently.
157 SotFormatStringId
nFormat (SOT_FORMATSTR_ID_EMBED_SOURCE_OLE
);
158 bool bHasFormat (rDataHelper
.HasFormat(nFormat
));
161 bHasFormat
= rDataHelper
.HasFormat(nFormat
);
167 if (SvPasteObjectHelper::GetEmbeddedName (rDataHelper
, sName
, sSource
, nFormat
))
168 pResult
->AddClipbrdFormat (nFormat
, sName
);
173 SAL_WNODEPRECATED_DECLARATIONS_POP
177 IMPL_LINK( DrawViewShell
, ClipboardChanged
, TransferableDataHelper
*, pDataHelper
)
181 mbPastePossible
= ( pDataHelper
->GetFormatCount() != 0 );
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
189 TransferableDataHelper
aDataHelper (
190 TransferableDataHelper::CreateFromSystemClipboard(GetActiveWindow()));
191 SAL_WNODEPRECATED_DECLARATIONS_PUSH
192 ::std::auto_ptr
<SvxClipboardFmtItem
> pFormats (GetSupportedClipboardFormats(aDataHelper
));
193 SAL_WNODEPRECATED_DECLARATIONS_POP
194 if (mpDrawView
== NULL
)
196 mpCurrentClipboardFormats
= pFormats
;
198 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
199 rBindings
.Invalidate( SID_PASTE
);
200 rBindings
.Invalidate( SID_PASTE_SPECIAL
);
201 rBindings
.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS
);
206 void DrawViewShell::GetDrawAttrState(SfxItemSet
& rSet
)
208 SfxItemSet
aSet( mpDrawView
->GetGeoAttrFromMarked() );
209 rSet
.Put(aSet
,sal_False
);
212 void DrawViewShell::GetMenuState( SfxItemSet
&rSet
)
214 if (mpDrawView
== NULL
)
216 // This assertion and return are here to prevent crashes.
217 DBG_ASSERT(mpDrawView
!=NULL
, "Please report this assertion to the Impress team.");
221 ViewShell::GetMenuState(rSet
);
222 sal_Bool bDisableVerticalText
= !SvtLanguageOptions().IsVerticalTextEnabled();
224 if ( bDisableVerticalText
)
226 rSet
.DisableItem( SID_DRAW_FONTWORK_VERTICAL
);
227 rSet
.DisableItem( SID_DRAW_CAPTION_VERTICAL
);
228 rSet
.DisableItem( SID_TEXT_FITTOSIZE_VERTICAL
);
229 rSet
.DisableItem( SID_DRAW_TEXT_VERTICAL
);
232 bool bConvertToPathPossible
= mpDrawView
->IsConvertToPathObjPossible(sal_False
);
234 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
235 const sal_uLong nMarkCount
= rMarkList
.GetMarkCount();
238 FuFormatPaintBrush::GetMenuState( *this, rSet
);
240 // State of SfxChild-Windows (Animator, Fontwork etc.)
241 SetChildWindowState( rSet
);
243 // map images of toolboxes (only zoom)
244 UpdateToolboxImages( rSet
, sal_False
);
246 if(HasCurrentFunction())
248 sal_uInt16 nSId
= GetCurrentFunction()->GetSlotID();
250 rSet
.Put( SfxBoolItem( nSId
, sal_True
) );
252 // will cause a uncheck of a simulated slot
253 sal_uInt16 nId
= GetIdBySubId( nSId
);
255 // map images of the toolboxes
256 UpdateToolboxImages( rSet
);
258 if( nId
!= SID_ZOOM_TOOLBOX
&&
259 nSId
!= SID_DRAWTBX_INSERT
&&
260 nSId
!= SID_POSITION
&&
261 nSId
!= SID_OBJECT_ALIGN
)
263 if( nId
!= SID_OBJECT_CHOOSE_MODE
)
264 rSet
.Put( TbxImageItem( SID_OBJECT_CHOOSE_MODE
, 0 ) );
265 if( nId
!= SID_DRAWTBX_TEXT
)
266 rSet
.Put( TbxImageItem( SID_DRAWTBX_TEXT
, 0 ) );
267 if( nId
!= SID_DRAWTBX_RECTANGLES
)
268 rSet
.Put( TbxImageItem( SID_DRAWTBX_RECTANGLES
, 0 ) );
269 if( nId
!= SID_DRAWTBX_ELLIPSES
)
270 rSet
.Put( TbxImageItem( SID_DRAWTBX_ELLIPSES
, 0 ) );
271 if( nId
!= SID_DRAWTBX_LINES
)
272 rSet
.Put( TbxImageItem( SID_DRAWTBX_LINES
, 0 ) );
273 if( nId
!= SID_DRAWTBX_ARROWS
)
274 rSet
.Put( TbxImageItem( SID_DRAWTBX_ARROWS
, 0 ) );
275 if( nId
!= SID_DRAWTBX_3D_OBJECTS
)
276 rSet
.Put( TbxImageItem( SID_DRAWTBX_3D_OBJECTS
, 0 ) );
277 if( nId
!= SID_DRAWTBX_CONNECTORS
)
278 rSet
.Put( TbxImageItem( SID_DRAWTBX_CONNECTORS
, 0 ) );
282 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
284 GetMenuStateSel(rSet
);
286 if (SFX_ITEM_AVAILABLE
== rSet
.GetItemState(SID_ASSIGN_LAYOUT
))
288 bool bDisable
= true;
291 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
293 if( pPage
&& !pPage
->IsMasterPage() )
295 rSet
.Put( SfxUInt32Item( SID_ASSIGN_LAYOUT
, static_cast< sal_uInt32
>(pPage
->GetAutoLayout()) ) );
302 rSet
.DisableItem(SID_ASSIGN_LAYOUT
);
306 if (SFX_ITEM_AVAILABLE
== rSet
.GetItemState(SID_EXPAND_PAGE
))
308 bool bDisable
= true;
311 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
313 if( pPage
&& (pPage
->GetPageKind() == PK_STANDARD
) && !pPage
->IsMasterPage() )
315 SdrObject
* pObj
= pPage
->GetPresObj(PRESOBJ_OUTLINE
);
319 if( !pObj
->IsEmptyPresObj() )
325 // check if the object is in edit, than its temporarely not empty
326 SdrTextObj
* pTextObj
= dynamic_cast< SdrTextObj
* >( pObj
);
329 OutlinerParaObject
* pParaObj
= pTextObj
->GetEditOutlinerParaObject();
343 rSet
.DisableItem(SID_EXPAND_PAGE
);
347 if (SFX_ITEM_AVAILABLE
== rSet
.GetItemState(SID_SUMMARY_PAGE
))
349 bool bDisable
= true;
352 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
354 if( pPage
&& (pPage
->GetPageKind() == PK_STANDARD
) && !pPage
->IsMasterPage() )
356 SdrObject
* pObj
= pPage
->GetPresObj(PRESOBJ_TITLE
);
358 if(pObj
&& !pObj
->IsEmptyPresObj())
367 rSet
.DisableItem(SID_SUMMARY_PAGE
);
371 if (SFX_ITEM_AVAILABLE
== rSet
.GetItemState(SID_ASSIGN_LAYOUT
))
373 bool bDisable
= true;
376 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
378 if( pPage
&& !pPage
->IsMasterPage() )
380 rSet
.Put( SfxUInt32Item(SID_ASSIGN_LAYOUT
, pPage
->GetAutoLayout()) );
387 rSet
.DisableItem(SID_ASSIGN_LAYOUT
);
391 // is it possible to start the presentation?
392 if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_PRESENTATION
) ||
393 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_REHEARSE_TIMINGS
) )
395 sal_Bool bDisable
= sal_True
;
396 sal_uInt16 nCount
= GetDoc()->GetSdPageCount( PK_STANDARD
);
398 for( sal_uInt16 i
= 0; i
< nCount
&& bDisable
; i
++ )
400 SdPage
* pPage
= GetDoc()->GetSdPage(i
, PK_STANDARD
);
402 if( !pPage
->IsExcluded() )
403 bDisable
= sal_False
;
406 if( bDisable
|| GetDocSh()->IsPreview())
408 rSet
.DisableItem( SID_PRESENTATION
);
409 rSet
.DisableItem( SID_REHEARSE_TIMINGS
);
414 if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GLUE_EDITMODE
) ||
415 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GLUE_INSERT_POINT
) ||
416 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GLUE_PERCENT
) ||
417 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GLUE_ESCDIR
) ||
418 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GLUE_ESCDIR_LEFT
) ||
419 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GLUE_ESCDIR_RIGHT
) ||
420 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GLUE_ESCDIR_TOP
) ||
421 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GLUE_ESCDIR_BOTTOM
) ||
422 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GLUE_HORZALIGN_CENTER
) ||
423 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GLUE_HORZALIGN_LEFT
) ||
424 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GLUE_HORZALIGN_RIGHT
) ||
425 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GLUE_VERTALIGN_CENTER
) ||
426 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GLUE_VERTALIGN_TOP
) ||
427 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GLUE_VERTALIGN_BOTTOM
) )
430 TRISTATE eState
= mpDrawView
->IsMarkedGluePointsPercent();
431 if( eState
== STATE_DONTKNOW
)
432 rSet
.InvalidateItem( SID_GLUE_PERCENT
);
434 rSet
.Put( SfxBoolItem( SID_GLUE_PERCENT
, eState
== STATE_CHECK
) );
436 // alignment has no effect by percent
437 if( eState
== STATE_CHECK
)
439 rSet
.DisableItem( SID_GLUE_HORZALIGN_CENTER
);
440 rSet
.DisableItem( SID_GLUE_HORZALIGN_LEFT
);
441 rSet
.DisableItem( SID_GLUE_HORZALIGN_RIGHT
);
442 rSet
.DisableItem( SID_GLUE_VERTALIGN_CENTER
);
443 rSet
.DisableItem( SID_GLUE_VERTALIGN_TOP
);
444 rSet
.DisableItem( SID_GLUE_VERTALIGN_BOTTOM
);
448 // horizontal alignment
449 sal_uInt16 nHorz
= mpDrawView
->GetMarkedGluePointsAlign( sal_False
);
450 rSet
.Put( SfxBoolItem( SID_GLUE_HORZALIGN_CENTER
, nHorz
== SDRHORZALIGN_CENTER
) );
451 rSet
.Put( SfxBoolItem( SID_GLUE_HORZALIGN_LEFT
, nHorz
== SDRHORZALIGN_LEFT
) );
452 rSet
.Put( SfxBoolItem( SID_GLUE_HORZALIGN_RIGHT
, nHorz
== SDRHORZALIGN_RIGHT
) );
453 // vertical alignment
454 sal_uInt16 nVert
= mpDrawView
->GetMarkedGluePointsAlign( sal_True
);
455 rSet
.Put( SfxBoolItem( SID_GLUE_VERTALIGN_CENTER
, nVert
== SDRVERTALIGN_CENTER
) );
456 rSet
.Put( SfxBoolItem( SID_GLUE_VERTALIGN_TOP
, nVert
== SDRVERTALIGN_TOP
) );
457 rSet
.Put( SfxBoolItem( SID_GLUE_VERTALIGN_BOTTOM
, nVert
== SDRVERTALIGN_BOTTOM
) );
461 rSet
.Put( SfxBoolItem( SID_GLUE_INSERT_POINT
, mpDrawView
->IsInsGluePointMode() ) );
465 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SDRESC_LEFT
);
466 if( eState
== STATE_DONTKNOW
)
467 rSet
.InvalidateItem( SID_GLUE_ESCDIR_LEFT
);
469 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_LEFT
, eState
== STATE_CHECK
) );
471 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SDRESC_RIGHT
);
472 if( eState
== STATE_DONTKNOW
)
473 rSet
.InvalidateItem( SID_GLUE_ESCDIR_RIGHT
);
475 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_RIGHT
, eState
== STATE_CHECK
) );
477 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SDRESC_TOP
);
478 if( eState
== STATE_DONTKNOW
)
479 rSet
.InvalidateItem( SID_GLUE_ESCDIR_TOP
);
481 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_TOP
, eState
== STATE_CHECK
) );
483 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SDRESC_BOTTOM
);
484 if( eState
== STATE_DONTKNOW
)
485 rSet
.InvalidateItem( SID_GLUE_ESCDIR_BOTTOM
);
487 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_BOTTOM
, eState
== STATE_CHECK
) );
490 if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_GRID_FRONT
) ||
491 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_HELPLINES_FRONT
) )
493 rSet
.Put( SfxBoolItem( SID_GRID_FRONT
, mpDrawView
->IsGridFront() ) );
494 rSet
.Put( SfxBoolItem( SID_HELPLINES_FRONT
, mpDrawView
->IsHlplFront() ) );
497 if (!mpDrawView
->IsFrameDragSingles())
498 rSet
.Put(SfxBoolItem(SID_BEZIER_EDIT
, sal_True
));
500 rSet
.Put(SfxBoolItem(SID_BEZIER_EDIT
, sal_False
));
502 if(dynamic_cast<FuEditGluePoints
*>( GetCurrentFunction().get()))
503 rSet
.Put(SfxBoolItem(SID_GLUE_EDITMODE
, sal_True
));
505 rSet
.Put(SfxBoolItem(SID_GLUE_EDITMODE
, sal_False
));
507 if( !mpDrawView
->IsMirrorAllowed( sal_True
, sal_True
) )
509 rSet
.DisableItem( SID_HORIZONTAL
);
510 rSet
.DisableItem( SID_VERTICAL
);
511 rSet
.DisableItem( SID_FLIP_HORIZONTAL
);
512 rSet
.DisableItem( SID_FLIP_VERTICAL
);
515 if( !mpDrawView
->IsMirrorAllowed() )
517 rSet
.DisableItem( SID_OBJECT_MIRROR
);
518 // rSet.DisableItem( SID_CONVERT_TO_3D_LATHE );
519 // rSet.DisableItem( SID_CONVERT_TO_3D_LATHE_FAST );
522 // interactive transparence control
523 if(!mpDrawView
->IsTransparenceAllowed())
525 rSet
.DisableItem( SID_OBJECT_TRANSPARENCE
);
528 // interactive gradient control
529 if(!mpDrawView
->IsGradientAllowed())
531 rSet
.DisableItem( SID_OBJECT_GRADIENT
);
534 // disable morphing if necessary
535 if ( !mpDrawView
->IsMorphingAllowed() )
536 rSet
.DisableItem( SID_POLYGON_MORPHING
);
538 // disable vectorizing if necessary
539 if ( !mpDrawView
->IsVectorizeAllowed() )
540 rSet
.DisableItem( SID_VECTORIZE
);
542 if( !mpDrawView
->IsReverseOrderPossible() )
544 rSet
.DisableItem( SID_REVERSE_ORDER
);
547 if ( !bConvertToPathPossible
&&
548 !mpDrawView
->IsCrookAllowed( mpDrawView
->IsCrookNoContortion() ) )
550 // implicit transformation into curve not possible
551 rSet
.DisableItem(SID_OBJECT_CROOK_ROTATE
);
552 rSet
.DisableItem(SID_OBJECT_CROOK_SLANT
);
553 rSet
.DisableItem(SID_OBJECT_CROOK_STRETCH
);
556 if ( !mpDrawView
->IsGroupEntered() )
558 rSet
.DisableItem( SID_LEAVE_GROUP
);
559 rSet
.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS
, sal_False
) );
560 rSet
.ClearItem( SID_LEAVE_ALL_GROUPS
);
561 rSet
.DisableItem( SID_LEAVE_ALL_GROUPS
);
564 rSet
.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS
, sal_True
) );
566 if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_THESAURUS
) )
568 if ( !mpDrawView
->IsTextEdit() )
570 rSet
.DisableItem( SID_THESAURUS
);
574 LanguageType eLang
= GetDoc()->GetLanguage( EE_CHAR_LANGUAGE
);
575 Reference
< XThesaurus
> xThesaurus( LinguMgr::GetThesaurus() );
577 if (!xThesaurus
.is() || eLang
== LANGUAGE_NONE
|| !xThesaurus
->hasLocale( LanguageTag( eLang
).getLocale()) )
578 rSet
.DisableItem( SID_THESAURUS
);
582 if ( !mpDrawView
->IsTextEdit() )
584 rSet
.DisableItem( SID_THESAURUS
);
587 if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_SELECTALL
) ||
588 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_SIZE_ALL
) )
590 if( pPageView
&& pPageView
->GetObjList()->GetObjCount() == 0 )
592 // should be disabled if there is no object on the draw area:
593 rSet
.DisableItem( SID_SELECTALL
);
594 rSet
.DisableItem( SID_SIZE_ALL
);
598 if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_CONTEXT
) )
599 rSet
.Put( SfxStringItem( SID_CONTEXT
, mpDrawView
->GetStatusText() ) );
602 if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_PASTE
) ||
603 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_PASTE_SPECIAL
) ||
604 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS
) )
606 if ( !mpClipEvtLstnr
)
608 // avoid clipboard initialization for
609 // read-only presentation views (workaround for NT4.0
610 // clipboard prob...)
611 if( !ISA(PresentationViewShell
) )
614 mpClipEvtLstnr
= new TransferableClipboardListener( LINK( this, DrawViewShell
, ClipboardChanged
) );
615 mpClipEvtLstnr
->acquire();
616 mpClipEvtLstnr
->AddRemoveListener( GetActiveWindow(), sal_True
);
619 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
620 mbPastePossible
= ( aDataHelper
.GetFormatCount() != 0 );
623 mbPastePossible
= sal_False
;
626 if( !mbPastePossible
)
628 rSet
.DisableItem( SID_PASTE
);
629 rSet
.DisableItem( SID_PASTE_SPECIAL
);
630 rSet
.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS
);
632 else if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS
) )
634 if (mpCurrentClipboardFormats
.get() != NULL
)
635 rSet
.Put(*mpCurrentClipboardFormats
);
639 if ( !bConvertToPathPossible
)
641 rSet
.DisableItem(SID_CHANGEBEZIER
);
644 if (mpDrawView
== NULL
)
646 // The mpDrawView was not NULL but is now.
647 // The reason for this may be that the DrawViewShell has been
648 // destroyed in the mean time.
649 // We can only return immediately and hope that the deleted
650 // DrawViewShell is not called again.
651 DBG_ASSERT(mpDrawView
!=NULL
, "Please report this assertion to the Impress team.");
655 if( !( mpDrawView
->IsConvertToPolyObjPossible(sal_False
) || mpDrawView
->IsVectorizeAllowed() ) )
656 rSet
.DisableItem(SID_CHANGEPOLYGON
);
658 if( !( mpDrawView
->IsConvertToPolyObjPossible(sal_False
) || mpDrawView
->IsConvertToContourPossible() ) )
659 rSet
.DisableItem(SID_CONVERT_TO_CONTOUR
);
661 if ( !mpDrawView
->IsConvertTo3DObjPossible() )
663 rSet
.DisableItem(SID_CONVERT_TO_3D
);
664 rSet
.DisableItem(SID_CONVERT_TO_3D_LATHE
);
665 rSet
.DisableItem(SID_CONVERT_TO_3D_LATHE_FAST
);
668 if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_MANAGE_LINKS
) )
670 if ( GetDoc()->GetLinkCount() == 0 )
672 rSet
.DisableItem(SID_MANAGE_LINKS
);
676 if (mePageKind
== PK_HANDOUT
)
678 rSet
.DisableItem(SID_PRESENTATION_LAYOUT
);
679 rSet
.DisableItem(SID_SELECT_BACKGROUND
);
682 if (mePageKind
== PK_NOTES
)
684 rSet
.DisableItem(SID_INSERTPAGE
);
685 rSet
.DisableItem(SID_RENAMEPAGE
);
686 rSet
.DisableItem(SID_RENAMEPAGE_QUICK
);
687 rSet
.DisableItem(SID_DUPLICATE_PAGE
);
688 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
689 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
690 rSet
.DisableItem(SID_ANIMATION_EFFECTS
);
692 if (meEditMode
== EM_MASTERPAGE
)
693 rSet
.DisableItem(SID_MODIFYPAGE
);
695 rSet
.DisableItem(SID_SELECT_BACKGROUND
);
696 rSet
.DisableItem(SID_INSERTLAYER
);
697 rSet
.DisableItem(SID_LAYERMODE
);
698 rSet
.DisableItem(SID_INSERTFILE
);
700 else if (mePageKind
== PK_HANDOUT
)
702 rSet
.DisableItem(SID_INSERTPAGE
);
703 rSet
.DisableItem(SID_DUPLICATE_PAGE
);
704 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
705 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
706 rSet
.DisableItem(SID_ANIMATION_EFFECTS
);
707 rSet
.DisableItem(SID_RENAMEPAGE
);
708 rSet
.DisableItem(SID_RENAMEPAGE_QUICK
);
709 rSet
.DisableItem(SID_INSERTLAYER
);
710 rSet
.DisableItem(SID_MODIFYLAYER
);
711 rSet
.DisableItem(SID_RENAMELAYER
);
712 rSet
.DisableItem(SID_LAYERMODE
);
713 rSet
.DisableItem(SID_INSERTFILE
);
714 rSet
.DisableItem(SID_PAGEMODE
);
715 rSet
.DisableItem(SID_SELECT_BACKGROUND
);
719 if (meEditMode
== EM_MASTERPAGE
)
721 rSet
.DisableItem(SID_INSERTPAGE
);
722 rSet
.DisableItem(SID_DUPLICATE_PAGE
);
723 rSet
.DisableItem(SID_MODIFYPAGE
);
724 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
725 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
728 rSet
.Put (SfxBoolItem (SID_LAYERMODE
, IsLayerModeActive()));
731 if ( ! IsLayerModeActive())
733 rSet
.DisableItem( SID_INSERTLAYER
);
734 rSet
.DisableItem( SID_MODIFYLAYER
);
735 rSet
.DisableItem( SID_DELETE_LAYER
);
736 rSet
.DisableItem( SID_RENAMELAYER
);
739 if (meEditMode
== EM_PAGE
)
741 /**********************************************************************
743 **********************************************************************/
744 rSet
.Put(SfxBoolItem(SID_PAGEMODE
, sal_True
));
745 rSet
.Put(SfxBoolItem(SID_MASTERPAGE
, sal_False
));
746 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE
, sal_False
));
747 rSet
.Put(SfxBoolItem(SID_NOTES_MASTERPAGE
, sal_False
));
748 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE
, sal_False
));
750 if (mePageKind
== PK_STANDARD
&&
751 rSet
.GetItemState(SID_TITLE_MASTERPAGE
) == SFX_ITEM_AVAILABLE
)
753 // Is there a page with the AutoLayout "Title"?
754 sal_Bool bDisable
= sal_True
;
756 sal_uInt16 nCount
= GetDoc()->GetSdPageCount(PK_STANDARD
);
758 while (i
< nCount
&& bDisable
)
760 SdPage
* pPage
= GetDoc()->GetSdPage(i
, PK_STANDARD
);
762 if (pPage
->GetAutoLayout() == AUTOLAYOUT_TITLE
)
764 bDisable
= sal_False
;
772 rSet
.DisableItem(SID_TITLE_MASTERPAGE
);
776 rSet
.Put(SfxBoolItem(SID_TITLE_MASTERPAGE
, sal_False
));
781 rSet
.DisableItem(SID_TITLE_MASTERPAGE
);
784 rSet
.DisableItem (SID_INSERT_MASTER_PAGE
);
785 rSet
.DisableItem (SID_DELETE_MASTER_PAGE
);
786 rSet
.DisableItem (SID_RENAME_MASTER_PAGE
);
787 rSet
.DisableItem (SID_CLOSE_MASTER_VIEW
);
791 rSet
.Put(SfxBoolItem(SID_PAGEMODE
, sal_False
));
792 rSet
.Put(SfxBoolItem(SID_MASTERPAGE
, sal_True
));
794 /**********************************************************************
795 * Background page mode
796 **********************************************************************/
797 if (mePageKind
== PK_STANDARD
)
799 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE
, sal_True
));
800 rSet
.Put(SfxBoolItem(SID_NOTES_MASTERPAGE
, sal_False
));
801 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE
, sal_False
));
803 if (rSet
.GetItemState(SID_TITLE_MASTERPAGE
) == SFX_ITEM_AVAILABLE
)
805 sal_Bool bCheck
= sal_False
;
806 sal_Bool bDisable
= sal_True
;
809 SdPage
* pMPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
812 sal_uInt16 nCount
= GetDoc()->GetSdPageCount(PK_STANDARD
);
814 // Is there a reference to the current master page from a page
815 // with the AutoLayout "Title"?
816 while (i
< nCount
&& !bCheck
&& bDisable
)
818 SdPage
* pPage
= GetDoc()->GetSdPage(i
, PK_STANDARD
);
820 // page does reference the current master page
821 if (pPage
->GetAutoLayout() == AUTOLAYOUT_TITLE
)
823 // a page does have a AutoLayout "Title"
824 bDisable
= sal_False
;
826 SdPage
& rRefMPage
= (SdPage
&)(pPage
->TRG_GetMasterPage());
828 if(&rRefMPage
== pMPage
)
830 // a page with the AutoLayout "Title" does reference
831 // the current master page
842 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE
, sal_False
));
845 rSet
.Put(SfxBoolItem(SID_TITLE_MASTERPAGE
, bCheck
));
849 rSet
.ClearItem(SID_TITLE_MASTERPAGE
);
850 rSet
.DisableItem(SID_TITLE_MASTERPAGE
);
854 else if (mePageKind
== PK_NOTES
)
856 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE
, sal_False
));
857 rSet
.DisableItem(SID_TITLE_MASTERPAGE
);
858 rSet
.Put(SfxBoolItem(SID_NOTES_MASTERPAGE
, sal_True
));
859 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE
, sal_False
));
861 else if (mePageKind
== PK_HANDOUT
)
863 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE
, sal_False
));
864 rSet
.DisableItem(SID_TITLE_MASTERPAGE
);
865 rSet
.Put(SfxBoolItem(SID_NOTES_MASTERPAGE
, sal_False
));
866 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE
, sal_True
));
870 // set state of the ruler
871 if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_RULER
) )
872 rSet
.Put( SfxBoolItem( SID_RULER
, HasRuler() ) );
874 // do not delete the last page or a master page
875 if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_DELETE_PAGE
)
876 || SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_DELETE_MASTER_PAGE
) )
878 if (maTabControl
.GetPageCount() == 1 ||
879 meEditMode
== EM_MASTERPAGE
||
880 mePageKind
== PK_NOTES
||
881 mePageKind
== PK_HANDOUT
||
882 (GetShellType()!=ST_DRAW
&&IsLayerModeActive()))
884 if (rSet
.GetItemState(SID_DELETE_PAGE
) == SFX_ITEM_AVAILABLE
)
885 rSet
.DisableItem(SID_DELETE_PAGE
);
886 if (rSet
.GetItemState(SID_DELETE_MASTER_PAGE
)==SFX_ITEM_AVAILABLE
)
887 rSet
.DisableItem(SID_DELETE_MASTER_PAGE
);
891 // is it allowed to delete the current layer?
892 if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_DELETE_LAYER
) )
894 sal_uInt16 nCurrentLayer
= GetLayerTabControl()->GetCurPageId();
895 const String
& rName
= GetLayerTabControl()->GetPageText(nCurrentLayer
);
897 sal_Bool bDisableIt
= !IsLayerModeActive();
898 bDisableIt
|= (rName
== String(SdResId(STR_LAYER_LAYOUT
)));
899 bDisableIt
|= (rName
== String(SdResId(STR_LAYER_BCKGRND
)));
900 bDisableIt
|= (rName
== String(SdResId(STR_LAYER_BCKGRNDOBJ
)));
901 bDisableIt
|= (rName
== String(SdResId(STR_LAYER_CONTROLS
)));
902 bDisableIt
|= (rName
== String(SdResId(STR_LAYER_MEASURELINES
)));
906 rSet
.DisableItem(SID_DELETE_LAYER
);
907 rSet
.DisableItem(SID_RENAMELAYER
);
911 if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_CUT
) ||
912 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_COPY
) ||
913 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_OUTLINE_BULLET
))
915 OutlinerView
* pOlView
= mpDrawView
->GetTextEditOutlinerView();
917 // special treatment of for SID_OUTLINE_BULLET if objects with different
918 // kinds of NumBullets are marked
919 sal_Bool bHasOutliner
= sal_False
;
920 sal_Bool bHasOther
= sal_False
;
921 for(sal_uLong nNum
= 0; nNum
< nMarkCount
; nNum
++)
923 SdrObject
* pObj
= rMarkList
.GetMark(nNum
)->GetMarkedSdrObj();
924 if( pObj
->GetObjInventor() == SdrInventor
)
926 if( pObj
->GetObjIdentifier() == OBJ_OUTLINETEXT
)
928 bHasOutliner
= sal_True
;
934 bHasOther
= sal_True
;
941 if( bHasOther
&& bHasOutliner
)
942 rSet
.DisableItem( SID_OUTLINE_BULLET
);
946 if ( pOlView
->GetSelected().Len() == 0 )
948 rSet
.DisableItem( SID_CUT
);
949 rSet
.DisableItem( SID_COPY
);
955 FuBullet::GetSlotState( rSet
, this, GetViewFrame() );
957 if ( GetDocSh()->IsUIActive() )
959 rSet
.DisableItem( SID_INSERT_OBJECT
);
960 rSet
.DisableItem( SID_INSERT_PLUGIN
);
961 rSet
.DisableItem( SID_INSERT_SOUND
);
962 rSet
.DisableItem( SID_INSERT_VIDEO
);
963 rSet
.DisableItem( SID_INSERT_FLOATINGFRAME
);
964 rSet
.DisableItem( SID_INSERT_MATH
);
965 rSet
.DisableItem( SID_INSERT_DIAGRAM
);
966 rSet
.DisableItem( SID_ATTR_TABLE
);
967 rSet
.DisableItem( SID_SIZE_REAL
);
968 rSet
.DisableItem( SID_SIZE_OPTIMAL
);
969 rSet
.DisableItem( SID_SIZE_ALL
);
970 rSet
.DisableItem( SID_SIZE_PAGE_WIDTH
);
971 rSet
.DisableItem( SID_SIZE_PAGE
);
972 rSet
.DisableItem( SID_DUPLICATE_PAGE
);
973 rSet
.DisableItem( SID_ZOOM_TOOLBOX
);
977 if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_ZOOM_IN
) ||
978 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_ZOOM_OUT
)||
979 SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_ZOOM_PANNING
) )
981 if( GetActiveWindow()->GetZoom() <= GetActiveWindow()->GetMinZoom() || GetDocSh()->IsUIActive() )
983 rSet
.DisableItem( SID_ZOOM_IN
);
984 rSet
.DisableItem( SID_ZOOM_PANNING
);
986 if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() )
987 rSet
.DisableItem( SID_ZOOM_OUT
);
990 if (!mpZoomList
->IsNextPossible())
992 rSet
.DisableItem(SID_ZOOM_NEXT
);
994 if (!mpZoomList
->IsPreviousPossible())
996 rSet
.DisableItem(SID_ZOOM_PREV
);
999 if( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_REMOTE_DLG
) )
1002 bool bDisableSdremoteForGood
= false;
1003 #ifndef ENABLE_SDREMOTE
1004 bDisableSdremoteForGood
= true;
1006 uno::Reference
< uno::XComponentContext
> xContext
= comphelper::getProcessComponentContext();
1007 if ( xContext
.is() )
1008 bDisableSdremoteForGood
|= ! ( officecfg::Office::Common::Misc::ExperimentalMode::get( xContext
) &&
1010 officecfg::Office::Impress::Misc::Start::EnableSdremote::get( xContext
) );
1012 // This dialog is only useful for TCP/IP remote control
1013 // which is unusual, under-tested and a security issue.
1014 if ( bDisableSdremoteForGood
)
1016 rSet
.Put(SfxVisibilityItem(SID_REMOTE_DLG
, false));
1021 if (GetViewShellBase().GetViewShellManager()->GetShell(RID_DRAW_TEXT_TOOLBOX
) != NULL
)
1023 sal_uInt16 nCurrentSId
= SID_ATTR_CHAR
;
1025 if(HasCurrentFunction())
1027 nCurrentSId
= GetCurrentFunction()->GetSlotID();
1029 if( nCurrentSId
!= SID_TEXT_FITTOSIZE
&&
1030 nCurrentSId
!= SID_TEXT_FITTOSIZE_VERTICAL
&&
1031 nCurrentSId
!= SID_ATTR_CHAR_VERTICAL
)
1032 nCurrentSId
= SID_ATTR_CHAR
;
1034 rSet
.Put( SfxBoolItem( nCurrentSId
, sal_True
) );
1036 // Short version of UpdateToolboxImages()
1037 rSet
.Put( TbxImageItem( SID_DRAWTBX_TEXT
, nCurrentSId
) );
1040 if ( GetDocSh()->IsReadOnly() )
1042 rSet
.DisableItem( SID_AUTOSPELL_CHECK
);
1046 if (GetDoc()->GetOnlineSpell())
1048 rSet
.Put(SfxBoolItem(SID_AUTOSPELL_CHECK
, sal_True
));
1052 rSet
.Put(SfxBoolItem(SID_AUTOSPELL_CHECK
, sal_False
));
1056 SdrPageView
* pPV
= mpDrawView
->GetSdrPageView();
1057 String aActiveLayer
= mpDrawView
->GetActiveLayer();
1059 if ( ( aActiveLayer
.Len() != 0 && pPV
&& ( pPV
->IsLayerLocked(aActiveLayer
) ||
1060 !pPV
->IsLayerVisible(aActiveLayer
) ) ) ||
1061 SD_MOD()->GetWaterCan() )
1063 rSet
.DisableItem( SID_PASTE
);
1064 rSet
.DisableItem( SID_PASTE_SPECIAL
);
1065 rSet
.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS
);
1067 rSet
.DisableItem( SID_INSERT_FLD_DATE_FIX
);
1068 rSet
.DisableItem( SID_INSERT_FLD_DATE_VAR
);
1069 rSet
.DisableItem( SID_INSERT_FLD_TIME_FIX
);
1070 rSet
.DisableItem( SID_INSERT_FLD_TIME_VAR
);
1071 rSet
.DisableItem( SID_INSERT_FLD_AUTHOR
);
1072 rSet
.DisableItem( SID_INSERT_FLD_PAGE
);
1073 rSet
.DisableItem( SID_INSERT_FLD_PAGES
);
1074 rSet
.DisableItem( SID_INSERT_FLD_FILE
);
1076 rSet
.DisableItem( SID_INSERT_GRAPHIC
);
1077 rSet
.DisableItem( SID_INSERT_AVMEDIA
);
1078 rSet
.DisableItem( SID_INSERT_DIAGRAM
);
1079 rSet
.DisableItem( SID_INSERT_OBJECT
);
1080 rSet
.DisableItem( SID_INSERT_PLUGIN
);
1081 rSet
.DisableItem( SID_INSERT_SOUND
);
1082 rSet
.DisableItem( SID_INSERT_VIDEO
);
1083 rSet
.DisableItem( SID_INSERT_FLOATINGFRAME
);
1085 rSet
.DisableItem( SID_INSERT_MATH
);
1086 rSet
.DisableItem( SID_INSERT_FRAME
);
1087 rSet
.DisableItem( SID_INSERTFILE
);
1088 rSet
.DisableItem( SID_ATTR_TABLE
);
1089 rSet
.DisableItem( SID_COPYOBJECTS
);
1091 rSet
.DisableItem( SID_SCAN
);
1092 rSet
.DisableItem( SID_TWAIN_SELECT
);
1093 rSet
.DisableItem( SID_TWAIN_TRANSFER
);
1095 // rSet.DisableItem( SID_BEZIER_EDIT );
1096 rSet
.DisableItem( SID_GLUE_EDITMODE
);
1097 rSet
.DisableItem( SID_OBJECT_ROTATE
);
1098 rSet
.DisableItem( SID_OBJECT_SHEAR
);
1099 rSet
.DisableItem( SID_OBJECT_MIRROR
);
1100 rSet
.DisableItem( SID_OBJECT_CROP
);
1101 rSet
.DisableItem( SID_ATTR_GRAF_CROP
);
1102 rSet
.DisableItem( SID_OBJECT_TRANSPARENCE
);
1103 rSet
.DisableItem( SID_OBJECT_GRADIENT
);
1104 rSet
.DisableItem( SID_OBJECT_CROOK_ROTATE
);
1105 rSet
.DisableItem( SID_OBJECT_CROOK_SLANT
);
1106 rSet
.DisableItem( SID_OBJECT_CROOK_STRETCH
);
1108 // Disable all object-creating tools
1109 rSet
.ClearItem( SID_ATTR_CHAR
);
1110 rSet
.DisableItem( SID_ATTR_CHAR
);
1111 rSet
.ClearItem( SID_ATTR_CHAR_VERTICAL
);
1112 rSet
.DisableItem( SID_ATTR_CHAR_VERTICAL
);
1113 rSet
.ClearItem(SID_DRAW_LINE
);
1114 rSet
.DisableItem(SID_DRAW_LINE
);
1115 rSet
.ClearItem(SID_DRAW_MEASURELINE
);
1116 rSet
.DisableItem(SID_DRAW_MEASURELINE
);
1117 rSet
.ClearItem(SID_DRAW_XLINE
);
1118 rSet
.DisableItem(SID_DRAW_XLINE
);
1119 rSet
.ClearItem( SID_LINE_ARROW_START
);
1120 rSet
.DisableItem( SID_LINE_ARROW_START
);
1121 rSet
.ClearItem( SID_LINE_ARROW_END
);
1122 rSet
.DisableItem( SID_LINE_ARROW_END
);
1123 rSet
.ClearItem( SID_LINE_ARROWS
);
1124 rSet
.DisableItem( SID_LINE_ARROWS
);
1125 rSet
.ClearItem( SID_LINE_ARROW_CIRCLE
);
1126 rSet
.DisableItem( SID_LINE_ARROW_CIRCLE
);
1127 rSet
.ClearItem( SID_LINE_CIRCLE_ARROW
);
1128 rSet
.DisableItem( SID_LINE_CIRCLE_ARROW
);
1129 rSet
.ClearItem( SID_LINE_ARROW_SQUARE
);
1130 rSet
.DisableItem( SID_LINE_ARROW_SQUARE
);
1131 rSet
.ClearItem( SID_LINE_SQUARE_ARROW
);
1132 rSet
.DisableItem( SID_LINE_SQUARE_ARROW
);
1134 rSet
.ClearItem(SID_DRAW_RECT
);
1135 rSet
.DisableItem(SID_DRAW_RECT
);
1136 rSet
.ClearItem(SID_DRAW_RECT_NOFILL
);
1137 rSet
.DisableItem(SID_DRAW_RECT_NOFILL
);
1138 rSet
.ClearItem(SID_DRAW_RECT_ROUND
);
1139 rSet
.DisableItem(SID_DRAW_RECT_ROUND
);
1140 rSet
.ClearItem(SID_DRAW_RECT_ROUND_NOFILL
);
1141 rSet
.DisableItem(SID_DRAW_RECT_ROUND_NOFILL
);
1142 rSet
.ClearItem(SID_DRAW_SQUARE
);
1143 rSet
.DisableItem(SID_DRAW_SQUARE
);
1144 rSet
.ClearItem(SID_DRAW_SQUARE_NOFILL
);
1145 rSet
.DisableItem(SID_DRAW_SQUARE_NOFILL
);
1146 rSet
.ClearItem(SID_DRAW_SQUARE_ROUND
);
1147 rSet
.DisableItem(SID_DRAW_SQUARE_ROUND
);
1148 rSet
.ClearItem(SID_DRAW_SQUARE_ROUND_NOFILL
);
1149 rSet
.DisableItem(SID_DRAW_SQUARE_ROUND_NOFILL
);
1150 rSet
.ClearItem(SID_DRAW_ELLIPSE
);
1151 rSet
.DisableItem(SID_DRAW_ELLIPSE
);
1152 rSet
.ClearItem(SID_DRAW_ELLIPSE_NOFILL
);
1153 rSet
.DisableItem(SID_DRAW_ELLIPSE_NOFILL
);
1154 rSet
.ClearItem(SID_DRAW_CIRCLE
);
1155 rSet
.DisableItem(SID_DRAW_CIRCLE
);
1156 rSet
.ClearItem(SID_DRAW_CIRCLE_NOFILL
);
1157 rSet
.DisableItem(SID_DRAW_CIRCLE_NOFILL
);
1158 rSet
.ClearItem(SID_DRAW_CAPTION
);
1159 rSet
.DisableItem(SID_DRAW_CAPTION
);
1160 rSet
.ClearItem(SID_DRAW_FONTWORK
);
1161 rSet
.DisableItem(SID_DRAW_FONTWORK
);
1162 rSet
.ClearItem(SID_DRAW_FONTWORK_VERTICAL
);
1163 rSet
.DisableItem(SID_DRAW_FONTWORK_VERTICAL
);
1164 rSet
.ClearItem(SID_DRAW_CAPTION_VERTICAL
);
1165 rSet
.DisableItem(SID_DRAW_CAPTION_VERTICAL
);
1166 rSet
.ClearItem(SID_TEXT_FITTOSIZE
);
1167 rSet
.DisableItem(SID_TEXT_FITTOSIZE
);
1168 rSet
.ClearItem(SID_TEXT_FITTOSIZE_VERTICAL
);
1169 rSet
.DisableItem(SID_TEXT_FITTOSIZE_VERTICAL
);
1170 rSet
.ClearItem(SID_TOOL_CONNECTOR
);
1171 rSet
.DisableItem(SID_TOOL_CONNECTOR
);
1172 rSet
.ClearItem(SID_CONNECTOR_ARROW_START
);
1173 rSet
.DisableItem(SID_CONNECTOR_ARROW_START
);
1174 rSet
.ClearItem(SID_CONNECTOR_ARROW_END
);
1175 rSet
.DisableItem(SID_CONNECTOR_ARROW_END
);
1176 rSet
.ClearItem(SID_CONNECTOR_ARROWS
);
1177 rSet
.DisableItem(SID_CONNECTOR_ARROWS
);
1178 rSet
.ClearItem(SID_CONNECTOR_CIRCLE_START
);
1179 rSet
.DisableItem(SID_CONNECTOR_CIRCLE_START
);
1180 rSet
.ClearItem(SID_CONNECTOR_CIRCLE_END
);
1181 rSet
.DisableItem(SID_CONNECTOR_CIRCLE_END
);
1182 rSet
.ClearItem(SID_CONNECTOR_CIRCLES
);
1183 rSet
.DisableItem(SID_CONNECTOR_CIRCLES
);
1184 rSet
.ClearItem(SID_CONNECTOR_LINE
);
1185 rSet
.DisableItem(SID_CONNECTOR_LINE
);
1186 rSet
.ClearItem(SID_CONNECTOR_LINE_ARROW_START
);
1187 rSet
.DisableItem(SID_CONNECTOR_LINE_ARROW_START
);
1188 rSet
.ClearItem(SID_CONNECTOR_LINE_ARROW_END
);
1189 rSet
.DisableItem(SID_CONNECTOR_LINE_ARROW_END
);
1190 rSet
.ClearItem(SID_CONNECTOR_LINE_ARROWS
);
1191 rSet
.DisableItem(SID_CONNECTOR_LINE_ARROWS
);
1192 rSet
.ClearItem(SID_CONNECTOR_LINE_CIRCLE_START
);
1193 rSet
.DisableItem(SID_CONNECTOR_LINE_CIRCLE_START
);
1194 rSet
.ClearItem(SID_CONNECTOR_LINE_CIRCLE_END
);
1195 rSet
.DisableItem(SID_CONNECTOR_LINE_CIRCLE_END
);
1196 rSet
.ClearItem(SID_CONNECTOR_LINE_CIRCLES
);
1197 rSet
.DisableItem(SID_CONNECTOR_LINE_CIRCLES
);
1198 rSet
.ClearItem(SID_CONNECTOR_CURVE
);
1199 rSet
.DisableItem(SID_CONNECTOR_CURVE
);
1200 rSet
.ClearItem(SID_CONNECTOR_CURVE_ARROW_START
);
1201 rSet
.DisableItem(SID_CONNECTOR_CURVE_ARROW_START
);
1202 rSet
.ClearItem(SID_CONNECTOR_CURVE_ARROW_END
);
1203 rSet
.DisableItem(SID_CONNECTOR_CURVE_ARROW_END
);
1204 rSet
.ClearItem(SID_CONNECTOR_CURVE_ARROWS
);
1205 rSet
.DisableItem(SID_CONNECTOR_CURVE_ARROWS
);
1206 rSet
.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_START
);
1207 rSet
.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_START
);
1208 rSet
.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_END
);
1209 rSet
.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_END
);
1210 rSet
.ClearItem(SID_CONNECTOR_CURVE_CIRCLES
);
1211 rSet
.DisableItem(SID_CONNECTOR_CURVE_CIRCLES
);
1212 rSet
.ClearItem(SID_CONNECTOR_LINES
);
1213 rSet
.DisableItem(SID_CONNECTOR_LINES
);
1214 rSet
.ClearItem(SID_CONNECTOR_LINES_ARROW_START
);
1215 rSet
.DisableItem(SID_CONNECTOR_LINES_ARROW_START
);
1216 rSet
.ClearItem(SID_CONNECTOR_LINES_ARROW_END
);
1217 rSet
.DisableItem(SID_CONNECTOR_LINES_ARROW_END
);
1218 rSet
.ClearItem(SID_CONNECTOR_LINES_ARROWS
);
1219 rSet
.DisableItem(SID_CONNECTOR_LINES_ARROWS
);
1220 rSet
.ClearItem(SID_CONNECTOR_LINES_CIRCLE_START
);
1221 rSet
.DisableItem(SID_CONNECTOR_LINES_CIRCLE_START
);
1222 rSet
.ClearItem(SID_CONNECTOR_LINES_CIRCLE_END
);
1223 rSet
.DisableItem(SID_CONNECTOR_LINES_CIRCLE_END
);
1224 rSet
.ClearItem(SID_CONNECTOR_LINES_CIRCLES
);
1225 rSet
.DisableItem(SID_CONNECTOR_LINES_CIRCLES
);
1226 rSet
.ClearItem(SID_DRAW_ARC
);
1227 rSet
.DisableItem(SID_DRAW_ARC
);
1228 rSet
.ClearItem(SID_DRAW_CIRCLEARC
);
1229 rSet
.DisableItem(SID_DRAW_CIRCLEARC
);
1230 rSet
.ClearItem(SID_DRAW_PIE
);
1231 rSet
.DisableItem(SID_DRAW_PIE
);
1232 rSet
.ClearItem(SID_DRAW_PIE_NOFILL
);
1233 rSet
.DisableItem(SID_DRAW_PIE_NOFILL
);
1234 rSet
.ClearItem(SID_DRAW_CIRCLEPIE
);
1235 rSet
.DisableItem(SID_DRAW_CIRCLEPIE
);
1236 rSet
.ClearItem(SID_DRAW_CIRCLEPIE_NOFILL
);
1237 rSet
.DisableItem(SID_DRAW_CIRCLEPIE_NOFILL
);
1238 rSet
.ClearItem(SID_DRAW_ELLIPSECUT
);
1239 rSet
.DisableItem(SID_DRAW_ELLIPSECUT
);
1240 rSet
.ClearItem(SID_DRAW_ELLIPSECUT_NOFILL
);
1241 rSet
.DisableItem(SID_DRAW_ELLIPSECUT_NOFILL
);
1242 rSet
.ClearItem(SID_DRAW_CIRCLECUT
);
1243 rSet
.DisableItem(SID_DRAW_CIRCLECUT
);
1244 rSet
.ClearItem(SID_DRAW_CIRCLECUT_NOFILL
);
1245 rSet
.DisableItem(SID_DRAW_CIRCLECUT_NOFILL
);
1246 rSet
.ClearItem(SID_DRAW_POLYGON
);
1247 rSet
.DisableItem(SID_DRAW_POLYGON
);
1248 rSet
.ClearItem(SID_DRAW_POLYGON_NOFILL
);
1249 rSet
.DisableItem(SID_DRAW_POLYGON_NOFILL
);
1250 rSet
.ClearItem(SID_DRAW_FREELINE
);
1251 rSet
.DisableItem(SID_DRAW_FREELINE
);
1252 rSet
.ClearItem(SID_DRAW_FREELINE_NOFILL
);
1253 rSet
.DisableItem(SID_DRAW_FREELINE_NOFILL
);
1254 rSet
.ClearItem(SID_DRAW_XPOLYGON
);
1255 rSet
.DisableItem(SID_DRAW_XPOLYGON
);
1256 rSet
.ClearItem(SID_DRAW_XPOLYGON_NOFILL
);
1257 rSet
.DisableItem(SID_DRAW_XPOLYGON_NOFILL
);
1258 rSet
.ClearItem(SID_DRAW_BEZIER_FILL
);
1259 rSet
.DisableItem(SID_DRAW_BEZIER_FILL
);
1260 rSet
.ClearItem(SID_DRAW_BEZIER_NOFILL
);
1261 rSet
.DisableItem(SID_DRAW_BEZIER_NOFILL
);
1262 rSet
.ClearItem(SID_3D_CUBE
);
1263 rSet
.DisableItem(SID_3D_CUBE
);
1264 rSet
.ClearItem(SID_3D_SHELL
);
1265 rSet
.DisableItem(SID_3D_SHELL
);
1266 rSet
.ClearItem(SID_3D_SPHERE
);
1267 rSet
.DisableItem(SID_3D_SPHERE
);
1268 rSet
.ClearItem(SID_3D_HALF_SPHERE
);
1269 rSet
.DisableItem(SID_3D_HALF_SPHERE
);
1270 rSet
.ClearItem(SID_3D_CYLINDER
);
1271 rSet
.DisableItem(SID_3D_CYLINDER
);
1272 rSet
.ClearItem(SID_3D_CONE
);
1273 rSet
.DisableItem(SID_3D_CONE
);
1274 rSet
.ClearItem(SID_3D_TORUS
);
1275 rSet
.DisableItem(SID_3D_TORUS
);
1276 rSet
.ClearItem(SID_3D_PYRAMID
);
1277 rSet
.DisableItem(SID_3D_PYRAMID
);
1280 // are the modules available?
1282 if (!SvtModuleOptions().IsCalc())
1284 // remove menu entry if module is not available
1285 rSet
.Put( SfxVisibilityItem( SID_ATTR_TABLE
, sal_False
) );
1287 if (!SvtModuleOptions().IsChart())
1289 rSet
.DisableItem( SID_INSERT_DIAGRAM
);
1291 if (!SvtModuleOptions().IsMath())
1293 rSet
.DisableItem( SID_INSERT_MATH
);
1296 rtl::Reference
< sd::SlideShow
> xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
1297 if( (xSlideshow
.is() && xSlideshow
->isRunning() && (xSlideshow
->getAnimationMode() != ANIMATIONMODE_PREVIEW
) ) || GetDocSh()->IsPreview() )
1300 rSet
.DisableItem( SID_PRESENTATION
);
1301 rSet
.DisableItem( SID_ZOOM_IN
);
1302 rSet
.DisableItem( SID_ZOOM_OUT
);
1303 rSet
.DisableItem( SID_ZOOM_PANNING
);
1304 rSet
.DisableItem( SID_ZOOM_NEXT
);
1305 rSet
.DisableItem( SID_ZOOM_PREV
);
1306 rSet
.DisableItem( SID_SIZE_REAL
);
1307 rSet
.DisableItem( SID_SIZE_OPTIMAL
);
1308 rSet
.DisableItem( SID_SIZE_ALL
);
1309 rSet
.DisableItem( SID_SIZE_PAGE_WIDTH
);
1310 rSet
.DisableItem( SID_SIZE_PAGE
);
1311 rSet
.DisableItem( SID_INSERTPAGE
);
1312 rSet
.DisableItem( SID_DUPLICATE_PAGE
);
1313 rSet
.DisableItem( SID_MODIFYPAGE
);
1314 rSet
.DisableItem( SID_RENAMEPAGE
);
1315 rSet
.DisableItem( SID_RENAMEPAGE_QUICK
);
1316 rSet
.DisableItem( SID_DELETE_PAGE
);
1317 rSet
.DisableItem( SID_PAGESETUP
);
1319 if( xSlideshow
.is() && xSlideshow
->isRunning() )
1321 rSet
.ClearItem(SID_OBJECT_ALIGN
);
1322 rSet
.ClearItem(SID_ZOOM_TOOLBOX
);
1323 rSet
.ClearItem(SID_OBJECT_CHOOSE_MODE
);
1324 rSet
.ClearItem(SID_DRAWTBX_TEXT
);
1325 rSet
.ClearItem(SID_DRAWTBX_RECTANGLES
);
1326 rSet
.ClearItem(SID_DRAWTBX_ELLIPSES
);
1327 rSet
.ClearItem(SID_DRAWTBX_LINES
);
1328 rSet
.ClearItem(SID_DRAWTBX_ARROWS
);
1329 rSet
.ClearItem(SID_DRAWTBX_3D_OBJECTS
);
1330 rSet
.ClearItem(SID_DRAWTBX_CONNECTORS
);
1331 rSet
.ClearItem(SID_OBJECT_CHOOSE_MODE
);
1332 rSet
.ClearItem(SID_DRAWTBX_INSERT
);
1333 rSet
.ClearItem(SID_INSERTFILE
);
1334 rSet
.ClearItem(SID_OBJECT_ROTATE
);
1335 rSet
.ClearItem(SID_OBJECT_ALIGN
);
1336 rSet
.ClearItem(SID_POSITION
);
1337 rSet
.ClearItem(SID_FM_CONFIG
);
1338 rSet
.ClearItem(SID_ANIMATION_EFFECTS
);
1339 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
1340 rSet
.ClearItem(SID_3D_WIN
);
1342 rSet
.DisableItem(SID_OBJECT_ALIGN
);
1343 rSet
.DisableItem(SID_ZOOM_TOOLBOX
);
1344 rSet
.DisableItem(SID_OBJECT_CHOOSE_MODE
);
1345 rSet
.DisableItem(SID_DRAWTBX_TEXT
);
1346 rSet
.DisableItem(SID_DRAWTBX_RECTANGLES
);
1347 rSet
.DisableItem(SID_DRAWTBX_ELLIPSES
);
1348 rSet
.DisableItem(SID_DRAWTBX_LINES
);
1349 rSet
.DisableItem(SID_DRAWTBX_ARROWS
);
1350 rSet
.DisableItem(SID_DRAWTBX_3D_OBJECTS
);
1351 rSet
.DisableItem(SID_DRAWTBX_CONNECTORS
);
1352 rSet
.DisableItem(SID_OBJECT_CHOOSE_MODE
);
1353 rSet
.DisableItem(SID_DRAWTBX_INSERT
);
1354 rSet
.DisableItem(SID_INSERTFILE
);
1355 rSet
.DisableItem(SID_OBJECT_ROTATE
);
1356 rSet
.DisableItem(SID_OBJECT_ALIGN
);
1357 rSet
.DisableItem(SID_POSITION
);
1358 rSet
.DisableItem(SID_FM_CONFIG
);
1359 rSet
.DisableItem(SID_ANIMATION_EFFECTS
);
1360 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
1361 rSet
.DisableItem(SID_3D_WIN
);
1365 ///////////////////////////////////////////////////////////////////////
1366 // Menuoption: Change->Convert->To Bitmap, Change->Convert->To Metafile
1367 // disable, if there only Bitmap or Metafiles marked
1368 // Menuoption: Format->Area, Format->Line
1369 // disabled, if the marked objects not able to handle
1373 bool bSingleGraphicSelected
= false;
1375 if (!mpDrawView
->AreObjectsMarked())
1377 rSet
.DisableItem (SID_CONVERT_TO_METAFILE
);
1378 rSet
.DisableItem (SID_CONVERT_TO_BITMAP
);
1383 SdrMarkList aMarkList
= mpDrawView
->GetMarkedObjectList();
1385 sal_Bool bFoundBitmap
= sal_False
;
1386 sal_Bool bFoundMetafile
= sal_False
;
1387 sal_Bool bFoundObjNoLine
= sal_False
;
1388 sal_Bool bFoundObjNoArea
= sal_False
;
1389 sal_Bool bFoundNoGraphicObj
= sal_False
;
1390 sal_Bool bFoundAny
= sal_False
;
1391 bool bFoundTable
= false;
1393 // const int nMarkCount = (int) aMarkList.GetMarkCount();
1394 for (sal_uLong i
=0; i
< nMarkCount
&& !bFoundAny
; i
++)
1396 SdrObject
* pObj
= aMarkList
.GetMark(i
)->GetMarkedSdrObj();
1397 sal_uInt16 nId
= pObj
->GetObjIdentifier();
1398 sal_uInt32 nInv
= pObj
->GetObjInventor();
1400 if(nInv
== SdrInventor
)
1411 bFoundObjNoArea
= sal_True
;
1412 bFoundNoGraphicObj
= sal_True
;
1415 // #i118485# #i118525# Allow Line, Area and Graphic (Metafile, Bitmap)
1416 bSingleGraphicSelected
= nMarkCount
== 1;
1417 bFoundBitmap
= true;
1418 bFoundMetafile
= true;
1422 bSingleGraphicSelected
= nMarkCount
== 1;
1423 const SdrGrafObj
* pSdrGrafObj
= static_cast< const SdrGrafObj
* >(pObj
);
1424 switch(pSdrGrafObj
->GetGraphicType())
1426 case GRAPHIC_BITMAP
:
1427 bFoundBitmap
= sal_True
;
1428 if(pSdrGrafObj
->isEmbeddedSvg())
1430 bFoundMetafile
= true;
1433 case GRAPHIC_GDIMETAFILE
:
1434 bFoundMetafile
= sal_True
;
1445 bFoundAny
= sal_True
;
1448 else if(nInv
== E3dInventor
)
1451 bFoundAny
= sal_True
;
1456 rSet
.DisableItem( SID_ATTRIBUTES_LINE
);
1460 // Disable menuitem for area-dialog
1461 if( bFoundObjNoArea
) // #i25616#
1462 rSet
.DisableItem( SID_ATTRIBUTES_AREA
);
1464 // Disable menuitem for line-dialog
1465 if( bFoundObjNoLine
)
1466 rSet
.DisableItem( SID_ATTRIBUTES_LINE
);
1468 if( bFoundBitmap
&& !bFoundMetafile
&& !bFoundNoGraphicObj
) // only Bitmaps marked
1469 rSet
.DisableItem( SID_CONVERT_TO_BITMAP
);
1470 else if( !bFoundBitmap
&& bFoundMetafile
&& !bFoundNoGraphicObj
) // only Metafiles marked
1471 rSet
.DisableItem( SID_CONVERT_TO_METAFILE
);
1472 else if( !bFoundBitmap
&& !bFoundMetafile
&& !bFoundNoGraphicObj
) // nothing to do
1474 rSet
.DisableItem( SID_CONVERT_TO_BITMAP
);
1475 rSet
.DisableItem( SID_CONVERT_TO_METAFILE
);
1480 if( !bSingleGraphicSelected
)
1482 rSet
.DisableItem (SID_OBJECT_CROP
);
1483 rSet
.DisableItem (SID_ATTR_GRAF_CROP
);
1486 ///////////////////////////////////////////////////////////////////////
1487 // Menuoption: Edit->Hyperlink
1488 // Disable, if there is no hyperlink
1490 sal_Bool bDisableEditHyperlink
= sal_True
;
1491 if( mpDrawView
->AreObjectsMarked() && ( mpDrawView
->GetMarkedObjectList().GetMarkCount() == 1 ) )
1493 if( mpDrawView
->IsTextEdit() )
1495 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
1498 const SvxFieldItem
* pFieldItem
= pOLV
->GetFieldAtSelection();
1501 ESelection aSel
= pOLV
->GetSelection();
1502 if ( abs( aSel
.nEndPos
- aSel
.nStartPos
) == 1 )
1504 const SvxFieldData
* pField
= pFieldItem
->GetField();
1505 if ( pField
->ISA(SvxURLField
) )
1506 bDisableEditHyperlink
= sal_False
;
1513 SdrUnoObj
* pUnoCtrl
= PTR_CAST(SdrUnoObj
, mpDrawView
->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj());
1515 if ( pUnoCtrl
&& FmFormInventor
== pUnoCtrl
->GetObjInventor() )
1517 uno::Reference
< awt::XControlModel
> xControlModel( pUnoCtrl
->GetUnoControlModel() );
1518 if( xControlModel
.is() )
1520 uno::Reference
< beans::XPropertySet
> xPropSet( xControlModel
, uno::UNO_QUERY
);
1523 uno::Reference
< beans::XPropertySetInfo
> xPropInfo( xPropSet
->getPropertySetInfo() );
1524 if( xPropInfo
.is() && xPropInfo
->hasPropertyByName( "TargetURL") )
1526 bDisableEditHyperlink
= sal_False
;
1534 //highlight selected custom shape
1536 sal_uInt16 nCurrentSId
= 0;
1537 if(HasCurrentFunction())
1538 nCurrentSId
= GetCurrentFunction()->GetSlotID();
1540 if ( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_DRAWTBX_CS_BASIC
) )
1541 rSet
.Put(SfxBoolItem(SID_DRAWTBX_CS_BASIC
, SID_DRAWTBX_CS_BASIC
== nCurrentSId
));
1542 if ( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_DRAWTBX_CS_SYMBOL
) )
1543 rSet
.Put(SfxBoolItem(SID_DRAWTBX_CS_SYMBOL
, SID_DRAWTBX_CS_SYMBOL
== nCurrentSId
));
1544 if ( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_DRAWTBX_CS_ARROW
) )
1545 rSet
.Put(SfxBoolItem(SID_DRAWTBX_CS_ARROW
, SID_DRAWTBX_CS_ARROW
== nCurrentSId
));
1546 if ( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_DRAWTBX_CS_FLOWCHART
) )
1547 rSet
.Put(SfxBoolItem(SID_DRAWTBX_CS_FLOWCHART
, SID_DRAWTBX_CS_FLOWCHART
== nCurrentSId
));
1548 if ( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_DRAWTBX_CS_CALLOUT
) )
1549 rSet
.Put(SfxBoolItem(SID_DRAWTBX_CS_CALLOUT
,SID_DRAWTBX_CS_CALLOUT
== nCurrentSId
));
1550 if ( SFX_ITEM_AVAILABLE
== rSet
.GetItemState( SID_DRAWTBX_CS_STAR
) )
1551 rSet
.Put(SfxBoolItem(SID_DRAWTBX_CS_STAR
, SID_DRAWTBX_CS_STAR
== nCurrentSId
));
1554 if ( bDisableEditHyperlink
|| GetDocSh()->IsReadOnly() )
1555 rSet
.DisableItem( SID_EDIT_HYPERLINK
);
1557 if ( bDisableEditHyperlink
)
1558 rSet
.DisableItem( SID_OPEN_HYPERLINK
);
1560 #if defined WNT || defined UNX
1561 if( !mxScannerManager
.is() )
1563 rSet
.DisableItem( SID_TWAIN_SELECT
);
1564 rSet
.DisableItem( SID_TWAIN_TRANSFER
);
1568 // Set the state of two entries in the 'Slide' context sub-menu
1569 // concerning the visibility of master page background and master page
1571 if (rSet
.GetItemState(SID_DISPLAY_MASTER_BACKGROUND
) == SFX_ITEM_AVAILABLE
1572 || rSet
.GetItemState(SID_DISPLAY_MASTER_OBJECTS
) == SFX_ITEM_AVAILABLE
)
1574 SdPage
* pPage
= GetActualPage();
1576 && GetDoc() != NULL
)
1578 SetOfByte aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
1579 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
1580 sal_uInt8 aBackgroundId
= rLayerAdmin
.GetLayerID(String(SdResId(STR_LAYER_BCKGRND
)), sal_False
);
1581 sal_uInt8 aObjectId
= rLayerAdmin
.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ
)), sal_False
);
1582 rSet
.Put(SfxBoolItem(SID_DISPLAY_MASTER_BACKGROUND
,
1583 aVisibleLayers
.IsSet(aBackgroundId
)));
1584 rSet
.Put(SfxBoolItem(SID_DISPLAY_MASTER_OBJECTS
,
1585 aVisibleLayers
.IsSet(aObjectId
)));
1589 GetModeSwitchingMenuState (rSet
);
1592 void DrawViewShell::GetModeSwitchingMenuState (SfxItemSet
&rSet
)
1595 rSet
.Put(SfxBoolItem(SID_DIAMODE
, sal_False
));
1596 rSet
.Put(SfxBoolItem(SID_OUTLINEMODE
, sal_False
));
1597 if (mePageKind
== PK_NOTES
)
1599 rSet
.Put(SfxBoolItem(SID_DRAWINGMODE
, sal_False
));
1600 rSet
.Put(SfxBoolItem(SID_NOTESMODE
, sal_True
));
1601 rSet
.Put(SfxBoolItem(SID_HANDOUTMODE
, sal_False
));
1603 else if (mePageKind
== PK_HANDOUT
)
1605 rSet
.Put(SfxBoolItem(SID_DRAWINGMODE
, sal_False
));
1606 rSet
.Put(SfxBoolItem(SID_NOTESMODE
, sal_False
));
1607 rSet
.Put(SfxBoolItem(SID_HANDOUTMODE
, sal_True
));
1611 rSet
.Put(SfxBoolItem(SID_DRAWINGMODE
, sal_True
));
1612 rSet
.Put(SfxBoolItem(SID_NOTESMODE
, sal_False
));
1613 rSet
.Put(SfxBoolItem(SID_HANDOUTMODE
, sal_False
));
1616 // Removed [GetDocSh()->GetCurrentFunction() ||] from the following
1617 // clause because the current function of the docshell can only be
1618 // search and replace or spell checking and in that case switching the
1619 // view mode is allowed.
1620 const bool bIsRunning
= SlideShow::IsRunning(GetViewShellBase());
1622 if (GetViewFrame()->GetFrame().IsInPlace() || bIsRunning
)
1624 if ( !GetViewFrame()->GetFrame().IsInPlace() )
1626 rSet
.ClearItem( SID_DRAWINGMODE
);
1627 rSet
.DisableItem( SID_DRAWINGMODE
);
1630 rSet
.ClearItem( SID_NOTESMODE
);
1631 rSet
.DisableItem( SID_NOTESMODE
);
1633 rSet
.ClearItem( SID_HANDOUTMODE
);
1634 rSet
.DisableItem( SID_HANDOUTMODE
);
1636 rSet
.ClearItem( SID_OUTLINEMODE
);
1637 rSet
.DisableItem( SID_OUTLINEMODE
);
1639 rSet
.ClearItem( SID_DIAMODE
);
1640 rSet
.DisableItem( SID_DIAMODE
);
1643 if (GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED
)
1645 // Outplace-Edit: do not allow switch
1646 rSet
.ClearItem( SID_OUTLINEMODE
);
1647 rSet
.DisableItem( SID_OUTLINEMODE
);
1649 rSet
.ClearItem( SID_DIAMODE
);
1650 rSet
.DisableItem( SID_DIAMODE
);
1652 rSet
.ClearItem( SID_NOTESMODE
);
1653 rSet
.DisableItem( SID_NOTESMODE
);
1655 rSet
.ClearItem( SID_HANDOUTMODE
);
1656 rSet
.DisableItem( SID_HANDOUTMODE
);
1659 svx::ExtrusionBar::getState( mpDrawView
, rSet
);
1660 svx::FontworkBar::getState( mpDrawView
, rSet
);
1665 void DrawViewShell::GetState (SfxItemSet
& rSet
)
1667 // Iterate over all requested items in the set.
1668 SfxWhichIter
aIter( rSet
);
1669 sal_uInt16 nWhich
= aIter
.FirstWhich();
1674 case SID_SEARCH_ITEM
:
1675 case SID_SEARCH_OPTIONS
:
1676 // Forward this request to the common (old) code of the
1678 GetDocSh()->GetState (rSet
);
1681 OSL_TRACE ("DrawViewShell::GetState(): can not handle which id %d", nWhich
);
1684 nWhich
= aIter
.NextWhich();
1691 void DrawViewShell::Execute (SfxRequest
& rReq
)
1693 if(SlideShow::IsRunning(GetViewShellBase()))
1695 // Do not execute anything during a native slide show.
1699 switch (rReq
.GetSlot())
1701 case SID_SEARCH_ITEM
:
1702 // Forward this request to the common (old) code of the
1704 GetDocSh()->Execute (rReq
);
1707 case SID_SPELL_DIALOG
:
1709 SfxViewFrame
* pViewFrame
= GetViewFrame();
1710 if (rReq
.GetArgs() != NULL
)
1711 pViewFrame
->SetChildWindow (SID_SPELL_DIALOG
,
1712 ((const SfxBoolItem
&) (rReq
.GetArgs()->
1713 Get(SID_SPELL_DIALOG
))).GetValue());
1715 pViewFrame
->ToggleChildWindow(SID_SPELL_DIALOG
);
1717 pViewFrame
->GetBindings().Invalidate(SID_SPELL_DIALOG
);
1723 OSL_TRACE ("DrawViewShell::Execute(): can not handle slot %d", rReq
.GetSlot());
1728 } // end of namespace sd
1730 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */