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 .
22 #include <sal/config.h>
23 #include <sal/log.hxx>
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include <com/sun/star/linguistic2/XThesaurus.hpp>
29 #include <svx/pageitem.hxx>
30 #include <svx/rulritem.hxx>
31 #include <svx/svdouno.hxx>
32 #include <editeng/eeitem.hxx>
33 #include <editeng/sizeitem.hxx>
34 #include <editeng/urlfieldhelper.hxx>
35 #include <officecfg/Office/Impress.hxx>
36 #include <svx/svxids.hrc>
37 #include <svx/svdpagv.hxx>
38 #include <svx/clipfmtitem.hxx>
39 #include <svl/eitem.hxx>
40 #include <svl/intitem.hxx>
41 #include <svl/itemset.hxx>
42 #include <svl/stritem.hxx>
43 #include <svl/visitem.hxx>
44 #include <svl/whiter.hxx>
45 #include <svx/svdograf.hxx>
46 #include <svx/xfillit0.hxx>
47 #include <svx/xflclit.hxx>
48 #include <svx/xflgrit.hxx>
49 #include <svx/xflhtit.hxx>
50 #include <svx/xbtmpit.hxx>
51 #include <editeng/unolingu.hxx>
52 #include <svx/extrusionbar.hxx>
53 #include <svx/fontworkbar.hxx>
56 #include <svtools/insdlg.hxx>
57 #include <unotools/moduleoptions.hxx>
58 #include <svl/cjkoptions.hxx>
59 #include <comphelper/processfactory.hxx>
60 #include <sfx2/request.hxx>
62 #include <svtools/cliplistener.hxx>
63 #include <sfx2/bindings.hxx>
64 #include <sfx2/viewfrm.hxx>
68 #include <PresentationViewShell.hxx>
70 #include <drawdoc.hxx>
71 #include <DrawViewShell.hxx>
73 #include <unokywds.hxx>
75 #include <DrawDocShell.hxx>
76 #include <zoomlist.hxx>
77 #include <slideshow.hxx>
78 #include <drawview.hxx>
79 #include <ViewShellBase.hxx>
80 #include <ViewShellManager.hxx>
81 #include <LayerTabBar.hxx>
84 #include <fuediglu.hxx>
85 #include <fubullet.hxx>
86 #include <fuconcs.hxx>
87 #include <fuformatpaintbrush.hxx>
88 #include <stlsheet.hxx>
90 using namespace ::com::sun::star
;
91 using namespace ::com::sun::star::uno
;
92 using namespace ::com::sun::star::lang
;
93 using namespace ::com::sun::star::linguistic2
;
95 /** Create a list of clipboard formats that are supported both from the
96 current clipboard content and the DrawViewShell.
97 The list is stored in a new instance of SvxClipboardFormatItem.
99 static ::std::unique_ptr
<SvxClipboardFormatItem
> GetSupportedClipboardFormats (
100 TransferableDataHelper
& rDataHelper
)
102 ::std::unique_ptr
<SvxClipboardFormatItem
> pResult (
103 new SvxClipboardFormatItem(SID_CLIPBOARD_FORMAT_ITEMS
));
105 sal_uInt32
nFormatCount (rDataHelper
.GetFormatCount());
106 for (sal_uInt32 i
=0; i
<nFormatCount
; i
++)
108 const SotClipboardFormatId nTestFormat
= rDataHelper
.GetFormat(i
);
110 // Check if the current format is the same as one that has already
112 bool bDuplicate (false);
113 for (sal_uInt32 j
=0; j
<i
; j
++)
115 if (nTestFormat
== rDataHelper
.GetFormat(j
))
122 // Look up the format among those that are supported by the
128 case SotClipboardFormatId::EMBED_SOURCE
:
132 TransferableObjectDescriptor aDescriptor
;
133 if (rDataHelper
.GetTransferableObjectDescriptor(
134 SotClipboardFormatId::OBJECTDESCRIPTOR
, aDescriptor
))
136 sName
= aDescriptor
.maTypeName
;
138 if (!sName
.isEmpty())
139 pResult
->AddClipbrdFormat(nTestFormat
, sName
);
141 pResult
->AddClipbrdFormat(nTestFormat
);
147 case SotClipboardFormatId::LINK_SOURCE
:
148 case SotClipboardFormatId::DRAWING
:
149 case SotClipboardFormatId::SVXB
:
150 case SotClipboardFormatId::GDIMETAFILE
:
151 case SotClipboardFormatId::BITMAP
:
152 case SotClipboardFormatId::NETSCAPE_BOOKMARK
:
153 case SotClipboardFormatId::STRING
:
154 case SotClipboardFormatId::HTML
:
155 case SotClipboardFormatId::RTF
:
156 case SotClipboardFormatId::RICHTEXT
:
157 case SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT
:
158 pResult
->AddClipbrdFormat(nTestFormat
);
165 // Check some OLE formats whose names are handled differently.
166 SotClipboardFormatId
nFormat (SotClipboardFormatId::EMBED_SOURCE_OLE
);
167 bool bHasFormat (rDataHelper
.HasFormat(nFormat
));
170 bHasFormat
= rDataHelper
.HasFormat(nFormat
);
176 if (SvPasteObjectHelper::GetEmbeddedName (rDataHelper
, sName
, sSource
, nFormat
))
177 pResult
->AddClipbrdFormat (nFormat
, sName
);
185 IMPL_LINK( DrawViewShell
, ClipboardChanged
, TransferableDataHelper
*, pDataHelper
, void )
187 mbPastePossible
= ( pDataHelper
->GetFormatCount() != 0 );
189 // Update the list of supported clipboard formats according to the
190 // new clipboard content.
191 // There are some stack traces that indicate the possibility of the
192 // DrawViewShell destructor called during the call to
193 // GetSupportedClipboardFormats(). If that really has happened then
195 TransferableDataHelper
aDataHelper (
196 TransferableDataHelper::CreateFromSystemClipboard(GetActiveWindow()));
197 ::std::unique_ptr
<SvxClipboardFormatItem
> pFormats (GetSupportedClipboardFormats(aDataHelper
));
198 if (mpDrawView
== nullptr)
200 mpCurrentClipboardFormats
= std::move(pFormats
);
202 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
203 rBindings
.Invalidate( SID_PASTE
);
204 rBindings
.Invalidate( SID_PASTE_SPECIAL
);
205 rBindings
.Invalidate( SID_PASTE_UNFORMATTED
);
206 rBindings
.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS
);
209 void DrawViewShell::GetDrawAttrState(SfxItemSet
& rSet
)
211 SfxItemSet
aSet( mpDrawView
->GetGeoAttrFromMarked() );
212 rSet
.Put(aSet
,false);
215 ::Outliner
* DrawViewShell::GetOutlinerForMasterPageOutlineTextObj(ESelection
&rSel
)
220 //when there is one object selected
221 if (!mpDrawView
->AreObjectsMarked() || (mpDrawView
->GetMarkedObjectList().GetMarkCount() != 1))
224 //and we are editing the outline object
225 if (!mpDrawView
->IsTextEdit())
228 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
232 SdPage
* pPage
= static_cast<SdPage
*>(pPageView
->GetPage());
233 //only show these in a normal master page
234 if (!pPage
|| (pPage
->GetPageKind() != PageKind::Standard
) || !pPage
->IsMasterPage())
237 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
238 ::Outliner
* pOL
= pOLV
? pOLV
->GetOutliner() : nullptr;
241 rSel
= pOLV
->GetSelection();
246 void DrawViewShell::GetMarginProperties( SfxItemSet
&rSet
)
248 SdPage
*pPage
= getCurrentPage();
249 SfxWhichIter
aIter( rSet
);
250 sal_uInt16 nWhich
= aIter
.FirstWhich();
255 case SID_ATTR_PAGE_LRSPACE
:
257 // const SvxLRSpaceItem aTmpPageLRSpace ( rDesc.GetMaster().GetLRSpace() );
258 const SvxLongLRSpaceItem
aLongLR(
259 static_cast<::tools::Long
>(pPage
->GetLeftBorder()),
260 static_cast<::tools::Long
>(pPage
->GetRightBorder()),
261 SID_ATTR_PAGE_LRSPACE
);
266 case SID_ATTR_PAGE_ULSPACE
:
268 // const SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
269 SvxLongULSpaceItem
aLongUL(
270 static_cast<::tools::Long
>(pPage
->GetUpperBorder()),
271 static_cast<::tools::Long
>(pPage
->GetLowerBorder()),
272 SID_ATTR_PAGE_ULSPACE
);
280 nWhich
= aIter
.NextWhich();
284 bool DrawViewShell::ShouldDisableEditHyperlink() const
288 if (!mpDrawView
->AreObjectsMarked())
290 if (mpDrawView
->GetMarkedObjectList().GetMarkCount() != 1)
293 bool bDisableEditHyperlink
= true;
294 if( mpDrawView
->IsTextEdit() )
296 if (URLFieldHelper::IsCursorAtURLField(mpDrawView
->GetTextEditOutlinerView()))
297 bDisableEditHyperlink
= false;
301 SdrUnoObj
* pUnoCtrl
= dynamic_cast<SdrUnoObj
*>( mpDrawView
->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj() );
303 if ( pUnoCtrl
&& SdrInventor::FmForm
== pUnoCtrl
->GetObjInventor() )
305 const uno::Reference
< awt::XControlModel
>& xControlModel( pUnoCtrl
->GetUnoControlModel() );
306 if( xControlModel
.is() )
308 uno::Reference
< beans::XPropertySet
> xPropSet( xControlModel
, uno::UNO_QUERY
);
311 uno::Reference
< beans::XPropertySetInfo
> xPropInfo( xPropSet
->getPropertySetInfo() );
312 if( xPropInfo
.is() && xPropInfo
->hasPropertyByName( "TargetURL") )
314 bDisableEditHyperlink
= false;
320 return bDisableEditHyperlink
;
323 void DrawViewShell::GetMenuState( SfxItemSet
&rSet
)
325 if (mpDrawView
== nullptr)
327 // This assertion and return are here to prevent crashes.
328 DBG_ASSERT(mpDrawView
!=nullptr, "Please report this assertion to the Impress team.");
332 ViewShell::GetMenuState(rSet
);
333 bool bDisableVerticalText
= !SvtCJKOptions::IsVerticalTextEnabled();
335 if ( bDisableVerticalText
)
337 rSet
.DisableItem( SID_DRAW_FONTWORK_VERTICAL
);
338 rSet
.DisableItem( SID_DRAW_CAPTION_VERTICAL
);
339 rSet
.DisableItem( SID_TEXT_FITTOSIZE_VERTICAL
);
340 rSet
.DisableItem( SID_DRAW_TEXT_VERTICAL
);
343 bool bConvertToPathPossible
= mpDrawView
->IsConvertToPathObjPossible();
345 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
346 const size_t nMarkCount
= rMarkList
.GetMarkCount();
348 if( nMarkCount
== 1 )
350 bool bDisable
= true;
351 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
352 if( auto pGrafObj
= dynamic_cast<const SdrGrafObj
*>( pObj
) )
353 if( pGrafObj
->getQrCode() )
357 rSet
.DisableItem(SID_EDIT_QRCODE
);
362 FuFormatPaintBrush::GetMenuState( *this, rSet
);
364 // State of SfxChild-Windows (Animator, Fontwork etc.)
365 SetChildWindowState( rSet
);
367 if(HasCurrentFunction())
369 sal_uInt16 nSId
= GetCurrentFunction()->GetSlotID();
370 rSet
.Put( SfxBoolItem( nSId
, true ) );
373 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
375 GetMenuStateSel(rSet
);
377 if (SfxItemState::DEFAULT
== rSet
.GetItemState(SID_ASSIGN_LAYOUT
))
379 bool bDisable
= true;
382 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
384 if( pPage
&& !pPage
->IsMasterPage() )
386 rSet
.Put( SfxUInt32Item( SID_ASSIGN_LAYOUT
, static_cast< sal_uInt32
>(pPage
->GetAutoLayout()) ) );
393 rSet
.DisableItem(SID_ASSIGN_LAYOUT
);
397 if (SfxItemState::DEFAULT
== rSet
.GetItemState(SID_EXPAND_PAGE
))
399 bool bDisable
= true;
402 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
404 if( pPage
&& (pPage
->GetPageKind() == PageKind::Standard
) && !pPage
->IsMasterPage() )
406 SdrObject
* pObj
= pPage
->GetPresObj(PresObjKind::Outline
);
410 if( !pObj
->IsEmptyPresObj() )
416 // check if the object is in edit, then if it's temporarily not empty
417 SdrTextObj
* pTextObj
= DynCastSdrTextObj( pObj
);
420 if( pTextObj
->CanCreateEditOutlinerParaObject() )
432 rSet
.DisableItem(SID_EXPAND_PAGE
);
436 if (SfxItemState::DEFAULT
== rSet
.GetItemState(SID_SUMMARY_PAGE
))
438 bool bDisable
= true;
441 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
443 if( pPage
&& (pPage
->GetPageKind() == PageKind::Standard
) && !pPage
->IsMasterPage() )
445 SdrObject
* pObj
= pPage
->GetPresObj(PresObjKind::Title
);
447 if(pObj
&& !pObj
->IsEmptyPresObj())
456 rSet
.DisableItem(SID_SUMMARY_PAGE
);
460 if (SfxItemState::DEFAULT
== rSet
.GetItemState(SID_ASSIGN_LAYOUT
))
462 bool bDisable
= true;
465 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
467 if( pPage
&& !pPage
->IsMasterPage() )
469 rSet
.Put( SfxUInt32Item(SID_ASSIGN_LAYOUT
, pPage
->GetAutoLayout()) );
476 rSet
.DisableItem(SID_ASSIGN_LAYOUT
);
480 // is it possible to start the presentation?
481 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_PRESENTATION
) ||
482 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_REHEARSE_TIMINGS
) )
484 bool bDisable
= true;
485 sal_uInt16 nCount
= GetDoc()->GetSdPageCount( PageKind::Standard
);
487 for( sal_uInt16 i
= 0; i
< nCount
&& bDisable
; i
++ )
489 SdPage
* pPage
= GetDoc()->GetSdPage(i
, PageKind::Standard
);
491 if( !pPage
->IsExcluded() )
495 if( bDisable
|| GetDocSh()->IsPreview())
497 rSet
.DisableItem( SID_PRESENTATION
);
498 rSet
.DisableItem( SID_REHEARSE_TIMINGS
);
503 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_EDITMODE
) ||
504 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_INSERT_POINT
) ||
505 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_PERCENT
) ||
506 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR
) ||
507 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR_LEFT
) ||
508 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR_RIGHT
) ||
509 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR_TOP
) ||
510 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR_BOTTOM
) ||
511 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_HORZALIGN_CENTER
) ||
512 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_HORZALIGN_LEFT
) ||
513 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_HORZALIGN_RIGHT
) ||
514 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_VERTALIGN_CENTER
) ||
515 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_VERTALIGN_TOP
) ||
516 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_VERTALIGN_BOTTOM
) )
519 TriState eState
= mpDrawView
->IsMarkedGluePointsPercent();
520 if( eState
== TRISTATE_INDET
)
521 rSet
.InvalidateItem( SID_GLUE_PERCENT
);
523 rSet
.Put( SfxBoolItem( SID_GLUE_PERCENT
, eState
== TRISTATE_TRUE
) );
525 // alignment has no effect by percent
526 if( eState
== TRISTATE_TRUE
)
528 rSet
.DisableItem( SID_GLUE_HORZALIGN_CENTER
);
529 rSet
.DisableItem( SID_GLUE_HORZALIGN_LEFT
);
530 rSet
.DisableItem( SID_GLUE_HORZALIGN_RIGHT
);
531 rSet
.DisableItem( SID_GLUE_VERTALIGN_CENTER
);
532 rSet
.DisableItem( SID_GLUE_VERTALIGN_TOP
);
533 rSet
.DisableItem( SID_GLUE_VERTALIGN_BOTTOM
);
537 // horizontal alignment
538 SdrAlign nHorz
= mpDrawView
->GetMarkedGluePointsAlign( false );
539 rSet
.Put( SfxBoolItem( SID_GLUE_HORZALIGN_CENTER
, nHorz
== SdrAlign::HORZ_CENTER
) );
540 rSet
.Put( SfxBoolItem( SID_GLUE_HORZALIGN_LEFT
, nHorz
== SdrAlign::HORZ_LEFT
) );
541 rSet
.Put( SfxBoolItem( SID_GLUE_HORZALIGN_RIGHT
, nHorz
== SdrAlign::HORZ_RIGHT
) );
542 // vertical alignment
543 SdrAlign nVert
= mpDrawView
->GetMarkedGluePointsAlign( true );
544 rSet
.Put( SfxBoolItem( SID_GLUE_VERTALIGN_CENTER
, nVert
== SdrAlign::VERT_CENTER
) );
545 rSet
.Put( SfxBoolItem( SID_GLUE_VERTALIGN_TOP
, nVert
== SdrAlign::VERT_TOP
) );
546 rSet
.Put( SfxBoolItem( SID_GLUE_VERTALIGN_BOTTOM
, nVert
== SdrAlign::VERT_BOTTOM
) );
550 rSet
.Put( SfxBoolItem( SID_GLUE_INSERT_POINT
, mpDrawView
->IsInsGluePointMode() ) );
554 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SdrEscapeDirection::LEFT
);
555 if( eState
== TRISTATE_INDET
)
556 rSet
.InvalidateItem( SID_GLUE_ESCDIR_LEFT
);
558 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_LEFT
, eState
== TRISTATE_TRUE
) );
560 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SdrEscapeDirection::RIGHT
);
561 if( eState
== TRISTATE_INDET
)
562 rSet
.InvalidateItem( SID_GLUE_ESCDIR_RIGHT
);
564 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_RIGHT
, eState
== TRISTATE_TRUE
) );
566 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SdrEscapeDirection::TOP
);
567 if( eState
== TRISTATE_INDET
)
568 rSet
.InvalidateItem( SID_GLUE_ESCDIR_TOP
);
570 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_TOP
, eState
== TRISTATE_TRUE
) );
572 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SdrEscapeDirection::BOTTOM
);
573 if( eState
== TRISTATE_INDET
)
574 rSet
.InvalidateItem( SID_GLUE_ESCDIR_BOTTOM
);
576 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_BOTTOM
, eState
== TRISTATE_TRUE
) );
579 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GRID_FRONT
) ||
580 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_HELPLINES_FRONT
) )
582 rSet
.Put( SfxBoolItem( SID_GRID_FRONT
, mpDrawView
->IsGridFront() ) );
583 rSet
.Put( SfxBoolItem( SID_HELPLINES_FRONT
, mpDrawView
->IsHlplFront() ) );
586 if (!mpDrawView
->IsFrameDragSingles())
587 rSet
.Put(SfxBoolItem(SID_BEZIER_EDIT
, true));
589 rSet
.Put(SfxBoolItem(SID_BEZIER_EDIT
, false));
591 if(dynamic_cast<FuEditGluePoints
*>( GetCurrentFunction().get()))
592 rSet
.Put(SfxBoolItem(SID_GLUE_EDITMODE
, true));
594 rSet
.Put(SfxBoolItem(SID_GLUE_EDITMODE
, false));
596 if( !mpDrawView
->IsMirrorAllowed( true, true ) )
598 rSet
.DisableItem( SID_HORIZONTAL
);
599 rSet
.DisableItem( SID_VERTICAL
);
600 rSet
.DisableItem( SID_FLIP_HORIZONTAL
);
601 rSet
.DisableItem( SID_FLIP_VERTICAL
);
604 if( !mpDrawView
->IsMirrorAllowed() )
606 rSet
.DisableItem( SID_OBJECT_MIRROR
);
607 // rSet.DisableItem( SID_CONVERT_TO_3D_LATHE );
608 // rSet.DisableItem( SID_CONVERT_TO_3D_LATHE_FAST );
611 // interactive transparence control
612 if(!mpDrawView
->IsTransparenceAllowed())
614 rSet
.DisableItem( SID_OBJECT_TRANSPARENCE
);
617 // interactive gradient control
618 if(!mpDrawView
->IsGradientAllowed())
620 rSet
.DisableItem( SID_OBJECT_GRADIENT
);
623 // disable morphing if necessary
624 if ( !mpDrawView
->IsMorphingAllowed() )
625 rSet
.DisableItem( SID_POLYGON_MORPHING
);
627 if( !mpDrawView
->IsReverseOrderPossible() )
629 rSet
.DisableItem( SID_REVERSE_ORDER
);
632 if ( !bConvertToPathPossible
&&
633 !mpDrawView
->IsCrookAllowed( mpDrawView
->IsCrookNoContortion() ) )
635 // implicit transformation into curve not possible
636 rSet
.DisableItem(SID_OBJECT_CROOK_ROTATE
);
637 rSet
.DisableItem(SID_OBJECT_CROOK_SLANT
);
638 rSet
.DisableItem(SID_OBJECT_CROOK_STRETCH
);
641 if ( !mpDrawView
->IsGroupEntered() )
643 rSet
.DisableItem( SID_LEAVE_GROUP
);
644 rSet
.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS
, false ) );
645 rSet
.ClearItem( SID_LEAVE_ALL_GROUPS
);
646 rSet
.DisableItem( SID_LEAVE_ALL_GROUPS
);
649 rSet
.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS
, true ) );
651 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_THESAURUS
) )
653 if ( !mpDrawView
->IsTextEdit() )
655 rSet
.DisableItem( SID_THESAURUS
);
659 LanguageType eLang
= GetDoc()->GetLanguage( EE_CHAR_LANGUAGE
);
660 Reference
< XThesaurus
> xThesaurus( LinguMgr::GetThesaurus() );
662 if (!xThesaurus
.is() || eLang
== LANGUAGE_NONE
|| !xThesaurus
->hasLocale( LanguageTag::convertToLocale( eLang
)) )
663 rSet
.DisableItem( SID_THESAURUS
);
667 if ( !mpDrawView
->IsTextEdit() )
669 rSet
.DisableItem( SID_THESAURUS
);
672 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_SELECTALL
) ||
673 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_SIZE_ALL
) )
675 if( pPageView
&& pPageView
->GetObjList()->GetObjCount() == 0 )
677 // should be disabled if there is no object on the draw area:
678 rSet
.DisableItem( SID_SELECTALL
);
679 rSet
.DisableItem( SID_SIZE_ALL
);
683 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_CONTEXT
) )
684 rSet
.Put( SfxStringItem( SID_CONTEXT
, mpDrawView
->GetStatusText() ) );
687 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_PASTE
) ||
688 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_PASTE_SPECIAL
) ||
689 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_PASTE_UNFORMATTED
) ||
690 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS
) )
692 if ( !mxClipEvtLstnr
.is() )
694 // avoid clipboard initialization for
695 // read-only presentation views (workaround for NT4.0
696 // clipboard prob...)
697 if( dynamic_cast< const PresentationViewShell
*>( this ) == nullptr )
700 mxClipEvtLstnr
= new TransferableClipboardListener( LINK( this, DrawViewShell
, ClipboardChanged
) );
701 mxClipEvtLstnr
->AddListener( GetActiveWindow() );
704 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
705 mbPastePossible
= ( aDataHelper
.GetFormatCount() != 0 );
706 mpCurrentClipboardFormats
= GetSupportedClipboardFormats( aDataHelper
);
709 mbPastePossible
= false;
712 if( !mbPastePossible
)
714 rSet
.DisableItem( SID_PASTE
);
715 rSet
.DisableItem( SID_PASTE_SPECIAL
);
716 rSet
.DisableItem( SID_PASTE_UNFORMATTED
);
717 rSet
.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS
);
719 else if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS
) )
721 if (mpCurrentClipboardFormats
!= nullptr)
722 rSet
.Put(*mpCurrentClipboardFormats
);
726 if ( !bConvertToPathPossible
)
728 rSet
.DisableItem(SID_CHANGEBEZIER
);
731 if (mpDrawView
== nullptr)
733 // The mpDrawView was not NULL but is now.
734 // The reason for this may be that the DrawViewShell has been
735 // destroyed in the meantime.
736 // We can only return immediately and hope that the deleted
737 // DrawViewShell is not called again.
738 DBG_ASSERT(mpDrawView
!=nullptr, "Please report this assertion to the Impress team.");
742 if( !( mpDrawView
->IsConvertToPolyObjPossible() || mpDrawView
->IsVectorizeAllowed() ) )
743 rSet
.DisableItem(SID_CHANGEPOLYGON
);
745 if( !( mpDrawView
->IsConvertToPolyObjPossible() || mpDrawView
->IsConvertToContourPossible() ) )
746 rSet
.DisableItem(SID_CONVERT_TO_CONTOUR
);
748 if ( !mpDrawView
->IsConvertTo3DObjPossible() )
750 rSet
.DisableItem(SID_CONVERT_TO_3D
);
751 rSet
.DisableItem(SID_CONVERT_TO_3D_LATHE
);
752 rSet
.DisableItem(SID_CONVERT_TO_3D_LATHE_FAST
);
755 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_MANAGE_LINKS
) )
757 if ( GetDoc()->GetLinkCount() == 0 )
759 rSet
.DisableItem(SID_MANAGE_LINKS
);
763 if (mePageKind
== PageKind::Handout
)
765 rSet
.DisableItem(SID_PRESENTATION_LAYOUT
);
766 rSet
.DisableItem(SID_SELECT_BACKGROUND
);
767 rSet
.DisableItem(SID_SAVE_BACKGROUND
);
770 if (mePageKind
== PageKind::Notes
)
772 rSet
.DisableItem(SID_INSERTPAGE
);
773 rSet
.DisableItem(SID_RENAMEPAGE
);
774 rSet
.DisableItem(SID_RENAMEPAGE_QUICK
);
775 rSet
.DisableItem(SID_DUPLICATE_PAGE
);
776 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
777 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
778 rSet
.DisableItem(SID_ANIMATION_EFFECTS
);
779 rSet
.DisableItem(SID_EXECUTE_ANIMATION_EFFECT
);
781 if (meEditMode
== EditMode::MasterPage
)
782 rSet
.DisableItem(SID_MODIFYPAGE
);
784 rSet
.DisableItem(SID_SELECT_BACKGROUND
);
785 rSet
.DisableItem(SID_SAVE_BACKGROUND
);
786 rSet
.DisableItem(SID_INSERTLAYER
);
787 rSet
.DisableItem(SID_LAYERMODE
);
788 rSet
.DisableItem(SID_INSERTFILE
);
790 else if (mePageKind
== PageKind::Handout
)
792 rSet
.DisableItem(SID_INSERTPAGE
);
793 rSet
.DisableItem(SID_DUPLICATE_PAGE
);
794 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
795 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
796 rSet
.DisableItem(SID_ANIMATION_EFFECTS
);
797 rSet
.DisableItem(SID_EXECUTE_ANIMATION_EFFECT
);
798 rSet
.DisableItem(SID_RENAMEPAGE
);
799 rSet
.DisableItem(SID_RENAMEPAGE_QUICK
);
800 rSet
.DisableItem(SID_INSERTLAYER
);
801 rSet
.DisableItem(SID_MODIFYLAYER
);
802 rSet
.DisableItem(SID_TOGGLELAYERVISIBILITY
);
803 rSet
.DisableItem(SID_RENAMELAYER
);
804 rSet
.DisableItem(SID_LAYERMODE
);
805 rSet
.DisableItem(SID_INSERTFILE
);
806 rSet
.DisableItem(SID_PAGEMODE
);
807 rSet
.DisableItem(SID_SELECT_BACKGROUND
);
808 rSet
.DisableItem(SID_SAVE_BACKGROUND
);
812 if (meEditMode
== EditMode::MasterPage
)
814 rSet
.DisableItem(SID_INSERTPAGE
);
815 rSet
.DisableItem(SID_DUPLICATE_PAGE
);
816 rSet
.DisableItem(SID_MODIFYPAGE
);
817 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
818 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
821 rSet
.Put (SfxBoolItem (SID_LAYERMODE
, IsLayerModeActive()));
824 if ( ! IsLayerModeActive())
826 rSet
.DisableItem( SID_INSERTLAYER
);
827 rSet
.DisableItem( SID_MODIFYLAYER
);
828 rSet
.DisableItem( SID_TOGGLELAYERVISIBILITY
);
829 rSet
.DisableItem( SID_DELETE_LAYER
);
830 rSet
.DisableItem( SID_RENAMELAYER
);
833 if (meEditMode
== EditMode::Page
)
835 /**********************************************************************
837 **********************************************************************/
838 rSet
.Put(SfxBoolItem(SID_PAGEMODE
, true));
839 rSet
.Put(SfxBoolItem(SID_MASTERPAGE
, false));
840 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTER_MODE
, false));
841 rSet
.Put(SfxBoolItem(SID_NOTES_MASTER_MODE
, false));
842 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTER_MODE
, false));
844 rSet
.DisableItem (SID_INSERT_MASTER_PAGE
);
845 rSet
.DisableItem (SID_DELETE_MASTER_PAGE
);
846 rSet
.DisableItem (SID_RENAME_MASTER_PAGE
);
847 rSet
.DisableItem (SID_CLOSE_MASTER_VIEW
);
851 rSet
.Put(SfxBoolItem(SID_PAGEMODE
, false));
852 rSet
.Put(SfxBoolItem(SID_MASTERPAGE
, true));
854 /**********************************************************************
855 * Background page mode
856 **********************************************************************/
857 if (mePageKind
== PageKind::Standard
)
859 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTER_MODE
, true));
860 rSet
.Put(SfxBoolItem(SID_NOTES_MASTER_MODE
, false));
861 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTER_MODE
, false));
864 else if (mePageKind
== PageKind::Notes
)
866 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTER_MODE
, false));
867 rSet
.Put(SfxBoolItem(SID_NOTES_MASTER_MODE
, true));
868 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTER_MODE
, false));
870 else if (mePageKind
== PageKind::Handout
)
872 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTER_MODE
, false));
873 rSet
.Put(SfxBoolItem(SID_NOTES_MASTER_MODE
, false));
874 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTER_MODE
, true));
878 // set state of the ruler
879 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_RULER
) )
880 rSet
.Put( SfxBoolItem( SID_RULER
, HasRuler() ) );
882 // do not delete the last page or a master page
883 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DELETE_PAGE
)
884 || SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DELETE_MASTER_PAGE
) )
886 if (maTabControl
->GetPageCount() == 1 ||
887 meEditMode
== EditMode::MasterPage
||
888 mePageKind
== PageKind::Notes
||
889 mePageKind
== PageKind::Handout
||
890 (GetShellType()!=ST_DRAW
&&IsLayerModeActive()))
892 if (rSet
.GetItemState(SID_DELETE_PAGE
) == SfxItemState::DEFAULT
)
893 rSet
.DisableItem(SID_DELETE_PAGE
);
894 if (rSet
.GetItemState(SID_DELETE_MASTER_PAGE
)==SfxItemState::DEFAULT
)
895 rSet
.DisableItem(SID_DELETE_MASTER_PAGE
);
899 // is it allowed to delete the current layer?
900 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DELETE_LAYER
)
901 || SfxItemState::DEFAULT
== rSet
.GetItemState( SID_RENAMELAYER
) )
903 if(GetLayerTabControl()) // #i87182#
905 sal_uInt16 nCurrentLayer
= GetLayerTabControl()->GetCurPageId();
906 const OUString
& rName
= GetLayerTabControl()->GetLayerName(nCurrentLayer
);
908 if (!IsLayerModeActive() || LayerTabBar::IsRealNameOfStandardLayer(rName
))
910 rSet
.DisableItem(SID_DELETE_LAYER
);
911 rSet
.DisableItem(SID_RENAMELAYER
);
916 OSL_ENSURE(false, "No LayerTabBar (!)");
920 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_CUT
) ||
921 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_COPY
) ||
922 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_OUTLINE_BULLET
))
924 OutlinerView
* pOlView
= mpDrawView
->GetTextEditOutlinerView();
926 // special treatment of for SID_OUTLINE_BULLET if objects with different
927 // kinds of NumBullets are marked
928 bool bHasOutliner
= false;
929 bool bHasOther
= false;
930 for(size_t nNum
= 0; nNum
< nMarkCount
; ++nNum
)
932 SdrObject
* pObj
= rMarkList
.GetMark(nNum
)->GetMarkedSdrObj();
933 if( pObj
->GetObjInventor() == SdrInventor::Default
)
935 if( pObj
->GetObjIdentifier() == SdrObjKind::OutlineText
)
950 if( bHasOther
&& bHasOutliner
)
951 rSet
.DisableItem( SID_OUTLINE_BULLET
);
955 if (pOlView
->GetSelected().isEmpty() || GetObjectShell()->isContentExtractionLocked())
957 rSet
.DisableItem( SID_CUT
);
958 rSet
.DisableItem( SID_COPY
);
964 FuBullet::GetSlotState( rSet
, this, GetViewFrame() );
966 if ( GetDocSh()->IsUIActive() )
968 rSet
.DisableItem( SID_INSERT_OBJECT
);
969 rSet
.DisableItem( SID_INSERT_FLOATINGFRAME
);
970 rSet
.DisableItem( SID_INSERT_MATH
);
971 rSet
.DisableItem( SID_INSERT_DIAGRAM
);
972 rSet
.DisableItem( SID_ATTR_TABLE
);
973 rSet
.DisableItem( SID_SIZE_REAL
);
974 rSet
.DisableItem( SID_SIZE_OPTIMAL
);
975 rSet
.DisableItem( SID_SIZE_ALL
);
976 rSet
.DisableItem( SID_SIZE_PAGE_WIDTH
);
977 rSet
.DisableItem( SID_SIZE_PAGE
);
978 rSet
.DisableItem( SID_DUPLICATE_PAGE
);
979 rSet
.DisableItem( SID_ZOOM_TOOLBOX
);
983 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_ZOOM_IN
) ||
984 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_ZOOM_OUT
)||
985 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_ZOOM_PANNING
) )
987 if( GetActiveWindow()->GetZoom() <= GetActiveWindow()->GetMinZoom() || GetDocSh()->IsUIActive() )
989 rSet
.DisableItem( SID_ZOOM_OUT
);
990 rSet
.DisableItem( SID_ZOOM_PANNING
);
992 if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() )
993 rSet
.DisableItem( SID_ZOOM_IN
);
996 if (!mpZoomList
->IsNextPossible())
998 rSet
.DisableItem(SID_ZOOM_NEXT
);
1000 if (!mpZoomList
->IsPreviousPossible())
1002 rSet
.DisableItem(SID_ZOOM_PREV
);
1005 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_REMOTE_DLG
) )
1008 bool bDisableSdremoteForGood
= false;
1009 #ifndef ENABLE_SDREMOTE
1010 bDisableSdremoteForGood
= true;
1012 bDisableSdremoteForGood
|= ! ( /*officecfg::Office::Common::Misc::ExperimentalMode::get() &&*/
1013 officecfg::Office::Impress::Misc::Start::EnableSdremote::get() );
1015 // This dialog is only useful for TCP/IP remote control
1016 // which is unusual, under-tested and a security issue.
1017 if ( bDisableSdremoteForGood
)
1019 rSet
.Put(SfxVisibilityItem(SID_REMOTE_DLG
, false));
1024 if (GetViewShellBase().GetViewShellManager()->GetShell(ToolbarId::Draw_Text_Toolbox_Sd
) != nullptr)
1026 sal_uInt16 nCurrentSId
= SID_ATTR_CHAR
;
1028 if(HasCurrentFunction())
1030 nCurrentSId
= GetCurrentFunction()->GetSlotID();
1032 if( nCurrentSId
!= SID_TEXT_FITTOSIZE
&&
1033 nCurrentSId
!= SID_TEXT_FITTOSIZE_VERTICAL
&&
1034 nCurrentSId
!= SID_ATTR_CHAR_VERTICAL
)
1035 nCurrentSId
= SID_ATTR_CHAR
;
1037 rSet
.Put( SfxBoolItem( nCurrentSId
, true ) );
1040 if ( GetDocSh()->IsReadOnly() )
1042 rSet
.DisableItem( SID_AUTOSPELL_CHECK
);
1046 if (GetDoc()->GetOnlineSpell())
1048 rSet
.Put(SfxBoolItem(SID_AUTOSPELL_CHECK
, true));
1052 rSet
.Put(SfxBoolItem(SID_AUTOSPELL_CHECK
, false));
1056 SdrPageView
* pPV
= mpDrawView
->GetSdrPageView();
1057 OUString aActiveLayer
= mpDrawView
->GetActiveLayer();
1059 if ( ( !aActiveLayer
.isEmpty() && 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_PASTE_UNFORMATTED
);
1066 rSet
.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS
);
1068 rSet
.DisableItem( SID_INSERT_FLD_DATE_FIX
);
1069 rSet
.DisableItem( SID_INSERT_FLD_DATE_VAR
);
1070 rSet
.DisableItem( SID_INSERT_FLD_TIME_FIX
);
1071 rSet
.DisableItem( SID_INSERT_FLD_TIME_VAR
);
1072 rSet
.DisableItem( SID_INSERT_FLD_AUTHOR
);
1073 rSet
.DisableItem( SID_INSERT_FLD_PAGE
);
1074 rSet
.DisableItem( SID_INSERT_FLD_PAGE_TITLE
);
1075 rSet
.DisableItem( SID_INSERT_FLD_PAGES
);
1076 rSet
.DisableItem( SID_INSERT_FLD_FILE
);
1078 rSet
.DisableItem( SID_INSERT_GRAPHIC
);
1079 rSet
.DisableItem( SID_INSERT_AVMEDIA
);
1080 rSet
.DisableItem( SID_INSERT_DIAGRAM
);
1081 rSet
.DisableItem( SID_INSERT_OBJECT
);
1082 rSet
.DisableItem( SID_INSERT_FLOATINGFRAME
);
1084 rSet
.DisableItem( SID_INSERT_MATH
);
1085 rSet
.DisableItem( SID_INSERT_FRAME
);
1086 rSet
.DisableItem( SID_INSERTFILE
);
1087 rSet
.DisableItem( SID_ATTR_TABLE
);
1088 rSet
.DisableItem( SID_COPYOBJECTS
);
1090 rSet
.DisableItem( SID_SCAN
);
1091 rSet
.DisableItem( SID_TWAIN_SELECT
);
1092 rSet
.DisableItem( SID_TWAIN_TRANSFER
);
1094 // rSet.DisableItem( SID_BEZIER_EDIT );
1095 rSet
.DisableItem( SID_GLUE_EDITMODE
);
1096 rSet
.DisableItem( SID_OBJECT_ROTATE
);
1097 rSet
.DisableItem( SID_OBJECT_SHEAR
);
1098 rSet
.DisableItem( SID_OBJECT_MIRROR
);
1099 rSet
.DisableItem( SID_OBJECT_CROP
);
1100 rSet
.DisableItem( SID_ATTR_GRAF_CROP
);
1101 rSet
.DisableItem( SID_OBJECT_TRANSPARENCE
);
1102 rSet
.DisableItem( SID_OBJECT_GRADIENT
);
1103 rSet
.DisableItem( SID_OBJECT_CROOK_ROTATE
);
1104 rSet
.DisableItem( SID_OBJECT_CROOK_SLANT
);
1105 rSet
.DisableItem( SID_OBJECT_CROOK_STRETCH
);
1107 // Disable all object-creating tools
1108 rSet
.ClearItem( SID_ATTR_CHAR
);
1109 rSet
.DisableItem( SID_ATTR_CHAR
);
1110 rSet
.ClearItem( SID_ATTR_CHAR_VERTICAL
);
1111 rSet
.DisableItem( SID_ATTR_CHAR_VERTICAL
);
1112 rSet
.ClearItem(SID_DRAW_LINE
);
1113 rSet
.DisableItem(SID_DRAW_LINE
);
1114 rSet
.ClearItem(SID_DRAW_MEASURELINE
);
1115 rSet
.DisableItem(SID_DRAW_MEASURELINE
);
1116 rSet
.ClearItem(SID_DRAW_XLINE
);
1117 rSet
.DisableItem(SID_DRAW_XLINE
);
1118 rSet
.ClearItem( SID_LINE_ARROW_START
);
1119 rSet
.DisableItem( SID_LINE_ARROW_START
);
1120 rSet
.ClearItem( SID_LINE_ARROW_END
);
1121 rSet
.DisableItem( SID_LINE_ARROW_END
);
1122 rSet
.ClearItem( SID_LINE_ARROWS
);
1123 rSet
.DisableItem( SID_LINE_ARROWS
);
1124 rSet
.ClearItem( SID_LINE_ARROW_CIRCLE
);
1125 rSet
.DisableItem( SID_LINE_ARROW_CIRCLE
);
1126 rSet
.ClearItem( SID_LINE_CIRCLE_ARROW
);
1127 rSet
.DisableItem( SID_LINE_CIRCLE_ARROW
);
1128 rSet
.ClearItem( SID_LINE_ARROW_SQUARE
);
1129 rSet
.DisableItem( SID_LINE_ARROW_SQUARE
);
1130 rSet
.ClearItem( SID_LINE_SQUARE_ARROW
);
1131 rSet
.DisableItem( SID_LINE_SQUARE_ARROW
);
1133 rSet
.ClearItem(SID_DRAW_RECT
);
1134 rSet
.DisableItem(SID_DRAW_RECT
);
1135 rSet
.ClearItem(SID_DRAW_RECT_NOFILL
);
1136 rSet
.DisableItem(SID_DRAW_RECT_NOFILL
);
1137 rSet
.ClearItem(SID_DRAW_RECT_ROUND
);
1138 rSet
.DisableItem(SID_DRAW_RECT_ROUND
);
1139 rSet
.ClearItem(SID_DRAW_RECT_ROUND_NOFILL
);
1140 rSet
.DisableItem(SID_DRAW_RECT_ROUND_NOFILL
);
1141 rSet
.ClearItem(SID_DRAW_SQUARE
);
1142 rSet
.DisableItem(SID_DRAW_SQUARE
);
1143 rSet
.ClearItem(SID_DRAW_SQUARE_NOFILL
);
1144 rSet
.DisableItem(SID_DRAW_SQUARE_NOFILL
);
1145 rSet
.ClearItem(SID_DRAW_SQUARE_ROUND
);
1146 rSet
.DisableItem(SID_DRAW_SQUARE_ROUND
);
1147 rSet
.ClearItem(SID_DRAW_SQUARE_ROUND_NOFILL
);
1148 rSet
.DisableItem(SID_DRAW_SQUARE_ROUND_NOFILL
);
1149 rSet
.ClearItem(SID_DRAW_ELLIPSE
);
1150 rSet
.DisableItem(SID_DRAW_ELLIPSE
);
1151 rSet
.ClearItem(SID_DRAW_ELLIPSE_NOFILL
);
1152 rSet
.DisableItem(SID_DRAW_ELLIPSE_NOFILL
);
1153 rSet
.ClearItem(SID_DRAW_CIRCLE
);
1154 rSet
.DisableItem(SID_DRAW_CIRCLE
);
1155 rSet
.ClearItem(SID_DRAW_CIRCLE_NOFILL
);
1156 rSet
.DisableItem(SID_DRAW_CIRCLE_NOFILL
);
1157 rSet
.ClearItem(SID_DRAW_CAPTION
);
1158 rSet
.DisableItem(SID_DRAW_CAPTION
);
1159 rSet
.ClearItem(SID_DRAW_FONTWORK
);
1160 rSet
.DisableItem(SID_DRAW_FONTWORK
);
1161 rSet
.ClearItem(SID_DRAW_FONTWORK_VERTICAL
);
1162 rSet
.DisableItem(SID_DRAW_FONTWORK_VERTICAL
);
1163 rSet
.ClearItem(SID_DRAW_CAPTION_VERTICAL
);
1164 rSet
.DisableItem(SID_DRAW_CAPTION_VERTICAL
);
1165 rSet
.ClearItem(SID_TEXT_FITTOSIZE
);
1166 rSet
.DisableItem(SID_TEXT_FITTOSIZE
);
1167 rSet
.ClearItem(SID_TEXT_FITTOSIZE_VERTICAL
);
1168 rSet
.DisableItem(SID_TEXT_FITTOSIZE_VERTICAL
);
1169 rSet
.ClearItem(SID_TOOL_CONNECTOR
);
1170 rSet
.DisableItem(SID_TOOL_CONNECTOR
);
1171 rSet
.ClearItem(SID_CONNECTOR_ARROW_START
);
1172 rSet
.DisableItem(SID_CONNECTOR_ARROW_START
);
1173 rSet
.ClearItem(SID_CONNECTOR_ARROW_END
);
1174 rSet
.DisableItem(SID_CONNECTOR_ARROW_END
);
1175 rSet
.ClearItem(SID_CONNECTOR_ARROWS
);
1176 rSet
.DisableItem(SID_CONNECTOR_ARROWS
);
1177 rSet
.ClearItem(SID_CONNECTOR_CIRCLE_START
);
1178 rSet
.DisableItem(SID_CONNECTOR_CIRCLE_START
);
1179 rSet
.ClearItem(SID_CONNECTOR_CIRCLE_END
);
1180 rSet
.DisableItem(SID_CONNECTOR_CIRCLE_END
);
1181 rSet
.ClearItem(SID_CONNECTOR_CIRCLES
);
1182 rSet
.DisableItem(SID_CONNECTOR_CIRCLES
);
1183 rSet
.ClearItem(SID_CONNECTOR_LINE
);
1184 rSet
.DisableItem(SID_CONNECTOR_LINE
);
1185 rSet
.ClearItem(SID_CONNECTOR_LINE_ARROW_START
);
1186 rSet
.DisableItem(SID_CONNECTOR_LINE_ARROW_START
);
1187 rSet
.ClearItem(SID_CONNECTOR_LINE_ARROW_END
);
1188 rSet
.DisableItem(SID_CONNECTOR_LINE_ARROW_END
);
1189 rSet
.ClearItem(SID_CONNECTOR_LINE_ARROWS
);
1190 rSet
.DisableItem(SID_CONNECTOR_LINE_ARROWS
);
1191 rSet
.ClearItem(SID_CONNECTOR_LINE_CIRCLE_START
);
1192 rSet
.DisableItem(SID_CONNECTOR_LINE_CIRCLE_START
);
1193 rSet
.ClearItem(SID_CONNECTOR_LINE_CIRCLE_END
);
1194 rSet
.DisableItem(SID_CONNECTOR_LINE_CIRCLE_END
);
1195 rSet
.ClearItem(SID_CONNECTOR_LINE_CIRCLES
);
1196 rSet
.DisableItem(SID_CONNECTOR_LINE_CIRCLES
);
1197 rSet
.ClearItem(SID_CONNECTOR_CURVE
);
1198 rSet
.DisableItem(SID_CONNECTOR_CURVE
);
1199 rSet
.ClearItem(SID_CONNECTOR_CURVE_ARROW_START
);
1200 rSet
.DisableItem(SID_CONNECTOR_CURVE_ARROW_START
);
1201 rSet
.ClearItem(SID_CONNECTOR_CURVE_ARROW_END
);
1202 rSet
.DisableItem(SID_CONNECTOR_CURVE_ARROW_END
);
1203 rSet
.ClearItem(SID_CONNECTOR_CURVE_ARROWS
);
1204 rSet
.DisableItem(SID_CONNECTOR_CURVE_ARROWS
);
1205 rSet
.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_START
);
1206 rSet
.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_START
);
1207 rSet
.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_END
);
1208 rSet
.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_END
);
1209 rSet
.ClearItem(SID_CONNECTOR_CURVE_CIRCLES
);
1210 rSet
.DisableItem(SID_CONNECTOR_CURVE_CIRCLES
);
1211 rSet
.ClearItem(SID_CONNECTOR_LINES
);
1212 rSet
.DisableItem(SID_CONNECTOR_LINES
);
1213 rSet
.ClearItem(SID_CONNECTOR_LINES_ARROW_START
);
1214 rSet
.DisableItem(SID_CONNECTOR_LINES_ARROW_START
);
1215 rSet
.ClearItem(SID_CONNECTOR_LINES_ARROW_END
);
1216 rSet
.DisableItem(SID_CONNECTOR_LINES_ARROW_END
);
1217 rSet
.ClearItem(SID_CONNECTOR_LINES_ARROWS
);
1218 rSet
.DisableItem(SID_CONNECTOR_LINES_ARROWS
);
1219 rSet
.ClearItem(SID_CONNECTOR_LINES_CIRCLE_START
);
1220 rSet
.DisableItem(SID_CONNECTOR_LINES_CIRCLE_START
);
1221 rSet
.ClearItem(SID_CONNECTOR_LINES_CIRCLE_END
);
1222 rSet
.DisableItem(SID_CONNECTOR_LINES_CIRCLE_END
);
1223 rSet
.ClearItem(SID_CONNECTOR_LINES_CIRCLES
);
1224 rSet
.DisableItem(SID_CONNECTOR_LINES_CIRCLES
);
1225 rSet
.ClearItem(SID_DRAW_ARC
);
1226 rSet
.DisableItem(SID_DRAW_ARC
);
1227 rSet
.ClearItem(SID_DRAW_CIRCLEARC
);
1228 rSet
.DisableItem(SID_DRAW_CIRCLEARC
);
1229 rSet
.ClearItem(SID_DRAW_PIE
);
1230 rSet
.DisableItem(SID_DRAW_PIE
);
1231 rSet
.ClearItem(SID_DRAW_PIE_NOFILL
);
1232 rSet
.DisableItem(SID_DRAW_PIE_NOFILL
);
1233 rSet
.ClearItem(SID_DRAW_CIRCLEPIE
);
1234 rSet
.DisableItem(SID_DRAW_CIRCLEPIE
);
1235 rSet
.ClearItem(SID_DRAW_CIRCLEPIE_NOFILL
);
1236 rSet
.DisableItem(SID_DRAW_CIRCLEPIE_NOFILL
);
1237 rSet
.ClearItem(SID_DRAW_ELLIPSECUT
);
1238 rSet
.DisableItem(SID_DRAW_ELLIPSECUT
);
1239 rSet
.ClearItem(SID_DRAW_ELLIPSECUT_NOFILL
);
1240 rSet
.DisableItem(SID_DRAW_ELLIPSECUT_NOFILL
);
1241 rSet
.ClearItem(SID_DRAW_CIRCLECUT
);
1242 rSet
.DisableItem(SID_DRAW_CIRCLECUT
);
1243 rSet
.ClearItem(SID_DRAW_CIRCLECUT_NOFILL
);
1244 rSet
.DisableItem(SID_DRAW_CIRCLECUT_NOFILL
);
1245 rSet
.ClearItem(SID_DRAW_POLYGON
);
1246 rSet
.DisableItem(SID_DRAW_POLYGON
);
1247 rSet
.ClearItem(SID_DRAW_POLYGON_NOFILL
);
1248 rSet
.DisableItem(SID_DRAW_POLYGON_NOFILL
);
1249 rSet
.ClearItem(SID_DRAW_FREELINE
);
1250 rSet
.DisableItem(SID_DRAW_FREELINE
);
1251 rSet
.ClearItem(SID_DRAW_FREELINE_NOFILL
);
1252 rSet
.DisableItem(SID_DRAW_FREELINE_NOFILL
);
1253 rSet
.ClearItem(SID_DRAW_XPOLYGON
);
1254 rSet
.DisableItem(SID_DRAW_XPOLYGON
);
1255 rSet
.ClearItem(SID_DRAW_XPOLYGON_NOFILL
);
1256 rSet
.DisableItem(SID_DRAW_XPOLYGON_NOFILL
);
1257 rSet
.ClearItem(SID_DRAW_BEZIER_FILL
);
1258 rSet
.DisableItem(SID_DRAW_BEZIER_FILL
);
1259 rSet
.ClearItem(SID_DRAW_BEZIER_NOFILL
);
1260 rSet
.DisableItem(SID_DRAW_BEZIER_NOFILL
);
1261 rSet
.ClearItem(SID_3D_CUBE
);
1262 rSet
.DisableItem(SID_3D_CUBE
);
1263 rSet
.ClearItem(SID_3D_SHELL
);
1264 rSet
.DisableItem(SID_3D_SHELL
);
1265 rSet
.ClearItem(SID_3D_SPHERE
);
1266 rSet
.DisableItem(SID_3D_SPHERE
);
1267 rSet
.ClearItem(SID_3D_HALF_SPHERE
);
1268 rSet
.DisableItem(SID_3D_HALF_SPHERE
);
1269 rSet
.ClearItem(SID_3D_CYLINDER
);
1270 rSet
.DisableItem(SID_3D_CYLINDER
);
1271 rSet
.ClearItem(SID_3D_CONE
);
1272 rSet
.DisableItem(SID_3D_CONE
);
1273 rSet
.ClearItem(SID_3D_TORUS
);
1274 rSet
.DisableItem(SID_3D_TORUS
);
1275 rSet
.ClearItem(SID_3D_PYRAMID
);
1276 rSet
.DisableItem(SID_3D_PYRAMID
);
1279 if ( !aActiveLayer
.isEmpty() && pPV
)
1280 rSet
.Put( SfxBoolItem(SID_TOGGLELAYERVISIBILITY
, pPageView
->IsLayerVisible(aActiveLayer
)) );
1282 // are the modules available?
1284 if (!SvtModuleOptions().IsCalc())
1286 // remove menu entry if module is not available
1287 rSet
.Put( SfxVisibilityItem( SID_ATTR_TABLE
, false ) );
1289 if (!SvtModuleOptions().IsChart())
1291 rSet
.DisableItem( SID_INSERT_DIAGRAM
);
1293 if (!SvtModuleOptions().IsMath())
1295 rSet
.DisableItem( SID_INSERT_MATH
);
1298 rtl::Reference
< sd::SlideShow
> xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
1299 if( (xSlideshow
.is() && xSlideshow
->isRunning() && (xSlideshow
->getAnimationMode() != ANIMATIONMODE_PREVIEW
) ) || GetDocSh()->IsPreview() )
1302 rSet
.DisableItem( SID_PRESENTATION
);
1303 rSet
.DisableItem( SID_ZOOM_IN
);
1304 rSet
.DisableItem( SID_ZOOM_OUT
);
1305 rSet
.DisableItem( SID_ZOOM_PANNING
);
1306 rSet
.DisableItem( SID_ZOOM_MODE
);
1307 rSet
.DisableItem( SID_ZOOM_NEXT
);
1308 rSet
.DisableItem( SID_ZOOM_PREV
);
1309 rSet
.DisableItem( SID_SIZE_REAL
);
1310 rSet
.DisableItem( SID_SIZE_OPTIMAL
);
1311 rSet
.DisableItem( SID_SIZE_ALL
);
1312 rSet
.DisableItem( SID_SIZE_PAGE_WIDTH
);
1313 rSet
.DisableItem( SID_SIZE_PAGE
);
1314 rSet
.DisableItem( SID_INSERTPAGE
);
1315 rSet
.DisableItem( SID_DUPLICATE_PAGE
);
1316 rSet
.DisableItem( SID_MODIFYPAGE
);
1317 rSet
.DisableItem( SID_RENAMEPAGE
);
1318 rSet
.DisableItem( SID_RENAMEPAGE_QUICK
);
1319 rSet
.DisableItem( SID_DELETE_PAGE
);
1320 rSet
.DisableItem( SID_PAGESETUP
);
1322 if( xSlideshow
.is() && xSlideshow
->isRunning() )
1324 rSet
.ClearItem(SID_INSERTFILE
);
1325 rSet
.ClearItem(SID_OBJECT_ROTATE
);
1326 rSet
.ClearItem(SID_FM_CONFIG
);
1327 rSet
.ClearItem(SID_ANIMATION_EFFECTS
);
1328 rSet
.ClearItem(SID_EXECUTE_ANIMATION_EFFECT
);
1329 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
1330 rSet
.ClearItem(SID_3D_WIN
);
1332 rSet
.DisableItem(SID_OBJECT_ALIGN
);
1333 rSet
.DisableItem(SID_ZOOM_TOOLBOX
);
1334 rSet
.DisableItem(SID_OBJECT_CHOOSE_MODE
);
1335 rSet
.DisableItem(SID_DRAWTBX_TEXT
);
1336 rSet
.DisableItem(SID_DRAWTBX_RECTANGLES
);
1337 rSet
.DisableItem(SID_DRAWTBX_ELLIPSES
);
1338 rSet
.DisableItem(SID_DRAWTBX_LINES
);
1339 rSet
.DisableItem(SID_DRAWTBX_ARROWS
);
1340 rSet
.DisableItem(SID_DRAWTBX_3D_OBJECTS
);
1341 rSet
.DisableItem(SID_DRAWTBX_CONNECTORS
);
1342 rSet
.DisableItem(SID_OBJECT_CHOOSE_MODE
);
1343 rSet
.DisableItem(SID_DRAWTBX_INSERT
);
1344 rSet
.DisableItem(SID_INSERTFILE
);
1345 rSet
.DisableItem(SID_OBJECT_ROTATE
);
1346 rSet
.DisableItem(SID_POSITION
);
1347 rSet
.DisableItem(SID_FM_CONFIG
);
1348 rSet
.DisableItem(SID_ANIMATION_EFFECTS
);
1349 rSet
.DisableItem(SID_EXECUTE_ANIMATION_EFFECT
);
1350 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
1351 rSet
.DisableItem(SID_3D_WIN
);
1355 // Menuoption: Change->Convert->To Bitmap, Change->Convert->To Metafile
1356 // disable, if there only Bitmap or Metafiles marked
1357 // Menuoption: Format->Area, Format->Line
1358 // disabled, if the marked objects not able to handle
1361 bool bSingleGraphicSelected
= false;
1363 if (!mpDrawView
->AreObjectsMarked())
1365 rSet
.DisableItem (SID_CONVERT_TO_METAFILE
);
1366 rSet
.DisableItem (SID_CONVERT_TO_BITMAP
);
1371 SdrMarkList aMarkList
= mpDrawView
->GetMarkedObjectList();
1373 bool bFoundBitmap
= false;
1374 bool bFoundMetafile
= false;
1375 bool bFoundObjNoArea
= false;
1376 bool bFoundNoGraphicObj
= false;
1377 bool bFoundAny
= false;
1378 bool bFoundTable
= false;
1380 // const size_t nMarkCount = aMarkList.GetMarkCount();
1381 for (size_t i
=0; i
< nMarkCount
&& !bFoundAny
; ++i
)
1383 SdrObject
* pObj
= aMarkList
.GetMark(i
)->GetMarkedSdrObj();
1384 SdrObjKind nId
= pObj
->GetObjIdentifier();
1385 SdrInventor nInv
= pObj
->GetObjInventor();
1387 if(nInv
== SdrInventor::Default
)
1392 case SdrObjKind::PathLine
:
1393 case SdrObjKind::PolyLine
:
1394 case SdrObjKind::Line
:
1395 case SdrObjKind::FreehandLine
:
1396 case SdrObjKind::Edge
:
1397 case SdrObjKind::CircleArc
:
1398 bFoundObjNoArea
= true;
1399 bFoundNoGraphicObj
= true;
1401 case SdrObjKind::OLE2
:
1402 // #i118485# #i118525# Allow Line, Area and Graphic (Metafile, Bitmap)
1403 bSingleGraphicSelected
= nMarkCount
== 1;
1404 bFoundBitmap
= true;
1405 bFoundMetafile
= true;
1407 case SdrObjKind::Graphic
:
1409 bSingleGraphicSelected
= nMarkCount
== 1;
1410 const SdrGrafObj
* pSdrGrafObj
= static_cast< const SdrGrafObj
* >(pObj
);
1412 // Current size of the OBJ_GRAF
1413 const ::tools::Rectangle aRect
= pObj
->GetLogicRect();
1414 const Size aCurrentSizeofObj
= aRect
.GetSize();
1416 // Original size of the OBJ_GRAF
1417 const Size aOriginalSizeofObj
= pSdrGrafObj
->getOriginalSize();
1419 if(aCurrentSizeofObj
== aOriginalSizeofObj
)
1420 rSet
.DisableItem(SID_ORIGINAL_SIZE
);
1422 switch(pSdrGrafObj
->GetGraphicType())
1424 case GraphicType::Bitmap
:
1425 bFoundBitmap
= true;
1426 if(pSdrGrafObj
->isEmbeddedVectorGraphicData())
1428 bFoundMetafile
= true;
1431 case GraphicType::GdiMetafile
:
1432 bFoundMetafile
= true;
1439 case SdrObjKind::Table
:
1446 else if(nInv
== SdrInventor::E3d
)
1454 rSet
.DisableItem( SID_ATTRIBUTES_LINE
);
1458 // Disable menuitem for area-dialog
1459 if( bFoundObjNoArea
) // #i25616#
1460 rSet
.DisableItem( SID_ATTRIBUTES_AREA
);
1462 if( bFoundBitmap
&& !bFoundMetafile
&& !bFoundNoGraphicObj
) // only Bitmaps marked
1463 rSet
.DisableItem( SID_CONVERT_TO_BITMAP
);
1464 else if( !bFoundBitmap
&& bFoundMetafile
&& !bFoundNoGraphicObj
) // only Metafiles marked
1465 rSet
.DisableItem( SID_CONVERT_TO_METAFILE
);
1466 else if( !bFoundBitmap
&& !bFoundMetafile
&& !bFoundNoGraphicObj
) // nothing to do
1468 rSet
.DisableItem( SID_CONVERT_TO_BITMAP
);
1469 rSet
.DisableItem( SID_CONVERT_TO_METAFILE
);
1474 if( !bSingleGraphicSelected
)
1476 rSet
.DisableItem (SID_OBJECT_CROP
);
1477 rSet
.DisableItem (SID_ATTR_GRAF_CROP
);
1480 // Menuoption: Edit->Hyperlink
1481 // Disable, if there is no hyperlink
1482 bool bDisableEditHyperlink
;
1483 if (!moAtContextMenu_DisableEditHyperlink
)
1484 bDisableEditHyperlink
= ShouldDisableEditHyperlink();
1487 // tdf#137445 if a popup menu was active, use the state as of when the popup was launched and then drop
1488 // moAtContextMenu_DisableEditHyperlink
1489 bDisableEditHyperlink
= *moAtContextMenu_DisableEditHyperlink
;
1490 moAtContextMenu_DisableEditHyperlink
.reset();
1493 //highlight selected custom shape
1495 if(HasCurrentFunction())
1497 rtl::Reference
< FuPoor
> xFunc( GetCurrentFunction() );
1498 FuConstructCustomShape
* pShapeFunc
= dynamic_cast< FuConstructCustomShape
* >( xFunc
.get() );
1500 static const sal_uInt16 nCSTbArray
[] = { SID_DRAWTBX_CS_BASIC
, SID_DRAWTBX_CS_SYMBOL
,
1501 SID_DRAWTBX_CS_ARROW
, SID_DRAWTBX_CS_FLOWCHART
,
1502 SID_DRAWTBX_CS_CALLOUT
, SID_DRAWTBX_CS_STAR
};
1504 const sal_uInt16 nCurrentSId
= GetCurrentFunction()->GetSlotID();
1505 for (sal_uInt16 i
: nCSTbArray
)
1507 rSet
.ClearItem( i
); // Why is this necessary?
1508 rSet
.Put( SfxStringItem( i
, nCurrentSId
== i
&& pShapeFunc
1509 ? pShapeFunc
->GetShapeType() : OUString() ) );
1514 if ( bDisableEditHyperlink
|| GetDocSh()->IsReadOnly() )
1515 rSet
.DisableItem( SID_EDIT_HYPERLINK
);
1517 if ( bDisableEditHyperlink
)
1519 rSet
.DisableItem( SID_OPEN_HYPERLINK
);
1520 rSet
.DisableItem( SID_COPY_HYPERLINK_LOCATION
);
1523 //fdo#78151 enable show next level/hide last level if editing a master page
1524 //PresObjKind::Outline object and the current selection allow that to happen
1526 bool bDisableShowNextLevel
= true;
1527 bool bDisableHideLastLevel
= true;
1530 ::Outliner
* pOL
= GetOutlinerForMasterPageOutlineTextObj(aSel
);
1533 //and are on the last paragraph
1535 if (aSel
.nEndPara
== pOL
->GetParagraphCount() - 1)
1537 sal_uInt16 nDepth
= pOL
->GetDepth(aSel
.nEndPara
);
1538 if (nDepth
!= sal_uInt16(-1))
1540 //there exists another numbering level that
1541 //is currently hidden
1543 bDisableShowNextLevel
= false;
1544 //there exists a previous numbering level
1546 bDisableHideLastLevel
= false;
1551 if (bDisableShowNextLevel
)
1552 rSet
.DisableItem(SID_SHOW_NEXT_LEVEL
);
1554 if (bDisableHideLastLevel
)
1555 rSet
.DisableItem(SID_HIDE_LAST_LEVEL
);
1558 #if defined(_WIN32) || defined UNX
1559 if( !mxScannerManager
.is() )
1561 rSet
.DisableItem( SID_TWAIN_SELECT
);
1562 rSet
.DisableItem( SID_TWAIN_TRANSFER
);
1566 // Set the state of two entries in the 'Slide' context sub-menu
1567 // concerning the visibility of master page background and master page
1569 if (rSet
.GetItemState(SID_DISPLAY_MASTER_BACKGROUND
) == SfxItemState::DEFAULT
1570 || rSet
.GetItemState(SID_DISPLAY_MASTER_OBJECTS
) == SfxItemState::DEFAULT
)
1572 SdPage
* pPage
= GetActualPage();
1573 if (pPage
!= nullptr && GetDoc() != nullptr)
1575 SdrLayerIDSet aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
1576 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
1577 SdrLayerID aBackgroundId
= rLayerAdmin
.GetLayerID(sUNO_LayerName_background
);
1578 SdrLayerID aObjectId
= rLayerAdmin
.GetLayerID(sUNO_LayerName_background_objects
);
1579 rSet
.Put(SfxBoolItem(SID_DISPLAY_MASTER_BACKGROUND
,
1580 aVisibleLayers
.IsSet(aBackgroundId
)));
1581 rSet
.Put(SfxBoolItem(SID_DISPLAY_MASTER_OBJECTS
,
1582 aVisibleLayers
.IsSet(aObjectId
)));
1586 if (rSet
.GetItemState(SID_SAVE_BACKGROUND
) == SfxItemState::DEFAULT
)
1588 bool bDisableSaveBackground
= true;
1589 SdPage
* pPage
= GetActualPage();
1590 if (pPage
!= nullptr && GetDoc() != nullptr)
1592 SfxItemSetFixed
<XATTR_FILL_FIRST
, XATTR_FILL_LAST
> aMergedAttr(GetDoc()->GetPool());
1593 SdStyleSheet
* pStyleSheet
= pPage
->getPresentationStyle(HID_PSEUDOSHEET_BACKGROUND
);
1594 MergePageBackgroundFilling(pPage
, pStyleSheet
, meEditMode
== EditMode::MasterPage
, aMergedAttr
);
1595 if (drawing::FillStyle_BITMAP
== aMergedAttr
.Get(XATTR_FILLSTYLE
).GetValue())
1597 bDisableSaveBackground
= false;
1600 if (bDisableSaveBackground
)
1601 rSet
.DisableItem(SID_SAVE_BACKGROUND
);
1604 if (GetObjectShell()->isExportLocked())
1605 rSet
.DisableItem(SID_PRESENTATION_MINIMIZER
);
1607 if (rSet
.GetItemState(SID_INSERT_SIGNATURELINE
) == SfxItemState::DEFAULT
)
1609 if (!GetObjectShell()->IsSignPDF())
1611 // Currently SID_INSERT_SIGNATURELINE assumes a PDF that was opened for signing, disable
1613 rSet
.DisableItem(SID_INSERT_SIGNATURELINE
);
1617 GetModeSwitchingMenuState (rSet
);
1620 void DrawViewShell::GetModeSwitchingMenuState (SfxItemSet
&rSet
)
1623 rSet
.Put(SfxBoolItem(SID_SLIDE_SORTER_MODE
, false));
1624 rSet
.Put(SfxBoolItem(SID_OUTLINE_MODE
, false));
1625 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTER_MODE
, false));
1626 rSet
.Put(SfxBoolItem(SID_NOTES_MASTER_MODE
, false));
1627 if (mePageKind
== PageKind::Notes
)
1629 rSet
.Put(SfxBoolItem(SID_DRAWINGMODE
, false));
1630 rSet
.Put(SfxBoolItem(SID_NOTES_MODE
, true));
1631 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTER_MODE
, false));
1633 else if (mePageKind
== PageKind::Handout
)
1635 rSet
.Put(SfxBoolItem(SID_DRAWINGMODE
, false));
1636 rSet
.Put(SfxBoolItem(SID_NOTES_MODE
, false));
1637 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTER_MODE
, true));
1641 rSet
.Put(SfxBoolItem(SID_DRAWINGMODE
, true));
1642 rSet
.Put(SfxBoolItem(SID_NOTES_MODE
, false));
1643 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTER_MODE
, false));
1646 // Removed [GetDocSh()->GetCurrentFunction() ||] from the following
1647 // clause because the current function of the docshell can only be
1648 // search and replace or spell checking and in that case switching the
1649 // view mode is allowed.
1650 const bool bIsRunning
= SlideShow::IsRunning(GetViewShellBase());
1652 if (GetViewFrame()->GetFrame().IsInPlace() || bIsRunning
)
1654 if ( !GetViewFrame()->GetFrame().IsInPlace() )
1656 rSet
.ClearItem( SID_DRAWINGMODE
);
1657 rSet
.DisableItem( SID_DRAWINGMODE
);
1660 rSet
.ClearItem( SID_NOTES_MODE
);
1661 rSet
.DisableItem( SID_NOTES_MODE
);
1663 rSet
.ClearItem( SID_HANDOUT_MASTER_MODE
);
1664 rSet
.DisableItem( SID_HANDOUT_MASTER_MODE
);
1666 rSet
.ClearItem( SID_OUTLINE_MODE
);
1667 rSet
.DisableItem( SID_OUTLINE_MODE
);
1669 rSet
.ClearItem( SID_SLIDE_MASTER_MODE
);
1670 rSet
.DisableItem( SID_SLIDE_MASTER_MODE
);
1672 rSet
.ClearItem( SID_NOTES_MASTER_MODE
);
1673 rSet
.DisableItem( SID_NOTES_MASTER_MODE
);
1675 rSet
.ClearItem( SID_SLIDE_SORTER_MODE
);
1676 rSet
.DisableItem( SID_SLIDE_SORTER_MODE
);
1679 if (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED
)
1681 // Outplace-Edit: do not allow switch
1682 rSet
.ClearItem( SID_OUTLINE_MODE
);
1683 rSet
.DisableItem( SID_OUTLINE_MODE
);
1685 rSet
.ClearItem( SID_SLIDE_SORTER_MODE
);
1686 rSet
.DisableItem( SID_SLIDE_SORTER_MODE
);
1688 rSet
.ClearItem( SID_NOTES_MODE
);
1689 rSet
.DisableItem( SID_NOTES_MODE
);
1691 rSet
.ClearItem( SID_HANDOUT_MASTER_MODE
);
1692 rSet
.DisableItem( SID_HANDOUT_MASTER_MODE
);
1694 rSet
.ClearItem( SID_SLIDE_MASTER_MODE
);
1695 rSet
.DisableItem( SID_SLIDE_MASTER_MODE
);
1697 rSet
.ClearItem( SID_NOTES_MASTER_MODE
);
1698 rSet
.DisableItem( SID_NOTES_MASTER_MODE
);
1701 svx::ExtrusionBar::getState( mpDrawView
.get(), rSet
);
1702 svx::FontworkBar::getState( mpDrawView
.get(), rSet
);
1705 void DrawViewShell::GetPageProperties( SfxItemSet
&rSet
)
1707 SdPage
*pPage
= getCurrentPage();
1709 if (pPage
== nullptr || GetDoc() == nullptr)
1712 SvxPageItem
aPageItem(SID_ATTR_PAGE
);
1713 aPageItem
.SetLandscape( pPage
->GetOrientation() == Orientation::Landscape
);
1715 rSet
.Put(SvxSizeItem( SID_ATTR_PAGE_SIZE
, pPage
->GetSize() ));
1716 rSet
.Put(aPageItem
);
1718 const SfxItemSet
&rPageAttr
= pPage
->getSdrPageProperties().GetItemSet();
1719 const XFillStyleItem
* pFillStyle
= rPageAttr
.GetItem(XATTR_FILLSTYLE
);
1723 drawing::FillStyle eXFS
= pFillStyle
->GetValue();
1724 XFillStyleItem
aFillStyleItem( eXFS
);
1725 aFillStyleItem
.SetWhich( SID_ATTR_PAGE_FILLSTYLE
);
1726 rSet
.Put(aFillStyleItem
);
1730 case drawing::FillStyle_SOLID
:
1731 if (const XFillColorItem
* pColorItem
= rPageAttr
.GetItem(XATTR_FILLCOLOR
))
1733 Color aColor
= pColorItem
->GetColorValue();
1734 XFillColorItem
aFillColorItem( OUString(), aColor
);
1735 aFillColorItem
.SetWhich( SID_ATTR_PAGE_COLOR
);
1736 rSet
.Put( aFillColorItem
);
1740 case drawing::FillStyle_GRADIENT
:
1742 const XFillGradientItem
*pGradient
= rPageAttr
.GetItem( XATTR_FILLGRADIENT
);
1743 XFillGradientItem
aFillGradientItem( pGradient
->GetName(), pGradient
->GetGradientValue(), SID_ATTR_PAGE_GRADIENT
);
1744 rSet
.Put( aFillGradientItem
);
1748 case drawing::FillStyle_HATCH
:
1750 const XFillHatchItem
*pFillHatchItem( rPageAttr
.GetItem( XATTR_FILLHATCH
) );
1751 XFillHatchItem
aFillHatchItem( pFillHatchItem
->GetName(), pFillHatchItem
->GetHatchValue());
1752 aFillHatchItem
.SetWhich( SID_ATTR_PAGE_HATCH
);
1753 rSet
.Put( aFillHatchItem
);
1757 case drawing::FillStyle_BITMAP
:
1759 const XFillBitmapItem
*pFillBitmapItem
= rPageAttr
.GetItem( XATTR_FILLBITMAP
);
1760 XFillBitmapItem
aFillBitmapItem( pFillBitmapItem
->GetName(), pFillBitmapItem
->GetGraphicObject() );
1761 aFillBitmapItem
.SetWhich( SID_ATTR_PAGE_BITMAP
);
1762 rSet
.Put( aFillBitmapItem
);
1771 void DrawViewShell::SetPageProperties (SfxRequest
& rReq
)
1773 SdPage
*pPage
= getCurrentPage();
1776 sal_uInt16 nSlotId
= rReq
.GetSlot();
1777 const SfxItemSet
*pArgs
= rReq
.GetArgs();
1781 if ( ( nSlotId
>= SID_ATTR_PAGE_COLOR
) && ( nSlotId
<= SID_ATTR_PAGE_FILLSTYLE
) )
1783 SdrPageProperties
& rPageProperties
= pPage
->getSdrPageProperties();
1784 const SfxItemSet
&aPageItemSet
= rPageProperties
.GetItemSet();
1785 SfxItemSet aTempSet
= aPageItemSet
.CloneAsValue(false, &mpDrawView
->GetModel().GetItemPool());
1786 const SfxPoolItem
* pItem
= nullptr;
1788 rPageProperties
.ClearItem(XATTR_FILLSTYLE
);
1789 rPageProperties
.ClearItem(XATTR_FILLGRADIENT
);
1790 rPageProperties
.ClearItem(XATTR_FILLHATCH
);
1791 rPageProperties
.ClearItem(XATTR_FILLBITMAP
);
1795 case SID_ATTR_PAGE_FILLSTYLE
:
1797 XFillStyleItem
aFSItem( pArgs
->Get( XATTR_FILLSTYLE
) );
1798 drawing::FillStyle eXFS
= aFSItem
.GetValue();
1800 if ( eXFS
== drawing::FillStyle_NONE
)
1801 rPageProperties
.PutItem( XFillStyleItem( eXFS
) );
1805 case SID_ATTR_PAGE_COLOR
:
1807 rPageProperties
.PutItem( XFillStyleItem( drawing::FillStyle_SOLID
) );
1808 if (const XFillColorItem
* pColorItem
= static_cast<const XFillColorItem
*>(pArgs
->GetItem(SID_ATTR_PAGE_COLOR
)))
1809 rPageProperties
.PutItem(XFillColorItem("", pColorItem
->GetColorValue()));
1811 rPageProperties
.PutItem(pArgs
->Get(XATTR_FILLCOLOR
));
1815 case SID_ATTR_PAGE_GRADIENT
:
1817 if (SfxItemState::SET
== pArgs
->GetItemState(SID_FILL_GRADIENT_JSON
, false, &pItem
))
1819 const SfxStringItem
* pJSON
= static_cast<const SfxStringItem
*>(pItem
);
1820 XFillGradientItem
aGradientItem( basegfx::BGradient::fromJSON(pJSON
->GetValue()) );
1822 // MigrateItemSet guarantees unique gradient names
1823 SfxItemSetFixed
<XATTR_FILLGRADIENT
, XATTR_FILLGRADIENT
> aMigrateSet(mpDrawView
->GetModel().GetItemPool());
1824 aMigrateSet
.Put( aGradientItem
);
1825 SdrModel::MigrateItemSet(&aMigrateSet
, &aTempSet
, &mpDrawView
->GetModel());
1827 rPageProperties
.PutItem( XFillStyleItem( drawing::FillStyle_GRADIENT
) );
1828 rPageProperties
.PutItemSet( aTempSet
);
1832 XFillGradientItem
aGradientItem( pArgs
->Get( XATTR_FILLGRADIENT
) );
1834 // MigrateItemSet guarantees unique gradient names
1835 SfxItemSetFixed
<XATTR_FILLGRADIENT
, XATTR_FILLGRADIENT
> aMigrateSet(mpDrawView
->GetModel().GetItemPool());
1836 aMigrateSet
.Put( aGradientItem
);
1837 SdrModel::MigrateItemSet(&aMigrateSet
, &aTempSet
, &mpDrawView
->GetModel());
1839 rPageProperties
.PutItem( XFillStyleItem( drawing::FillStyle_GRADIENT
) );
1840 rPageProperties
.PutItemSet( aTempSet
);
1845 case SID_ATTR_PAGE_HATCH
:
1847 XFillHatchItem
aHatchItem( pArgs
->Get( XATTR_FILLHATCH
) );
1848 rPageProperties
.PutItem( XFillStyleItem( drawing::FillStyle_HATCH
) );
1849 rPageProperties
.PutItem( aHatchItem
);
1853 case SID_ATTR_PAGE_BITMAP
:
1855 XFillBitmapItem
aBitmapItem( pArgs
->Get( XATTR_FILLBITMAP
) );
1856 rPageProperties
.PutItem( XFillStyleItem( drawing::FillStyle_BITMAP
) );
1857 rPageProperties
.PutItem( aBitmapItem
);
1869 PageKind ePageKind
= GetPageKind();
1870 const SfxPoolItem
* pPoolItem
= nullptr;
1871 Size
aNewSize(pPage
->GetSize());
1872 sal_Int32 nLeft
= -1, nRight
= -1, nUpper
= -1, nLower
= -1;
1873 bool bScaleAll
= true;
1874 Orientation eOrientation
= pPage
->GetOrientation();
1875 SdPage
* pMasterPage
= pPage
->IsMasterPage() ? pPage
: &static_cast<SdPage
&>(pPage
->TRG_GetMasterPage());
1876 bool bFullSize
= pMasterPage
->IsBackgroundFullSize();
1877 sal_uInt16 nPaperBin
= pPage
->GetPaperBin();
1881 case SID_ATTR_PAGE_LRSPACE
:
1882 if( pArgs
->GetItemState(SID_ATTR_PAGE_LRSPACE
,
1883 true,&pPoolItem
) == SfxItemState::SET
)
1885 nLeft
= static_cast<const SvxLongLRSpaceItem
*>(pPoolItem
)->GetLeft();
1886 nRight
= static_cast<const SvxLongLRSpaceItem
*>(pPoolItem
)->GetRight();
1889 nUpper
= pPage
->GetUpperBorder();
1890 nLower
= pPage
->GetLowerBorder();
1892 SetPageSizeAndBorder(ePageKind
, aNewSize
, nLeft
, nRight
, nUpper
, nLower
, bScaleAll
, eOrientation
, nPaperBin
, bFullSize
);
1896 case SID_ATTR_PAGE_ULSPACE
:
1897 if( pArgs
->GetItemState(SID_ATTR_PAGE_ULSPACE
,
1898 true,&pPoolItem
) == SfxItemState::SET
)
1900 nUpper
= static_cast<const SvxLongULSpaceItem
*>(pPoolItem
)->GetUpper();
1901 nLower
= static_cast<const SvxLongULSpaceItem
*>(pPoolItem
)->GetLower();
1904 nLeft
= pPage
->GetLeftBorder();
1905 nRight
= pPage
->GetRightBorder();
1907 SetPageSizeAndBorder(ePageKind
, aNewSize
, nLeft
, nRight
, nUpper
, nLower
, bScaleAll
, eOrientation
, nPaperBin
, bFullSize
);
1917 void DrawViewShell::GetState (SfxItemSet
& rSet
)
1919 // Iterate over all requested items in the set.
1920 SfxWhichIter
aIter( rSet
);
1921 sal_uInt16 nWhich
= aIter
.FirstWhich();
1926 case SID_SEARCH_ITEM
:
1927 case SID_SEARCH_OPTIONS
:
1928 // Forward this request to the common (old) code of the
1930 GetDocSh()->GetState (rSet
);
1933 SAL_WARN("sd", "DrawViewShell::GetState(): can not handle which id " << nWhich
);
1936 nWhich
= aIter
.NextWhich();
1940 void DrawViewShell::Execute (SfxRequest
& rReq
)
1942 if(SlideShow::IsRunning(GetViewShellBase()))
1944 // Do not execute anything during a native slide show.
1948 switch (rReq
.GetSlot())
1950 case SID_SEARCH_ITEM
:
1951 // Forward this request to the common (old) code of the
1953 GetDocSh()->Execute (rReq
);
1956 case SID_SPELL_DIALOG
:
1958 SfxViewFrame
* pViewFrame
= GetViewFrame();
1959 if (rReq
.GetArgs() != nullptr)
1960 pViewFrame
->SetChildWindow (SID_SPELL_DIALOG
,
1961 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
1962 Get(SID_SPELL_DIALOG
)).GetValue());
1964 pViewFrame
->ToggleChildWindow(SID_SPELL_DIALOG
);
1966 pViewFrame
->GetBindings().Invalidate(SID_SPELL_DIALOG
);
1972 SAL_WARN("sd", "DrawViewShell::Execute(): can not handle slot " << rReq
.GetSlot());
1977 } // end of namespace sd
1979 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */