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 <sal/config.h>
24 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
25 #include <com/sun/star/lang/Locale.hpp>
26 #include <com/sun/star/linguistic2/XThesaurus.hpp>
27 #include <svx/fmglob.hxx>
28 #include <svx/globl3d.hxx>
29 #include <svx/svdouno.hxx>
30 #include <editeng/eeitem.hxx>
31 #include <editeng/flditem.hxx>
32 #include <editeng/outlobj.hxx>
33 #include <officecfg/Office/Common.hxx>
34 #include <officecfg/Office/Impress.hxx>
35 #include <svx/svxids.hrc>
36 #include <svx/svdpagv.hxx>
37 #include <svx/clipfmtitem.hxx>
38 #include <svx/fmshell.hxx>
39 #include <svl/eitem.hxx>
40 #include <svl/aeitem.hxx>
41 #include <svl/stritem.hxx>
42 #include <svl/visitem.hxx>
43 #include <svl/whiter.hxx>
44 #include <sfx2/dispatch.hxx>
45 #include <svx/svdograf.hxx>
46 #include <editeng/unolingu.hxx>
47 #include <svx/extrusionbar.hxx>
48 #include <svx/fontworkbar.hxx>
51 #include <svl/slstitm.hxx>
52 #include <sfx2/app.hxx>
53 #include <svtools/insdlg.hxx>
54 #include <unotools/moduleoptions.hxx>
55 #include <svl/languageoptions.hxx>
56 #include <comphelper/processfactory.hxx>
57 #include <sfx2/request.hxx>
59 #include <svx/pfiledlg.hxx>
60 #include <svx/grafctrl.hxx>
61 #include <svtools/cliplistener.hxx>
62 #include <sfx2/viewfrm.hxx>
66 #include "res_bmp.hrc"
67 #include "PresentationViewShell.hxx"
69 #include "Outliner.hxx"
70 #include "drawdoc.hxx"
71 #include "sdresid.hxx"
74 #include "DrawDocShell.hxx"
75 #include "zoomlist.hxx"
76 #include "slideshow.hxx"
77 #include "drawview.hxx"
78 #include "ViewShellBase.hxx"
79 #include "ViewShellManager.hxx"
80 #include "LayerTabBar.hxx"
83 #include "fuediglu.hxx"
84 #include "fubullet.hxx"
85 #include "fuformatpaintbrush.hxx"
87 #include <config_features.h>
89 using namespace ::com::sun::star
;
90 using namespace ::com::sun::star::uno
;
91 using namespace ::com::sun::star::lang
;
92 using namespace ::com::sun::star::linguistic2
;
94 /** Create a list of clipboard formats that are supported both from the
95 current clipboard content and the DrawViewShell.
96 The list is stored in a new instance of SvxClipboardFormatItem.
98 ::std::unique_ptr
<SvxClipboardFormatItem
> GetSupportedClipboardFormats (
99 TransferableDataHelper
& rDataHelper
)
101 ::std::unique_ptr
<SvxClipboardFormatItem
> pResult (
102 new SvxClipboardFormatItem(SID_CLIPBOARD_FORMAT_ITEMS
));
104 sal_uInt32
nFormatCount (rDataHelper
.GetFormatCount());
105 for (sal_uInt32 i
=0; i
<nFormatCount
; i
++)
107 const SotClipboardFormatId nTestFormat
= rDataHelper
.GetFormat(i
);
109 // Check if the current format is the same as one that has already
111 bool bDuplicate (false);
112 for (sal_uInt32 j
=0; j
<i
; j
++)
114 if (nTestFormat
== rDataHelper
.GetFormat(j
))
121 // Look up the format among those that are supported by the
127 case SotClipboardFormatId::EMBED_SOURCE
:
131 TransferableObjectDescriptor aDescriptor
;
132 if (rDataHelper
.GetTransferableObjectDescriptor(
133 SotClipboardFormatId::OBJECTDESCRIPTOR
, aDescriptor
))
135 sName
= aDescriptor
.maTypeName
;
137 if (!sName
.isEmpty())
138 pResult
->AddClipbrdFormat(nTestFormat
, sName
);
140 pResult
->AddClipbrdFormat(nTestFormat
);
145 case SotClipboardFormatId::LINK_SOURCE
:
146 case SotClipboardFormatId::DRAWING
:
147 case SotClipboardFormatId::SVXB
:
148 case SotClipboardFormatId::GDIMETAFILE
:
149 case SotClipboardFormatId::BITMAP
:
150 case SotClipboardFormatId::NETSCAPE_BOOKMARK
:
151 case SotClipboardFormatId::STRING
:
152 case SotClipboardFormatId::HTML
:
153 case SotClipboardFormatId::RTF
:
154 case SotClipboardFormatId::EDITENGINE
:
155 pResult
->AddClipbrdFormat(nTestFormat
);
162 // Check some OLE formats whose names are handled differently.
163 SotClipboardFormatId
nFormat (SotClipboardFormatId::EMBED_SOURCE_OLE
);
164 bool bHasFormat (rDataHelper
.HasFormat(nFormat
));
167 bHasFormat
= rDataHelper
.HasFormat(nFormat
);
173 if (SvPasteObjectHelper::GetEmbeddedName (rDataHelper
, sName
, sSource
, nFormat
))
174 pResult
->AddClipbrdFormat (nFormat
, sName
);
182 IMPL_LINK( DrawViewShell
, ClipboardChanged
, TransferableDataHelper
*, pDataHelper
)
186 mbPastePossible
= ( pDataHelper
->GetFormatCount() != 0 );
188 // Update the list of supported clipboard formats according to the
189 // new clipboard content.
190 // There are some stack traces that indicate the possibility of the
191 // DrawViewShell destructor called during the call to
192 // GetSupportedClipboardFormats(). If that really has happened then
194 TransferableDataHelper
aDataHelper (
195 TransferableDataHelper::CreateFromSystemClipboard(GetActiveWindow()));
196 ::std::unique_ptr
<SvxClipboardFormatItem
> pFormats (GetSupportedClipboardFormats(aDataHelper
));
197 if (mpDrawView
== NULL
)
199 mpCurrentClipboardFormats
= std::move(pFormats
);
201 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
202 rBindings
.Invalidate( SID_PASTE
);
203 rBindings
.Invalidate( SID_PASTE_SPECIAL
);
204 rBindings
.Invalidate( SID_PASTE_UNFORMATTED
);
205 rBindings
.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS
);
210 void DrawViewShell::GetDrawAttrState(SfxItemSet
& rSet
)
212 SfxItemSet
aSet( mpDrawView
->GetGeoAttrFromMarked() );
213 rSet
.Put(aSet
,false);
216 ::Outliner
* DrawViewShell::GetOutlinerForMasterPageOutlineTextObj(ESelection
&rSel
)
221 //when there is one object selected
222 if (!mpDrawView
->AreObjectsMarked() || (mpDrawView
->GetMarkedObjectList().GetMarkCount() != 1))
225 //and we are editing the outline object
226 if (!mpDrawView
->IsTextEdit())
229 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
233 SdPage
* pPage
= static_cast<SdPage
*>(pPageView
->GetPage());
234 //only show these in a normal master page
235 if (!pPage
|| (pPage
->GetPageKind() != PK_STANDARD
) || !pPage
->IsMasterPage())
238 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
239 ::Outliner
* pOL
= pOLV
? pOLV
->GetOutliner() : NULL
;
242 rSel
= pOLV
->GetSelection();
247 void DrawViewShell::GetMenuState( SfxItemSet
&rSet
)
249 if (mpDrawView
== NULL
)
251 // This assertion and return are here to prevent crashes.
252 DBG_ASSERT(mpDrawView
!=NULL
, "Please report this assertion to the Impress team.");
256 ViewShell::GetMenuState(rSet
);
257 bool bDisableVerticalText
= !SvtLanguageOptions().IsVerticalTextEnabled();
259 if ( bDisableVerticalText
)
261 rSet
.DisableItem( SID_DRAW_FONTWORK_VERTICAL
);
262 rSet
.DisableItem( SID_DRAW_CAPTION_VERTICAL
);
263 rSet
.DisableItem( SID_TEXT_FITTOSIZE_VERTICAL
);
264 rSet
.DisableItem( SID_DRAW_TEXT_VERTICAL
);
267 bool bConvertToPathPossible
= mpDrawView
->IsConvertToPathObjPossible(false);
269 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
270 const size_t nMarkCount
= rMarkList
.GetMarkCount();
273 FuFormatPaintBrush::GetMenuState( *this, rSet
);
275 // State of SfxChild-Windows (Animator, Fontwork etc.)
276 SetChildWindowState( rSet
);
278 // map images of toolboxes (only zoom)
279 UpdateToolboxImages( rSet
, false );
281 if(HasCurrentFunction())
283 sal_uInt16 nSId
= GetCurrentFunction()->GetSlotID();
285 rSet
.Put( SfxBoolItem( nSId
, true ) );
287 // will cause a uncheck of a simulated slot
288 sal_uInt16 nId
= GetIdBySubId( nSId
);
290 // map images of the toolboxes
291 UpdateToolboxImages( rSet
);
293 if( nSId
!= SID_ZOOM_TOOLBOX
&&
294 nSId
!= SID_DRAWTBX_INSERT
&&
295 nSId
!= SID_POSITION
&&
296 nSId
!= SID_OBJECT_ALIGN
)
298 if( nId
!= SID_OBJECT_CHOOSE_MODE
)
299 rSet
.Put( TbxImageItem( SID_OBJECT_CHOOSE_MODE
, 0 ) );
300 if( nId
!= SID_DRAWTBX_TEXT
)
301 rSet
.Put( TbxImageItem( SID_DRAWTBX_TEXT
, 0 ) );
302 if( nId
!= SID_DRAWTBX_RECTANGLES
)
303 rSet
.Put( TbxImageItem( SID_DRAWTBX_RECTANGLES
, 0 ) );
304 if( nId
!= SID_DRAWTBX_ELLIPSES
)
305 rSet
.Put( TbxImageItem( SID_DRAWTBX_ELLIPSES
, 0 ) );
306 if( nId
!= SID_DRAWTBX_LINES
)
307 rSet
.Put( TbxImageItem( SID_DRAWTBX_LINES
, 0 ) );
308 if( nId
!= SID_DRAWTBX_ARROWS
)
309 rSet
.Put( TbxImageItem( SID_DRAWTBX_ARROWS
, 0 ) );
310 if( nId
!= SID_DRAWTBX_3D_OBJECTS
)
311 rSet
.Put( TbxImageItem( SID_DRAWTBX_3D_OBJECTS
, 0 ) );
312 if( nId
!= SID_DRAWTBX_CONNECTORS
)
313 rSet
.Put( TbxImageItem( SID_DRAWTBX_CONNECTORS
, 0 ) );
317 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
319 GetMenuStateSel(rSet
);
321 if (SfxItemState::DEFAULT
== rSet
.GetItemState(SID_ASSIGN_LAYOUT
))
323 bool bDisable
= true;
326 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
328 if( pPage
&& !pPage
->IsMasterPage() )
330 rSet
.Put( SfxUInt32Item( SID_ASSIGN_LAYOUT
, static_cast< sal_uInt32
>(pPage
->GetAutoLayout()) ) );
337 rSet
.DisableItem(SID_ASSIGN_LAYOUT
);
341 if (SfxItemState::DEFAULT
== rSet
.GetItemState(SID_EXPAND_PAGE
))
343 bool bDisable
= true;
346 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
348 if( pPage
&& (pPage
->GetPageKind() == PK_STANDARD
) && !pPage
->IsMasterPage() )
350 SdrObject
* pObj
= pPage
->GetPresObj(PRESOBJ_OUTLINE
);
354 if( !pObj
->IsEmptyPresObj() )
360 // check if the object is in edit, than its temporarely not empty
361 SdrTextObj
* pTextObj
= dynamic_cast< SdrTextObj
* >( pObj
);
364 OutlinerParaObject
* pParaObj
= pTextObj
->GetEditOutlinerParaObject();
378 rSet
.DisableItem(SID_EXPAND_PAGE
);
382 if (SfxItemState::DEFAULT
== rSet
.GetItemState(SID_SUMMARY_PAGE
))
384 bool bDisable
= true;
387 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
389 if( pPage
&& (pPage
->GetPageKind() == PK_STANDARD
) && !pPage
->IsMasterPage() )
391 SdrObject
* pObj
= pPage
->GetPresObj(PRESOBJ_TITLE
);
393 if(pObj
&& !pObj
->IsEmptyPresObj())
402 rSet
.DisableItem(SID_SUMMARY_PAGE
);
406 if (SfxItemState::DEFAULT
== rSet
.GetItemState(SID_ASSIGN_LAYOUT
))
408 bool bDisable
= true;
411 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
413 if( pPage
&& !pPage
->IsMasterPage() )
415 rSet
.Put( SfxUInt32Item(SID_ASSIGN_LAYOUT
, pPage
->GetAutoLayout()) );
422 rSet
.DisableItem(SID_ASSIGN_LAYOUT
);
426 // is it possible to start the presentation?
427 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_PRESENTATION
) ||
428 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_REHEARSE_TIMINGS
) )
430 bool bDisable
= true;
431 sal_uInt16 nCount
= GetDoc()->GetSdPageCount( PK_STANDARD
);
433 for( sal_uInt16 i
= 0; i
< nCount
&& bDisable
; i
++ )
435 SdPage
* pPage
= GetDoc()->GetSdPage(i
, PK_STANDARD
);
437 if( !pPage
->IsExcluded() )
441 if( bDisable
|| GetDocSh()->IsPreview())
443 rSet
.DisableItem( SID_PRESENTATION
);
444 rSet
.DisableItem( SID_REHEARSE_TIMINGS
);
449 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_EDITMODE
) ||
450 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_INSERT_POINT
) ||
451 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_PERCENT
) ||
452 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR
) ||
453 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR_LEFT
) ||
454 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR_RIGHT
) ||
455 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR_TOP
) ||
456 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR_BOTTOM
) ||
457 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_HORZALIGN_CENTER
) ||
458 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_HORZALIGN_LEFT
) ||
459 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_HORZALIGN_RIGHT
) ||
460 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_VERTALIGN_CENTER
) ||
461 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_VERTALIGN_TOP
) ||
462 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_VERTALIGN_BOTTOM
) )
465 SDR_TRISTATE eState
= mpDrawView
->IsMarkedGluePointsPercent();
466 if( eState
== TRISTATE_INDET
)
467 rSet
.InvalidateItem( SID_GLUE_PERCENT
);
469 rSet
.Put( SfxBoolItem( SID_GLUE_PERCENT
, eState
== TRISTATE_TRUE
) );
471 // alignment has no effect by percent
472 if( eState
== TRISTATE_TRUE
)
474 rSet
.DisableItem( SID_GLUE_HORZALIGN_CENTER
);
475 rSet
.DisableItem( SID_GLUE_HORZALIGN_LEFT
);
476 rSet
.DisableItem( SID_GLUE_HORZALIGN_RIGHT
);
477 rSet
.DisableItem( SID_GLUE_VERTALIGN_CENTER
);
478 rSet
.DisableItem( SID_GLUE_VERTALIGN_TOP
);
479 rSet
.DisableItem( SID_GLUE_VERTALIGN_BOTTOM
);
483 // horizontal alignment
484 SdrAlign nHorz
= mpDrawView
->GetMarkedGluePointsAlign( false );
485 rSet
.Put( SfxBoolItem( SID_GLUE_HORZALIGN_CENTER
, nHorz
== SdrAlign::HORZ_CENTER
) );
486 rSet
.Put( SfxBoolItem( SID_GLUE_HORZALIGN_LEFT
, nHorz
== SdrAlign::HORZ_LEFT
) );
487 rSet
.Put( SfxBoolItem( SID_GLUE_HORZALIGN_RIGHT
, nHorz
== SdrAlign::HORZ_RIGHT
) );
488 // vertical alignment
489 SdrAlign nVert
= mpDrawView
->GetMarkedGluePointsAlign( true );
490 rSet
.Put( SfxBoolItem( SID_GLUE_VERTALIGN_CENTER
, nVert
== SdrAlign::VERT_CENTER
) );
491 rSet
.Put( SfxBoolItem( SID_GLUE_VERTALIGN_TOP
, nVert
== SdrAlign::VERT_TOP
) );
492 rSet
.Put( SfxBoolItem( SID_GLUE_VERTALIGN_BOTTOM
, nVert
== SdrAlign::VERT_BOTTOM
) );
496 rSet
.Put( SfxBoolItem( SID_GLUE_INSERT_POINT
, mpDrawView
->IsInsGluePointMode() ) );
500 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SdrEscapeDirection::LEFT
);
501 if( eState
== TRISTATE_INDET
)
502 rSet
.InvalidateItem( SID_GLUE_ESCDIR_LEFT
);
504 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_LEFT
, eState
== TRISTATE_TRUE
) );
506 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SdrEscapeDirection::RIGHT
);
507 if( eState
== TRISTATE_INDET
)
508 rSet
.InvalidateItem( SID_GLUE_ESCDIR_RIGHT
);
510 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_RIGHT
, eState
== TRISTATE_TRUE
) );
512 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SdrEscapeDirection::TOP
);
513 if( eState
== TRISTATE_INDET
)
514 rSet
.InvalidateItem( SID_GLUE_ESCDIR_TOP
);
516 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_TOP
, eState
== TRISTATE_TRUE
) );
518 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SdrEscapeDirection::BOTTOM
);
519 if( eState
== TRISTATE_INDET
)
520 rSet
.InvalidateItem( SID_GLUE_ESCDIR_BOTTOM
);
522 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_BOTTOM
, eState
== TRISTATE_TRUE
) );
525 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GRID_FRONT
) ||
526 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_HELPLINES_FRONT
) )
528 rSet
.Put( SfxBoolItem( SID_GRID_FRONT
, mpDrawView
->IsGridFront() ) );
529 rSet
.Put( SfxBoolItem( SID_HELPLINES_FRONT
, mpDrawView
->IsHlplFront() ) );
532 if (!mpDrawView
->IsFrameDragSingles())
533 rSet
.Put(SfxBoolItem(SID_BEZIER_EDIT
, true));
535 rSet
.Put(SfxBoolItem(SID_BEZIER_EDIT
, false));
537 if(dynamic_cast<FuEditGluePoints
*>( GetCurrentFunction().get()))
538 rSet
.Put(SfxBoolItem(SID_GLUE_EDITMODE
, true));
540 rSet
.Put(SfxBoolItem(SID_GLUE_EDITMODE
, false));
542 if( !mpDrawView
->IsMirrorAllowed( true, true ) )
544 rSet
.DisableItem( SID_HORIZONTAL
);
545 rSet
.DisableItem( SID_VERTICAL
);
546 rSet
.DisableItem( SID_FLIP_HORIZONTAL
);
547 rSet
.DisableItem( SID_FLIP_VERTICAL
);
550 if( !mpDrawView
->IsMirrorAllowed() )
552 rSet
.DisableItem( SID_OBJECT_MIRROR
);
553 // rSet.DisableItem( SID_CONVERT_TO_3D_LATHE );
554 // rSet.DisableItem( SID_CONVERT_TO_3D_LATHE_FAST );
557 // interactive transparence control
558 if(!mpDrawView
->IsTransparenceAllowed())
560 rSet
.DisableItem( SID_OBJECT_TRANSPARENCE
);
563 // interactive gradient control
564 if(!mpDrawView
->IsGradientAllowed())
566 rSet
.DisableItem( SID_OBJECT_GRADIENT
);
569 // disable morphing if necessary
570 if ( !mpDrawView
->IsMorphingAllowed() )
571 rSet
.DisableItem( SID_POLYGON_MORPHING
);
573 // disable vectorizing if necessary
574 if ( !mpDrawView
->IsVectorizeAllowed() )
575 rSet
.DisableItem( SID_VECTORIZE
);
577 if( !mpDrawView
->IsReverseOrderPossible() )
579 rSet
.DisableItem( SID_REVERSE_ORDER
);
582 if ( !bConvertToPathPossible
&&
583 !mpDrawView
->IsCrookAllowed( mpDrawView
->IsCrookNoContortion() ) )
585 // implicit transformation into curve not possible
586 rSet
.DisableItem(SID_OBJECT_CROOK_ROTATE
);
587 rSet
.DisableItem(SID_OBJECT_CROOK_SLANT
);
588 rSet
.DisableItem(SID_OBJECT_CROOK_STRETCH
);
591 if ( !mpDrawView
->IsGroupEntered() )
593 rSet
.DisableItem( SID_LEAVE_GROUP
);
594 rSet
.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS
, false ) );
595 rSet
.ClearItem( SID_LEAVE_ALL_GROUPS
);
596 rSet
.DisableItem( SID_LEAVE_ALL_GROUPS
);
599 rSet
.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS
, true ) );
601 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_THESAURUS
) )
603 if ( !mpDrawView
->IsTextEdit() )
605 rSet
.DisableItem( SID_THESAURUS
);
609 LanguageType eLang
= GetDoc()->GetLanguage( EE_CHAR_LANGUAGE
);
610 Reference
< XThesaurus
> xThesaurus( LinguMgr::GetThesaurus() );
612 if (!xThesaurus
.is() || eLang
== LANGUAGE_NONE
|| !xThesaurus
->hasLocale( LanguageTag::convertToLocale( eLang
)) )
613 rSet
.DisableItem( SID_THESAURUS
);
617 if ( !mpDrawView
->IsTextEdit() )
619 rSet
.DisableItem( SID_THESAURUS
);
622 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_SELECTALL
) ||
623 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_SIZE_ALL
) )
625 if( pPageView
&& pPageView
->GetObjList()->GetObjCount() == 0 )
627 // should be disabled if there is no object on the draw area:
628 rSet
.DisableItem( SID_SELECTALL
);
629 rSet
.DisableItem( SID_SIZE_ALL
);
633 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_CONTEXT
) )
634 rSet
.Put( SfxStringItem( SID_CONTEXT
, mpDrawView
->GetStatusText() ) );
637 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_PASTE
) ||
638 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_PASTE_SPECIAL
) ||
639 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_PASTE_UNFORMATTED
) ||
640 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS
) )
642 if ( !mpClipEvtLstnr
)
644 // avoid clipboard initialization for
645 // read-only presentation views (workaround for NT4.0
646 // clipboard prob...)
647 if( !ISA(PresentationViewShell
) )
650 mpClipEvtLstnr
= new TransferableClipboardListener( LINK( this, DrawViewShell
, ClipboardChanged
) );
651 mpClipEvtLstnr
->acquire();
652 mpClipEvtLstnr
->AddRemoveListener( GetActiveWindow(), true );
655 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
656 mbPastePossible
= ( aDataHelper
.GetFormatCount() != 0 );
659 mbPastePossible
= false;
662 if( !mbPastePossible
)
664 rSet
.DisableItem( SID_PASTE
);
665 rSet
.DisableItem( SID_PASTE_SPECIAL
);
666 rSet
.DisableItem( SID_PASTE_UNFORMATTED
);
667 rSet
.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS
);
669 else if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS
) )
671 if (mpCurrentClipboardFormats
.get() != NULL
)
672 rSet
.Put(*mpCurrentClipboardFormats
);
676 if ( !bConvertToPathPossible
)
678 rSet
.DisableItem(SID_CHANGEBEZIER
);
681 if (mpDrawView
== NULL
)
683 // The mpDrawView was not NULL but is now.
684 // The reason for this may be that the DrawViewShell has been
685 // destroyed in the mean time.
686 // We can only return immediately and hope that the deleted
687 // DrawViewShell is not called again.
688 DBG_ASSERT(mpDrawView
!=NULL
, "Please report this assertion to the Impress team.");
692 if( !( mpDrawView
->IsConvertToPolyObjPossible(false) || mpDrawView
->IsVectorizeAllowed() ) )
693 rSet
.DisableItem(SID_CHANGEPOLYGON
);
695 if( !( mpDrawView
->IsConvertToPolyObjPossible(false) || mpDrawView
->IsConvertToContourPossible() ) )
696 rSet
.DisableItem(SID_CONVERT_TO_CONTOUR
);
698 if ( !mpDrawView
->IsConvertTo3DObjPossible() )
700 rSet
.DisableItem(SID_CONVERT_TO_3D
);
701 rSet
.DisableItem(SID_CONVERT_TO_3D_LATHE
);
702 rSet
.DisableItem(SID_CONVERT_TO_3D_LATHE_FAST
);
705 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_MANAGE_LINKS
) )
707 if ( GetDoc()->GetLinkCount() == 0 )
709 rSet
.DisableItem(SID_MANAGE_LINKS
);
713 if (mePageKind
== PK_HANDOUT
)
715 rSet
.DisableItem(SID_PRESENTATION_LAYOUT
);
716 rSet
.DisableItem(SID_SELECT_BACKGROUND
);
719 if (mePageKind
== PK_NOTES
)
721 rSet
.DisableItem(SID_INSERTPAGE
);
722 rSet
.DisableItem(SID_RENAMEPAGE
);
723 rSet
.DisableItem(SID_RENAMEPAGE_QUICK
);
724 rSet
.DisableItem(SID_DUPLICATE_PAGE
);
725 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
726 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
727 rSet
.DisableItem(SID_ANIMATION_EFFECTS
);
729 if (meEditMode
== EM_MASTERPAGE
)
730 rSet
.DisableItem(SID_MODIFYPAGE
);
732 rSet
.DisableItem(SID_SELECT_BACKGROUND
);
733 rSet
.DisableItem(SID_INSERTLAYER
);
734 rSet
.DisableItem(SID_LAYERMODE
);
735 rSet
.DisableItem(SID_INSERTFILE
);
737 else if (mePageKind
== PK_HANDOUT
)
739 rSet
.DisableItem(SID_INSERTPAGE
);
740 rSet
.DisableItem(SID_DUPLICATE_PAGE
);
741 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
742 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
743 rSet
.DisableItem(SID_ANIMATION_EFFECTS
);
744 rSet
.DisableItem(SID_RENAMEPAGE
);
745 rSet
.DisableItem(SID_RENAMEPAGE_QUICK
);
746 rSet
.DisableItem(SID_INSERTLAYER
);
747 rSet
.DisableItem(SID_MODIFYLAYER
);
748 rSet
.DisableItem(SID_RENAMELAYER
);
749 rSet
.DisableItem(SID_LAYERMODE
);
750 rSet
.DisableItem(SID_INSERTFILE
);
751 rSet
.DisableItem(SID_PAGEMODE
);
752 rSet
.DisableItem(SID_SELECT_BACKGROUND
);
756 if (meEditMode
== EM_MASTERPAGE
)
758 rSet
.DisableItem(SID_INSERTPAGE
);
759 rSet
.DisableItem(SID_DUPLICATE_PAGE
);
760 rSet
.DisableItem(SID_MODIFYPAGE
);
761 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
762 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
765 rSet
.Put (SfxBoolItem (SID_LAYERMODE
, IsLayerModeActive()));
768 if ( ! IsLayerModeActive())
770 rSet
.DisableItem( SID_INSERTLAYER
);
771 rSet
.DisableItem( SID_MODIFYLAYER
);
772 rSet
.DisableItem( SID_DELETE_LAYER
);
773 rSet
.DisableItem( SID_RENAMELAYER
);
776 if (meEditMode
== EM_PAGE
)
778 /**********************************************************************
780 **********************************************************************/
781 rSet
.Put(SfxBoolItem(SID_PAGEMODE
, true));
782 rSet
.Put(SfxBoolItem(SID_MASTERPAGE
, false));
783 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE
, false));
784 rSet
.Put(SfxBoolItem(SID_NOTES_MASTERPAGE
, false));
785 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE
, false));
787 if (mePageKind
== PK_STANDARD
&&
788 rSet
.GetItemState(SID_TITLE_MASTERPAGE
) == SfxItemState::DEFAULT
)
790 // Is there a page with the AutoLayout "Title"?
791 bool bDisable
= true;
793 sal_uInt16 nCount
= GetDoc()->GetSdPageCount(PK_STANDARD
);
795 while (i
< nCount
&& bDisable
)
797 SdPage
* pPage
= GetDoc()->GetSdPage(i
, PK_STANDARD
);
799 if (pPage
->GetAutoLayout() == AUTOLAYOUT_TITLE
)
809 rSet
.DisableItem(SID_TITLE_MASTERPAGE
);
813 rSet
.Put(SfxBoolItem(SID_TITLE_MASTERPAGE
, false));
818 rSet
.DisableItem(SID_TITLE_MASTERPAGE
);
821 rSet
.DisableItem (SID_INSERT_MASTER_PAGE
);
822 rSet
.DisableItem (SID_DELETE_MASTER_PAGE
);
823 rSet
.DisableItem (SID_RENAME_MASTER_PAGE
);
824 rSet
.DisableItem (SID_CLOSE_MASTER_VIEW
);
828 rSet
.Put(SfxBoolItem(SID_PAGEMODE
, false));
829 rSet
.Put(SfxBoolItem(SID_MASTERPAGE
, true));
831 /**********************************************************************
832 * Background page mode
833 **********************************************************************/
834 if (mePageKind
== PK_STANDARD
)
836 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE
, true));
837 rSet
.Put(SfxBoolItem(SID_NOTES_MASTERPAGE
, false));
838 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE
, false));
840 if (rSet
.GetItemState(SID_TITLE_MASTERPAGE
) == SfxItemState::DEFAULT
)
843 bool bDisable
= true;
846 SdPage
* pMPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
849 sal_uInt16 nCount
= GetDoc()->GetSdPageCount(PK_STANDARD
);
851 // Is there a reference to the current master page from a page
852 // with the AutoLayout "Title"?
853 while (i
< nCount
&& !bCheck
&& bDisable
)
855 SdPage
* pPage
= GetDoc()->GetSdPage(i
, PK_STANDARD
);
857 // page does reference the current master page
858 if (pPage
->GetAutoLayout() == AUTOLAYOUT_TITLE
)
860 // a page does have a AutoLayout "Title"
863 SdPage
& rRefMPage
= static_cast<SdPage
&>(pPage
->TRG_GetMasterPage());
865 if(&rRefMPage
== pMPage
)
867 // a page with the AutoLayout "Title" does reference
868 // the current master page
879 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE
, false));
882 rSet
.Put(SfxBoolItem(SID_TITLE_MASTERPAGE
, bCheck
));
886 rSet
.ClearItem(SID_TITLE_MASTERPAGE
);
887 rSet
.DisableItem(SID_TITLE_MASTERPAGE
);
891 else if (mePageKind
== PK_NOTES
)
893 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE
, false));
894 rSet
.DisableItem(SID_TITLE_MASTERPAGE
);
895 rSet
.Put(SfxBoolItem(SID_NOTES_MASTERPAGE
, true));
896 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE
, false));
898 else if (mePageKind
== PK_HANDOUT
)
900 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE
, false));
901 rSet
.DisableItem(SID_TITLE_MASTERPAGE
);
902 rSet
.Put(SfxBoolItem(SID_NOTES_MASTERPAGE
, false));
903 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE
, true));
907 // set state of the ruler
908 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_RULER
) )
909 rSet
.Put( SfxBoolItem( SID_RULER
, HasRuler() ) );
911 // do not delete the last page or a master page
912 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DELETE_PAGE
)
913 || SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DELETE_MASTER_PAGE
) )
915 if (maTabControl
->GetPageCount() == 1 ||
916 meEditMode
== EM_MASTERPAGE
||
917 mePageKind
== PK_NOTES
||
918 mePageKind
== PK_HANDOUT
||
919 (GetShellType()!=ST_DRAW
&&IsLayerModeActive()))
921 if (rSet
.GetItemState(SID_DELETE_PAGE
) == SfxItemState::DEFAULT
)
922 rSet
.DisableItem(SID_DELETE_PAGE
);
923 if (rSet
.GetItemState(SID_DELETE_MASTER_PAGE
)==SfxItemState::DEFAULT
)
924 rSet
.DisableItem(SID_DELETE_MASTER_PAGE
);
928 // is it allowed to delete the current layer?
929 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DELETE_LAYER
) )
931 if(GetLayerTabControl()) // #i87182#
933 sal_uInt16 nCurrentLayer
= GetLayerTabControl()->GetCurPageId();
934 const OUString
& rName
= GetLayerTabControl()->GetPageText(nCurrentLayer
);
936 bool bDisableIt
= !IsLayerModeActive();
937 bDisableIt
|= (rName
== SD_RESSTR(STR_LAYER_LAYOUT
));
938 bDisableIt
|= (rName
== SD_RESSTR(STR_LAYER_BCKGRND
));
939 bDisableIt
|= (rName
== SD_RESSTR(STR_LAYER_BCKGRNDOBJ
));
940 bDisableIt
|= (rName
== SD_RESSTR(STR_LAYER_CONTROLS
));
941 bDisableIt
|= (rName
== SD_RESSTR(STR_LAYER_MEASURELINES
));
945 rSet
.DisableItem(SID_DELETE_LAYER
);
946 rSet
.DisableItem(SID_RENAMELAYER
);
951 OSL_ENSURE(false, "No LayerTabBar (!)");
955 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_CUT
) ||
956 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_COPY
) ||
957 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_OUTLINE_BULLET
))
959 OutlinerView
* pOlView
= mpDrawView
->GetTextEditOutlinerView();
961 // special treatment of for SID_OUTLINE_BULLET if objects with different
962 // kinds of NumBullets are marked
963 bool bHasOutliner
= false;
964 bool bHasOther
= false;
965 for(size_t nNum
= 0; nNum
< nMarkCount
; ++nNum
)
967 SdrObject
* pObj
= rMarkList
.GetMark(nNum
)->GetMarkedSdrObj();
968 if( pObj
->GetObjInventor() == SdrInventor
)
970 if( pObj
->GetObjIdentifier() == OBJ_OUTLINETEXT
)
985 if( bHasOther
&& bHasOutliner
)
986 rSet
.DisableItem( SID_OUTLINE_BULLET
);
990 if (pOlView
->GetSelected().isEmpty())
992 rSet
.DisableItem( SID_CUT
);
993 rSet
.DisableItem( SID_COPY
);
999 FuBullet::GetSlotState( rSet
, this, GetViewFrame() );
1001 if ( GetDocSh()->IsUIActive() )
1003 rSet
.DisableItem( SID_INSERT_OBJECT
);
1004 rSet
.DisableItem( SID_INSERT_PLUGIN
);
1005 rSet
.DisableItem( SID_INSERT_SOUND
);
1006 rSet
.DisableItem( SID_INSERT_VIDEO
);
1007 rSet
.DisableItem( SID_INSERT_FLOATINGFRAME
);
1008 rSet
.DisableItem( SID_INSERT_MATH
);
1009 rSet
.DisableItem( SID_INSERT_DIAGRAM
);
1010 rSet
.DisableItem( SID_ATTR_TABLE
);
1011 rSet
.DisableItem( SID_SIZE_REAL
);
1012 rSet
.DisableItem( SID_SIZE_OPTIMAL
);
1013 rSet
.DisableItem( SID_SIZE_ALL
);
1014 rSet
.DisableItem( SID_SIZE_PAGE_WIDTH
);
1015 rSet
.DisableItem( SID_SIZE_PAGE
);
1016 rSet
.DisableItem( SID_DUPLICATE_PAGE
);
1017 rSet
.DisableItem( SID_ZOOM_TOOLBOX
);
1021 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_ZOOM_IN
) ||
1022 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_ZOOM_OUT
)||
1023 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_ZOOM_PANNING
) )
1025 if( GetActiveWindow()->GetZoom() <= GetActiveWindow()->GetMinZoom() || GetDocSh()->IsUIActive() )
1027 rSet
.DisableItem( SID_ZOOM_IN
);
1028 rSet
.DisableItem( SID_ZOOM_PANNING
);
1030 if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() )
1031 rSet
.DisableItem( SID_ZOOM_OUT
);
1034 if (!mpZoomList
->IsNextPossible())
1036 rSet
.DisableItem(SID_ZOOM_NEXT
);
1038 if (!mpZoomList
->IsPreviousPossible())
1040 rSet
.DisableItem(SID_ZOOM_PREV
);
1043 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_REMOTE_DLG
) )
1046 bool bDisableSdremoteForGood
= false;
1047 #ifndef ENABLE_SDREMOTE
1048 bDisableSdremoteForGood
= true;
1050 uno::Reference
< uno::XComponentContext
> xContext
= comphelper::getProcessComponentContext();
1051 if ( xContext
.is() )
1052 bDisableSdremoteForGood
|= ! ( /*officecfg::Office::Common::Misc::ExperimentalMode::get( xContext ) &&*/
1054 officecfg::Office::Impress::Misc::Start::EnableSdremote::get( xContext
) );
1056 // This dialog is only useful for TCP/IP remote control
1057 // which is unusual, under-tested and a security issue.
1058 if ( bDisableSdremoteForGood
)
1060 rSet
.Put(SfxVisibilityItem(SID_REMOTE_DLG
, false));
1065 if (GetViewShellBase().GetViewShellManager()->GetShell(RID_DRAW_TEXT_TOOLBOX
) != NULL
)
1067 sal_uInt16 nCurrentSId
= SID_ATTR_CHAR
;
1069 if(HasCurrentFunction())
1071 nCurrentSId
= GetCurrentFunction()->GetSlotID();
1073 if( nCurrentSId
!= SID_TEXT_FITTOSIZE
&&
1074 nCurrentSId
!= SID_TEXT_FITTOSIZE_VERTICAL
&&
1075 nCurrentSId
!= SID_ATTR_CHAR_VERTICAL
)
1076 nCurrentSId
= SID_ATTR_CHAR
;
1078 rSet
.Put( SfxBoolItem( nCurrentSId
, true ) );
1080 // Short version of UpdateToolboxImages()
1081 rSet
.Put( TbxImageItem( SID_DRAWTBX_TEXT
, nCurrentSId
) );
1084 if ( GetDocSh()->IsReadOnly() )
1086 rSet
.DisableItem( SID_AUTOSPELL_CHECK
);
1090 if (GetDoc()->GetOnlineSpell())
1092 rSet
.Put(SfxBoolItem(SID_AUTOSPELL_CHECK
, true));
1096 rSet
.Put(SfxBoolItem(SID_AUTOSPELL_CHECK
, false));
1100 SdrPageView
* pPV
= mpDrawView
->GetSdrPageView();
1101 OUString aActiveLayer
= mpDrawView
->GetActiveLayer();
1103 if ( ( !aActiveLayer
.isEmpty() && pPV
&& ( pPV
->IsLayerLocked(aActiveLayer
) ||
1104 !pPV
->IsLayerVisible(aActiveLayer
) ) ) ||
1105 SD_MOD()->GetWaterCan() )
1107 rSet
.DisableItem( SID_PASTE
);
1108 rSet
.DisableItem( SID_PASTE_SPECIAL
);
1109 rSet
.DisableItem( SID_PASTE_UNFORMATTED
);
1110 rSet
.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS
);
1112 rSet
.DisableItem( SID_INSERT_FLD_DATE_FIX
);
1113 rSet
.DisableItem( SID_INSERT_FLD_DATE_VAR
);
1114 rSet
.DisableItem( SID_INSERT_FLD_TIME_FIX
);
1115 rSet
.DisableItem( SID_INSERT_FLD_TIME_VAR
);
1116 rSet
.DisableItem( SID_INSERT_FLD_AUTHOR
);
1117 rSet
.DisableItem( SID_INSERT_FLD_PAGE
);
1118 rSet
.DisableItem( SID_INSERT_FLD_PAGE_TITLE
);
1119 rSet
.DisableItem( SID_INSERT_FLD_PAGES
);
1120 rSet
.DisableItem( SID_INSERT_FLD_FILE
);
1122 rSet
.DisableItem( SID_INSERT_GRAPHIC
);
1123 rSet
.DisableItem( SID_INSERT_AVMEDIA
);
1124 rSet
.DisableItem( SID_INSERT_DIAGRAM
);
1125 rSet
.DisableItem( SID_INSERT_OBJECT
);
1126 rSet
.DisableItem( SID_INSERT_PLUGIN
);
1127 rSet
.DisableItem( SID_INSERT_SOUND
);
1128 rSet
.DisableItem( SID_INSERT_VIDEO
);
1129 rSet
.DisableItem( SID_INSERT_FLOATINGFRAME
);
1131 rSet
.DisableItem( SID_INSERT_MATH
);
1132 rSet
.DisableItem( SID_INSERT_FRAME
);
1133 rSet
.DisableItem( SID_INSERTFILE
);
1134 rSet
.DisableItem( SID_ATTR_TABLE
);
1135 rSet
.DisableItem( SID_COPYOBJECTS
);
1137 rSet
.DisableItem( SID_SCAN
);
1138 rSet
.DisableItem( SID_TWAIN_SELECT
);
1139 rSet
.DisableItem( SID_TWAIN_TRANSFER
);
1141 // rSet.DisableItem( SID_BEZIER_EDIT );
1142 rSet
.DisableItem( SID_GLUE_EDITMODE
);
1143 rSet
.DisableItem( SID_OBJECT_ROTATE
);
1144 rSet
.DisableItem( SID_OBJECT_SHEAR
);
1145 rSet
.DisableItem( SID_OBJECT_MIRROR
);
1146 rSet
.DisableItem( SID_OBJECT_CROP
);
1147 rSet
.DisableItem( SID_ATTR_GRAF_CROP
);
1148 rSet
.DisableItem( SID_OBJECT_TRANSPARENCE
);
1149 rSet
.DisableItem( SID_OBJECT_GRADIENT
);
1150 rSet
.DisableItem( SID_OBJECT_CROOK_ROTATE
);
1151 rSet
.DisableItem( SID_OBJECT_CROOK_SLANT
);
1152 rSet
.DisableItem( SID_OBJECT_CROOK_STRETCH
);
1154 // Disable all object-creating tools
1155 rSet
.ClearItem( SID_ATTR_CHAR
);
1156 rSet
.DisableItem( SID_ATTR_CHAR
);
1157 rSet
.ClearItem( SID_ATTR_CHAR_VERTICAL
);
1158 rSet
.DisableItem( SID_ATTR_CHAR_VERTICAL
);
1159 rSet
.ClearItem(SID_DRAW_LINE
);
1160 rSet
.DisableItem(SID_DRAW_LINE
);
1161 rSet
.ClearItem(SID_DRAW_MEASURELINE
);
1162 rSet
.DisableItem(SID_DRAW_MEASURELINE
);
1163 rSet
.ClearItem(SID_DRAW_XLINE
);
1164 rSet
.DisableItem(SID_DRAW_XLINE
);
1165 rSet
.ClearItem( SID_LINE_ARROW_START
);
1166 rSet
.DisableItem( SID_LINE_ARROW_START
);
1167 rSet
.ClearItem( SID_LINE_ARROW_END
);
1168 rSet
.DisableItem( SID_LINE_ARROW_END
);
1169 rSet
.ClearItem( SID_LINE_ARROWS
);
1170 rSet
.DisableItem( SID_LINE_ARROWS
);
1171 rSet
.ClearItem( SID_LINE_ARROW_CIRCLE
);
1172 rSet
.DisableItem( SID_LINE_ARROW_CIRCLE
);
1173 rSet
.ClearItem( SID_LINE_CIRCLE_ARROW
);
1174 rSet
.DisableItem( SID_LINE_CIRCLE_ARROW
);
1175 rSet
.ClearItem( SID_LINE_ARROW_SQUARE
);
1176 rSet
.DisableItem( SID_LINE_ARROW_SQUARE
);
1177 rSet
.ClearItem( SID_LINE_SQUARE_ARROW
);
1178 rSet
.DisableItem( SID_LINE_SQUARE_ARROW
);
1180 rSet
.ClearItem(SID_DRAW_RECT
);
1181 rSet
.DisableItem(SID_DRAW_RECT
);
1182 rSet
.ClearItem(SID_DRAW_RECT_NOFILL
);
1183 rSet
.DisableItem(SID_DRAW_RECT_NOFILL
);
1184 rSet
.ClearItem(SID_DRAW_RECT_ROUND
);
1185 rSet
.DisableItem(SID_DRAW_RECT_ROUND
);
1186 rSet
.ClearItem(SID_DRAW_RECT_ROUND_NOFILL
);
1187 rSet
.DisableItem(SID_DRAW_RECT_ROUND_NOFILL
);
1188 rSet
.ClearItem(SID_DRAW_SQUARE
);
1189 rSet
.DisableItem(SID_DRAW_SQUARE
);
1190 rSet
.ClearItem(SID_DRAW_SQUARE_NOFILL
);
1191 rSet
.DisableItem(SID_DRAW_SQUARE_NOFILL
);
1192 rSet
.ClearItem(SID_DRAW_SQUARE_ROUND
);
1193 rSet
.DisableItem(SID_DRAW_SQUARE_ROUND
);
1194 rSet
.ClearItem(SID_DRAW_SQUARE_ROUND_NOFILL
);
1195 rSet
.DisableItem(SID_DRAW_SQUARE_ROUND_NOFILL
);
1196 rSet
.ClearItem(SID_DRAW_ELLIPSE
);
1197 rSet
.DisableItem(SID_DRAW_ELLIPSE
);
1198 rSet
.ClearItem(SID_DRAW_ELLIPSE_NOFILL
);
1199 rSet
.DisableItem(SID_DRAW_ELLIPSE_NOFILL
);
1200 rSet
.ClearItem(SID_DRAW_CIRCLE
);
1201 rSet
.DisableItem(SID_DRAW_CIRCLE
);
1202 rSet
.ClearItem(SID_DRAW_CIRCLE_NOFILL
);
1203 rSet
.DisableItem(SID_DRAW_CIRCLE_NOFILL
);
1204 rSet
.ClearItem(SID_DRAW_CAPTION
);
1205 rSet
.DisableItem(SID_DRAW_CAPTION
);
1206 rSet
.ClearItem(SID_DRAW_FONTWORK
);
1207 rSet
.DisableItem(SID_DRAW_FONTWORK
);
1208 rSet
.ClearItem(SID_DRAW_FONTWORK_VERTICAL
);
1209 rSet
.DisableItem(SID_DRAW_FONTWORK_VERTICAL
);
1210 rSet
.ClearItem(SID_DRAW_CAPTION_VERTICAL
);
1211 rSet
.DisableItem(SID_DRAW_CAPTION_VERTICAL
);
1212 rSet
.ClearItem(SID_TEXT_FITTOSIZE
);
1213 rSet
.DisableItem(SID_TEXT_FITTOSIZE
);
1214 rSet
.ClearItem(SID_TEXT_FITTOSIZE_VERTICAL
);
1215 rSet
.DisableItem(SID_TEXT_FITTOSIZE_VERTICAL
);
1216 rSet
.ClearItem(SID_TOOL_CONNECTOR
);
1217 rSet
.DisableItem(SID_TOOL_CONNECTOR
);
1218 rSet
.ClearItem(SID_CONNECTOR_ARROW_START
);
1219 rSet
.DisableItem(SID_CONNECTOR_ARROW_START
);
1220 rSet
.ClearItem(SID_CONNECTOR_ARROW_END
);
1221 rSet
.DisableItem(SID_CONNECTOR_ARROW_END
);
1222 rSet
.ClearItem(SID_CONNECTOR_ARROWS
);
1223 rSet
.DisableItem(SID_CONNECTOR_ARROWS
);
1224 rSet
.ClearItem(SID_CONNECTOR_CIRCLE_START
);
1225 rSet
.DisableItem(SID_CONNECTOR_CIRCLE_START
);
1226 rSet
.ClearItem(SID_CONNECTOR_CIRCLE_END
);
1227 rSet
.DisableItem(SID_CONNECTOR_CIRCLE_END
);
1228 rSet
.ClearItem(SID_CONNECTOR_CIRCLES
);
1229 rSet
.DisableItem(SID_CONNECTOR_CIRCLES
);
1230 rSet
.ClearItem(SID_CONNECTOR_LINE
);
1231 rSet
.DisableItem(SID_CONNECTOR_LINE
);
1232 rSet
.ClearItem(SID_CONNECTOR_LINE_ARROW_START
);
1233 rSet
.DisableItem(SID_CONNECTOR_LINE_ARROW_START
);
1234 rSet
.ClearItem(SID_CONNECTOR_LINE_ARROW_END
);
1235 rSet
.DisableItem(SID_CONNECTOR_LINE_ARROW_END
);
1236 rSet
.ClearItem(SID_CONNECTOR_LINE_ARROWS
);
1237 rSet
.DisableItem(SID_CONNECTOR_LINE_ARROWS
);
1238 rSet
.ClearItem(SID_CONNECTOR_LINE_CIRCLE_START
);
1239 rSet
.DisableItem(SID_CONNECTOR_LINE_CIRCLE_START
);
1240 rSet
.ClearItem(SID_CONNECTOR_LINE_CIRCLE_END
);
1241 rSet
.DisableItem(SID_CONNECTOR_LINE_CIRCLE_END
);
1242 rSet
.ClearItem(SID_CONNECTOR_LINE_CIRCLES
);
1243 rSet
.DisableItem(SID_CONNECTOR_LINE_CIRCLES
);
1244 rSet
.ClearItem(SID_CONNECTOR_CURVE
);
1245 rSet
.DisableItem(SID_CONNECTOR_CURVE
);
1246 rSet
.ClearItem(SID_CONNECTOR_CURVE_ARROW_START
);
1247 rSet
.DisableItem(SID_CONNECTOR_CURVE_ARROW_START
);
1248 rSet
.ClearItem(SID_CONNECTOR_CURVE_ARROW_END
);
1249 rSet
.DisableItem(SID_CONNECTOR_CURVE_ARROW_END
);
1250 rSet
.ClearItem(SID_CONNECTOR_CURVE_ARROWS
);
1251 rSet
.DisableItem(SID_CONNECTOR_CURVE_ARROWS
);
1252 rSet
.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_START
);
1253 rSet
.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_START
);
1254 rSet
.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_END
);
1255 rSet
.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_END
);
1256 rSet
.ClearItem(SID_CONNECTOR_CURVE_CIRCLES
);
1257 rSet
.DisableItem(SID_CONNECTOR_CURVE_CIRCLES
);
1258 rSet
.ClearItem(SID_CONNECTOR_LINES
);
1259 rSet
.DisableItem(SID_CONNECTOR_LINES
);
1260 rSet
.ClearItem(SID_CONNECTOR_LINES_ARROW_START
);
1261 rSet
.DisableItem(SID_CONNECTOR_LINES_ARROW_START
);
1262 rSet
.ClearItem(SID_CONNECTOR_LINES_ARROW_END
);
1263 rSet
.DisableItem(SID_CONNECTOR_LINES_ARROW_END
);
1264 rSet
.ClearItem(SID_CONNECTOR_LINES_ARROWS
);
1265 rSet
.DisableItem(SID_CONNECTOR_LINES_ARROWS
);
1266 rSet
.ClearItem(SID_CONNECTOR_LINES_CIRCLE_START
);
1267 rSet
.DisableItem(SID_CONNECTOR_LINES_CIRCLE_START
);
1268 rSet
.ClearItem(SID_CONNECTOR_LINES_CIRCLE_END
);
1269 rSet
.DisableItem(SID_CONNECTOR_LINES_CIRCLE_END
);
1270 rSet
.ClearItem(SID_CONNECTOR_LINES_CIRCLES
);
1271 rSet
.DisableItem(SID_CONNECTOR_LINES_CIRCLES
);
1272 rSet
.ClearItem(SID_DRAW_ARC
);
1273 rSet
.DisableItem(SID_DRAW_ARC
);
1274 rSet
.ClearItem(SID_DRAW_CIRCLEARC
);
1275 rSet
.DisableItem(SID_DRAW_CIRCLEARC
);
1276 rSet
.ClearItem(SID_DRAW_PIE
);
1277 rSet
.DisableItem(SID_DRAW_PIE
);
1278 rSet
.ClearItem(SID_DRAW_PIE_NOFILL
);
1279 rSet
.DisableItem(SID_DRAW_PIE_NOFILL
);
1280 rSet
.ClearItem(SID_DRAW_CIRCLEPIE
);
1281 rSet
.DisableItem(SID_DRAW_CIRCLEPIE
);
1282 rSet
.ClearItem(SID_DRAW_CIRCLEPIE_NOFILL
);
1283 rSet
.DisableItem(SID_DRAW_CIRCLEPIE_NOFILL
);
1284 rSet
.ClearItem(SID_DRAW_ELLIPSECUT
);
1285 rSet
.DisableItem(SID_DRAW_ELLIPSECUT
);
1286 rSet
.ClearItem(SID_DRAW_ELLIPSECUT_NOFILL
);
1287 rSet
.DisableItem(SID_DRAW_ELLIPSECUT_NOFILL
);
1288 rSet
.ClearItem(SID_DRAW_CIRCLECUT
);
1289 rSet
.DisableItem(SID_DRAW_CIRCLECUT
);
1290 rSet
.ClearItem(SID_DRAW_CIRCLECUT_NOFILL
);
1291 rSet
.DisableItem(SID_DRAW_CIRCLECUT_NOFILL
);
1292 rSet
.ClearItem(SID_DRAW_POLYGON
);
1293 rSet
.DisableItem(SID_DRAW_POLYGON
);
1294 rSet
.ClearItem(SID_DRAW_POLYGON_NOFILL
);
1295 rSet
.DisableItem(SID_DRAW_POLYGON_NOFILL
);
1296 rSet
.ClearItem(SID_DRAW_FREELINE
);
1297 rSet
.DisableItem(SID_DRAW_FREELINE
);
1298 rSet
.ClearItem(SID_DRAW_FREELINE_NOFILL
);
1299 rSet
.DisableItem(SID_DRAW_FREELINE_NOFILL
);
1300 rSet
.ClearItem(SID_DRAW_XPOLYGON
);
1301 rSet
.DisableItem(SID_DRAW_XPOLYGON
);
1302 rSet
.ClearItem(SID_DRAW_XPOLYGON_NOFILL
);
1303 rSet
.DisableItem(SID_DRAW_XPOLYGON_NOFILL
);
1304 rSet
.ClearItem(SID_DRAW_BEZIER_FILL
);
1305 rSet
.DisableItem(SID_DRAW_BEZIER_FILL
);
1306 rSet
.ClearItem(SID_DRAW_BEZIER_NOFILL
);
1307 rSet
.DisableItem(SID_DRAW_BEZIER_NOFILL
);
1308 rSet
.ClearItem(SID_3D_CUBE
);
1309 rSet
.DisableItem(SID_3D_CUBE
);
1310 rSet
.ClearItem(SID_3D_SHELL
);
1311 rSet
.DisableItem(SID_3D_SHELL
);
1312 rSet
.ClearItem(SID_3D_SPHERE
);
1313 rSet
.DisableItem(SID_3D_SPHERE
);
1314 rSet
.ClearItem(SID_3D_HALF_SPHERE
);
1315 rSet
.DisableItem(SID_3D_HALF_SPHERE
);
1316 rSet
.ClearItem(SID_3D_CYLINDER
);
1317 rSet
.DisableItem(SID_3D_CYLINDER
);
1318 rSet
.ClearItem(SID_3D_CONE
);
1319 rSet
.DisableItem(SID_3D_CONE
);
1320 rSet
.ClearItem(SID_3D_TORUS
);
1321 rSet
.DisableItem(SID_3D_TORUS
);
1322 rSet
.ClearItem(SID_3D_PYRAMID
);
1323 rSet
.DisableItem(SID_3D_PYRAMID
);
1326 // are the modules available?
1328 if (!SvtModuleOptions().IsCalc())
1330 // remove menu entry if module is not available
1331 rSet
.Put( SfxVisibilityItem( SID_ATTR_TABLE
, false ) );
1333 if (!SvtModuleOptions().IsChart())
1335 rSet
.DisableItem( SID_INSERT_DIAGRAM
);
1337 if (!SvtModuleOptions().IsMath())
1339 rSet
.DisableItem( SID_INSERT_MATH
);
1342 rtl::Reference
< sd::SlideShow
> xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
1343 if( (xSlideshow
.is() && xSlideshow
->isRunning() && (xSlideshow
->getAnimationMode() != ANIMATIONMODE_PREVIEW
) ) || GetDocSh()->IsPreview() )
1346 rSet
.DisableItem( SID_PRESENTATION
);
1347 rSet
.DisableItem( SID_ZOOM_IN
);
1348 rSet
.DisableItem( SID_ZOOM_OUT
);
1349 rSet
.DisableItem( SID_ZOOM_PANNING
);
1350 rSet
.DisableItem( SID_ZOOM_MODE
);
1351 rSet
.DisableItem( SID_ZOOM_NEXT
);
1352 rSet
.DisableItem( SID_ZOOM_PREV
);
1353 rSet
.DisableItem( SID_SIZE_REAL
);
1354 rSet
.DisableItem( SID_SIZE_OPTIMAL
);
1355 rSet
.DisableItem( SID_SIZE_ALL
);
1356 rSet
.DisableItem( SID_SIZE_PAGE_WIDTH
);
1357 rSet
.DisableItem( SID_SIZE_PAGE
);
1358 rSet
.DisableItem( SID_INSERTPAGE
);
1359 rSet
.DisableItem( SID_DUPLICATE_PAGE
);
1360 rSet
.DisableItem( SID_MODIFYPAGE
);
1361 rSet
.DisableItem( SID_RENAMEPAGE
);
1362 rSet
.DisableItem( SID_RENAMEPAGE_QUICK
);
1363 rSet
.DisableItem( SID_DELETE_PAGE
);
1364 rSet
.DisableItem( SID_PAGESETUP
);
1366 if( xSlideshow
.is() && xSlideshow
->isRunning() )
1368 rSet
.ClearItem(SID_OBJECT_ALIGN
);
1369 rSet
.ClearItem(SID_ZOOM_TOOLBOX
);
1370 rSet
.ClearItem(SID_OBJECT_CHOOSE_MODE
);
1371 rSet
.ClearItem(SID_DRAWTBX_TEXT
);
1372 rSet
.ClearItem(SID_DRAWTBX_RECTANGLES
);
1373 rSet
.ClearItem(SID_DRAWTBX_ELLIPSES
);
1374 rSet
.ClearItem(SID_DRAWTBX_LINES
);
1375 rSet
.ClearItem(SID_DRAWTBX_ARROWS
);
1376 rSet
.ClearItem(SID_DRAWTBX_3D_OBJECTS
);
1377 rSet
.ClearItem(SID_DRAWTBX_CONNECTORS
);
1378 rSet
.ClearItem(SID_OBJECT_CHOOSE_MODE
);
1379 rSet
.ClearItem(SID_DRAWTBX_INSERT
);
1380 rSet
.ClearItem(SID_INSERTFILE
);
1381 rSet
.ClearItem(SID_OBJECT_ROTATE
);
1382 rSet
.ClearItem(SID_OBJECT_ALIGN
);
1383 rSet
.ClearItem(SID_POSITION
);
1384 rSet
.ClearItem(SID_FM_CONFIG
);
1385 rSet
.ClearItem(SID_ANIMATION_EFFECTS
);
1386 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
1387 rSet
.ClearItem(SID_3D_WIN
);
1389 rSet
.DisableItem(SID_OBJECT_ALIGN
);
1390 rSet
.DisableItem(SID_ZOOM_TOOLBOX
);
1391 rSet
.DisableItem(SID_OBJECT_CHOOSE_MODE
);
1392 rSet
.DisableItem(SID_DRAWTBX_TEXT
);
1393 rSet
.DisableItem(SID_DRAWTBX_RECTANGLES
);
1394 rSet
.DisableItem(SID_DRAWTBX_ELLIPSES
);
1395 rSet
.DisableItem(SID_DRAWTBX_LINES
);
1396 rSet
.DisableItem(SID_DRAWTBX_ARROWS
);
1397 rSet
.DisableItem(SID_DRAWTBX_3D_OBJECTS
);
1398 rSet
.DisableItem(SID_DRAWTBX_CONNECTORS
);
1399 rSet
.DisableItem(SID_OBJECT_CHOOSE_MODE
);
1400 rSet
.DisableItem(SID_DRAWTBX_INSERT
);
1401 rSet
.DisableItem(SID_INSERTFILE
);
1402 rSet
.DisableItem(SID_OBJECT_ROTATE
);
1403 rSet
.DisableItem(SID_OBJECT_ALIGN
);
1404 rSet
.DisableItem(SID_POSITION
);
1405 rSet
.DisableItem(SID_FM_CONFIG
);
1406 rSet
.DisableItem(SID_ANIMATION_EFFECTS
);
1407 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
1408 rSet
.DisableItem(SID_3D_WIN
);
1412 // Menuoption: Change->Convert->To Bitmap, Change->Convert->To Metafile
1413 // disable, if there only Bitmap or Metafiles marked
1414 // Menuoption: Format->Area, Format->Line
1415 // disabled, if the marked objects not able to handle
1418 bool bSingleGraphicSelected
= false;
1420 if (!mpDrawView
->AreObjectsMarked())
1422 rSet
.DisableItem (SID_CONVERT_TO_METAFILE
);
1423 rSet
.DisableItem (SID_CONVERT_TO_BITMAP
);
1428 SdrMarkList aMarkList
= mpDrawView
->GetMarkedObjectList();
1430 bool bFoundBitmap
= false;
1431 bool bFoundMetafile
= false;
1432 bool bFoundObjNoArea
= false;
1433 bool bFoundNoGraphicObj
= false;
1434 bool bFoundAny
= false;
1435 bool bFoundTable
= false;
1437 // const size_t nMarkCount = aMarkList.GetMarkCount();
1438 for (size_t i
=0; i
< nMarkCount
&& !bFoundAny
; ++i
)
1440 SdrObject
* pObj
= aMarkList
.GetMark(i
)->GetMarkedSdrObj();
1441 sal_uInt16 nId
= pObj
->GetObjIdentifier();
1442 sal_uInt32 nInv
= pObj
->GetObjInventor();
1444 if(nInv
== SdrInventor
)
1455 bFoundObjNoArea
= true;
1456 bFoundNoGraphicObj
= true;
1459 // #i118485# #i118525# Allow Line, Area and Graphic (Metafile, Bitmap)
1460 bSingleGraphicSelected
= nMarkCount
== 1;
1461 bFoundBitmap
= true;
1462 bFoundMetafile
= true;
1466 bSingleGraphicSelected
= nMarkCount
== 1;
1467 const SdrGrafObj
* pSdrGrafObj
= static_cast< const SdrGrafObj
* >(pObj
);
1468 switch(pSdrGrafObj
->GetGraphicType())
1470 case GRAPHIC_BITMAP
:
1471 bFoundBitmap
= true;
1472 if(pSdrGrafObj
->isEmbeddedSvg())
1474 bFoundMetafile
= true;
1477 case GRAPHIC_GDIMETAFILE
:
1478 bFoundMetafile
= true;
1492 else if(nInv
== E3dInventor
)
1500 rSet
.DisableItem( SID_ATTRIBUTES_LINE
);
1504 // Disable menuitem for area-dialog
1505 if( bFoundObjNoArea
) // #i25616#
1506 rSet
.DisableItem( SID_ATTRIBUTES_AREA
);
1508 if( bFoundBitmap
&& !bFoundMetafile
&& !bFoundNoGraphicObj
) // only Bitmaps marked
1509 rSet
.DisableItem( SID_CONVERT_TO_BITMAP
);
1510 else if( !bFoundBitmap
&& bFoundMetafile
&& !bFoundNoGraphicObj
) // only Metafiles marked
1511 rSet
.DisableItem( SID_CONVERT_TO_METAFILE
);
1512 else if( !bFoundBitmap
&& !bFoundMetafile
&& !bFoundNoGraphicObj
) // nothing to do
1514 rSet
.DisableItem( SID_CONVERT_TO_BITMAP
);
1515 rSet
.DisableItem( SID_CONVERT_TO_METAFILE
);
1520 if( !bSingleGraphicSelected
)
1522 rSet
.DisableItem (SID_OBJECT_CROP
);
1523 rSet
.DisableItem (SID_ATTR_GRAF_CROP
);
1526 // Menuoption: Edit->Hyperlink
1527 // Disable, if there is no hyperlink
1529 bool bDisableEditHyperlink
= true;
1530 if( mpDrawView
->AreObjectsMarked() && ( mpDrawView
->GetMarkedObjectList().GetMarkCount() == 1 ) )
1532 if( mpDrawView
->IsTextEdit() )
1534 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
1537 const SvxFieldItem
* pFieldItem
= pOLV
->GetFieldAtSelection();
1540 ESelection aSel
= pOLV
->GetSelection();
1541 if ( abs( aSel
.nEndPos
- aSel
.nStartPos
) == 1 )
1543 const SvxFieldData
* pField
= pFieldItem
->GetField();
1544 if ( pField
->ISA(SvxURLField
) )
1545 bDisableEditHyperlink
= false;
1552 SdrUnoObj
* pUnoCtrl
= PTR_CAST(SdrUnoObj
, mpDrawView
->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj());
1554 if ( pUnoCtrl
&& FmFormInventor
== pUnoCtrl
->GetObjInventor() )
1556 uno::Reference
< awt::XControlModel
> xControlModel( pUnoCtrl
->GetUnoControlModel() );
1557 if( xControlModel
.is() )
1559 uno::Reference
< beans::XPropertySet
> xPropSet( xControlModel
, uno::UNO_QUERY
);
1562 uno::Reference
< beans::XPropertySetInfo
> xPropInfo( xPropSet
->getPropertySetInfo() );
1563 if( xPropInfo
.is() && xPropInfo
->hasPropertyByName( "TargetURL") )
1565 bDisableEditHyperlink
= false;
1573 //highlight selected custom shape
1575 sal_uInt16 nCurrentSId
= 0;
1576 if(HasCurrentFunction())
1577 nCurrentSId
= GetCurrentFunction()->GetSlotID();
1579 if ( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DRAWTBX_CS_BASIC
) )
1580 rSet
.Put(SfxBoolItem(SID_DRAWTBX_CS_BASIC
, SID_DRAWTBX_CS_BASIC
== nCurrentSId
));
1581 if ( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DRAWTBX_CS_SYMBOL
) )
1582 rSet
.Put(SfxBoolItem(SID_DRAWTBX_CS_SYMBOL
, SID_DRAWTBX_CS_SYMBOL
== nCurrentSId
));
1583 if ( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DRAWTBX_CS_ARROW
) )
1584 rSet
.Put(SfxBoolItem(SID_DRAWTBX_CS_ARROW
, SID_DRAWTBX_CS_ARROW
== nCurrentSId
));
1585 if ( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DRAWTBX_CS_FLOWCHART
) )
1586 rSet
.Put(SfxBoolItem(SID_DRAWTBX_CS_FLOWCHART
, SID_DRAWTBX_CS_FLOWCHART
== nCurrentSId
));
1587 if ( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DRAWTBX_CS_CALLOUT
) )
1588 rSet
.Put(SfxBoolItem(SID_DRAWTBX_CS_CALLOUT
,SID_DRAWTBX_CS_CALLOUT
== nCurrentSId
));
1589 if ( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DRAWTBX_CS_STAR
) )
1590 rSet
.Put(SfxBoolItem(SID_DRAWTBX_CS_STAR
, SID_DRAWTBX_CS_STAR
== nCurrentSId
));
1593 if ( bDisableEditHyperlink
|| GetDocSh()->IsReadOnly() )
1594 rSet
.DisableItem( SID_EDIT_HYPERLINK
);
1596 if ( bDisableEditHyperlink
)
1597 rSet
.DisableItem( SID_OPEN_HYPERLINK
);
1599 //fdo#78151 enable show next level/hide last level if editing a master page
1600 //PRESOBJ_OUTLINE object and the current selection allow that to happen
1602 bool bDisableShowNextLevel
= true;
1603 bool bDisableHideLastLevel
= true;
1606 ::Outliner
* pOL
= GetOutlinerForMasterPageOutlineTextObj(aSel
);
1609 //and are on the last paragraph
1611 if (aSel
.nEndPara
== pOL
->GetParagraphCount() - 1)
1613 sal_uInt16 nDepth
= pOL
->GetDepth(aSel
.nEndPara
);
1614 if (nDepth
!= sal_uInt16(-1))
1616 //there exists another numbering level that
1617 //is currently hidden
1619 bDisableShowNextLevel
= false;
1620 //there exists a previous numbering level
1622 bDisableHideLastLevel
= false;
1627 if (bDisableShowNextLevel
)
1628 rSet
.DisableItem(SID_SHOW_NEXT_LEVEL
);
1630 if (bDisableHideLastLevel
)
1631 rSet
.DisableItem(SID_HIDE_LAST_LEVEL
);
1634 #if defined WNT || defined UNX
1635 if( !mxScannerManager
.is() )
1637 rSet
.DisableItem( SID_TWAIN_SELECT
);
1638 rSet
.DisableItem( SID_TWAIN_TRANSFER
);
1642 // Set the state of two entries in the 'Slide' context sub-menu
1643 // concerning the visibility of master page background and master page
1645 if (rSet
.GetItemState(SID_DISPLAY_MASTER_BACKGROUND
) == SfxItemState::DEFAULT
1646 || rSet
.GetItemState(SID_DISPLAY_MASTER_OBJECTS
) == SfxItemState::DEFAULT
)
1648 SdPage
* pPage
= GetActualPage();
1650 && GetDoc() != NULL
)
1652 SetOfByte aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
1653 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
1654 sal_uInt8 aBackgroundId
= rLayerAdmin
.GetLayerID(SD_RESSTR(STR_LAYER_BCKGRND
), false);
1655 sal_uInt8 aObjectId
= rLayerAdmin
.GetLayerID(SD_RESSTR(STR_LAYER_BCKGRNDOBJ
), false);
1656 rSet
.Put(SfxBoolItem(SID_DISPLAY_MASTER_BACKGROUND
,
1657 aVisibleLayers
.IsSet(aBackgroundId
)));
1658 rSet
.Put(SfxBoolItem(SID_DISPLAY_MASTER_OBJECTS
,
1659 aVisibleLayers
.IsSet(aObjectId
)));
1663 #if !HAVE_FEATURE_GLTF
1664 if (SfxItemState::DEFAULT
== rSet
.GetItemState(SID_INSERT_3DMODEL
))
1666 rSet
.DisableItem(SID_INSERT_3DMODEL
);
1667 rSet
.Put(SfxVisibilityItem(SID_INSERT_3DMODEL
, false));
1671 GetModeSwitchingMenuState (rSet
);
1674 void DrawViewShell::GetModeSwitchingMenuState (SfxItemSet
&rSet
)
1677 rSet
.Put(SfxBoolItem(SID_DIAMODE
, false));
1678 rSet
.Put(SfxBoolItem(SID_OUTLINEMODE
, false));
1679 if (mePageKind
== PK_NOTES
)
1681 rSet
.Put(SfxBoolItem(SID_DRAWINGMODE
, false));
1682 rSet
.Put(SfxBoolItem(SID_NOTESMODE
, true));
1683 rSet
.Put(SfxBoolItem(SID_HANDOUTMODE
, false));
1685 else if (mePageKind
== PK_HANDOUT
)
1687 rSet
.Put(SfxBoolItem(SID_DRAWINGMODE
, false));
1688 rSet
.Put(SfxBoolItem(SID_NOTESMODE
, false));
1689 rSet
.Put(SfxBoolItem(SID_HANDOUTMODE
, true));
1693 rSet
.Put(SfxBoolItem(SID_DRAWINGMODE
, true));
1694 rSet
.Put(SfxBoolItem(SID_NOTESMODE
, false));
1695 rSet
.Put(SfxBoolItem(SID_HANDOUTMODE
, false));
1698 // Removed [GetDocSh()->GetCurrentFunction() ||] from the following
1699 // clause because the current function of the docshell can only be
1700 // search and replace or spell checking and in that case switching the
1701 // view mode is allowed.
1702 const bool bIsRunning
= SlideShow::IsRunning(GetViewShellBase());
1704 if (GetViewFrame()->GetFrame().IsInPlace() || bIsRunning
)
1706 if ( !GetViewFrame()->GetFrame().IsInPlace() )
1708 rSet
.ClearItem( SID_DRAWINGMODE
);
1709 rSet
.DisableItem( SID_DRAWINGMODE
);
1712 rSet
.ClearItem( SID_NOTESMODE
);
1713 rSet
.DisableItem( SID_NOTESMODE
);
1715 rSet
.ClearItem( SID_HANDOUTMODE
);
1716 rSet
.DisableItem( SID_HANDOUTMODE
);
1718 rSet
.ClearItem( SID_OUTLINEMODE
);
1719 rSet
.DisableItem( SID_OUTLINEMODE
);
1721 rSet
.ClearItem( SID_DIAMODE
);
1722 rSet
.DisableItem( SID_DIAMODE
);
1725 if (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED
)
1727 // Outplace-Edit: do not allow switch
1728 rSet
.ClearItem( SID_OUTLINEMODE
);
1729 rSet
.DisableItem( SID_OUTLINEMODE
);
1731 rSet
.ClearItem( SID_DIAMODE
);
1732 rSet
.DisableItem( SID_DIAMODE
);
1734 rSet
.ClearItem( SID_NOTESMODE
);
1735 rSet
.DisableItem( SID_NOTESMODE
);
1737 rSet
.ClearItem( SID_HANDOUTMODE
);
1738 rSet
.DisableItem( SID_HANDOUTMODE
);
1741 svx::ExtrusionBar::getState( mpDrawView
, rSet
);
1742 svx::FontworkBar::getState( mpDrawView
, rSet
);
1745 void DrawViewShell::GetState (SfxItemSet
& rSet
)
1747 // Iterate over all requested items in the set.
1748 SfxWhichIter
aIter( rSet
);
1749 sal_uInt16 nWhich
= aIter
.FirstWhich();
1754 case SID_SEARCH_ITEM
:
1755 case SID_SEARCH_OPTIONS
:
1756 // Forward this request to the common (old) code of the
1758 GetDocSh()->GetState (rSet
);
1761 OSL_TRACE ("DrawViewShell::GetState(): can not handle which id %d", nWhich
);
1764 nWhich
= aIter
.NextWhich();
1768 void DrawViewShell::Execute (SfxRequest
& rReq
)
1770 if(SlideShow::IsRunning(GetViewShellBase()))
1772 // Do not execute anything during a native slide show.
1776 switch (rReq
.GetSlot())
1778 case SID_SEARCH_ITEM
:
1779 // Forward this request to the common (old) code of the
1781 GetDocSh()->Execute (rReq
);
1784 case SID_SPELL_DIALOG
:
1786 SfxViewFrame
* pViewFrame
= GetViewFrame();
1787 if (rReq
.GetArgs() != NULL
)
1788 pViewFrame
->SetChildWindow (SID_SPELL_DIALOG
,
1789 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
1790 Get(SID_SPELL_DIALOG
)).GetValue());
1792 pViewFrame
->ToggleChildWindow(SID_SPELL_DIALOG
);
1794 pViewFrame
->GetBindings().Invalidate(SID_SPELL_DIALOG
);
1800 OSL_TRACE ("DrawViewShell::Execute(): can not handle slot %d", rReq
.GetSlot());
1805 } // end of namespace sd
1807 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */