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 <officecfg/Office/Security.hxx>
37 #include <svx/svxids.hrc>
38 #include <svx/svdpagv.hxx>
39 #include <svx/clipfmtitem.hxx>
40 #include <svl/eitem.hxx>
41 #include <svl/intitem.hxx>
42 #include <svl/itemset.hxx>
43 #include <svl/stritem.hxx>
44 #include <svl/visitem.hxx>
45 #include <svl/whiter.hxx>
46 #include <svx/svdograf.hxx>
47 #include <svx/xfillit0.hxx>
48 #include <svx/xflclit.hxx>
49 #include <svx/xflgrit.hxx>
50 #include <svx/xflhtit.hxx>
51 #include <svx/xbtmpit.hxx>
52 #include <editeng/unolingu.hxx>
53 #include <svx/extrusionbar.hxx>
54 #include <svx/fontworkbar.hxx>
57 #include <svtools/insdlg.hxx>
58 #include <unotools/moduleoptions.hxx>
59 #include <svl/cjkoptions.hxx>
60 #include <comphelper/processfactory.hxx>
61 #include <sfx2/request.hxx>
63 #include <svtools/cliplistener.hxx>
64 #include <sfx2/bindings.hxx>
65 #include <sfx2/viewfrm.hxx>
69 #include <PresentationViewShell.hxx>
71 #include <drawdoc.hxx>
72 #include <DrawViewShell.hxx>
74 #include <unokywds.hxx>
76 #include <DrawDocShell.hxx>
77 #include <zoomlist.hxx>
78 #include <slideshow.hxx>
79 #include <drawview.hxx>
80 #include <ViewShellBase.hxx>
81 #include <ViewShellManager.hxx>
82 #include <LayerTabBar.hxx>
85 #include <fuediglu.hxx>
86 #include <fubullet.hxx>
87 #include <fuconcs.hxx>
88 #include <fuformatpaintbrush.hxx>
89 #include <stlsheet.hxx>
91 using namespace ::com::sun::star
;
92 using namespace ::com::sun::star::uno
;
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::HTML_SIMPLE
:
156 case SotClipboardFormatId::RTF
:
157 case SotClipboardFormatId::RICHTEXT
:
158 case SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT
:
159 pResult
->AddClipbrdFormat(nTestFormat
);
166 // Check some OLE formats whose names are handled differently.
167 SotClipboardFormatId
nFormat (SotClipboardFormatId::EMBED_SOURCE_OLE
);
168 bool bHasFormat (rDataHelper
.HasFormat(nFormat
));
171 bHasFormat
= rDataHelper
.HasFormat(nFormat
);
177 if (SvPasteObjectHelper::GetEmbeddedName (rDataHelper
, sName
, sSource
, nFormat
))
178 pResult
->AddClipbrdFormat (nFormat
, sName
);
186 IMPL_LINK( DrawViewShell
, ClipboardChanged
, TransferableDataHelper
*, pDataHelper
, void )
188 mbPastePossible
= ( pDataHelper
->GetFormatCount() != 0 );
190 // Update the list of supported clipboard formats according to the
191 // new clipboard content.
192 // There are some stack traces that indicate the possibility of the
193 // DrawViewShell destructor called during the call to
194 // GetSupportedClipboardFormats(). If that really has happened then
196 TransferableDataHelper
aDataHelper (
197 TransferableDataHelper::CreateFromSystemClipboard(GetActiveWindow()));
198 ::std::unique_ptr
<SvxClipboardFormatItem
> pFormats (GetSupportedClipboardFormats(aDataHelper
));
199 if (mpDrawView
== nullptr)
201 mpCurrentClipboardFormats
= std::move(pFormats
);
203 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
204 rBindings
.Invalidate( SID_PASTE
);
205 rBindings
.Invalidate( SID_PASTE_SPECIAL
);
206 rBindings
.Invalidate( SID_PASTE_UNFORMATTED
);
207 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 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
223 //when there is one object selected
224 if (rMarkList
.GetMarkCount() == 0 || (rMarkList
.GetMarkCount() != 1))
227 //and we are editing the outline object
228 if (!mpDrawView
->IsTextEdit())
231 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
235 SdPage
* pPage
= static_cast<SdPage
*>(pPageView
->GetPage());
236 //only show these in a normal master page
237 if (!pPage
|| (pPage
->GetPageKind() != PageKind::Standard
) || !pPage
->IsMasterPage())
240 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
241 ::Outliner
* pOL
= pOLV
? pOLV
->GetOutliner() : nullptr;
244 rSel
= pOLV
->GetSelection();
249 void DrawViewShell::GetMarginProperties( SfxItemSet
&rSet
)
251 SdPage
*pPage
= getCurrentPage();
252 SfxWhichIter
aIter( rSet
);
253 sal_uInt16 nWhich
= aIter
.FirstWhich();
258 case SID_ATTR_PAGE_LRSPACE
:
260 // const SvxLRSpaceItem aTmpPageLRSpace ( rDesc.GetMaster().GetLRSpace() );
261 const SvxLongLRSpaceItem
aLongLR(
262 static_cast<::tools::Long
>(pPage
->GetLeftBorder()),
263 static_cast<::tools::Long
>(pPage
->GetRightBorder()),
264 SID_ATTR_PAGE_LRSPACE
);
269 case SID_ATTR_PAGE_ULSPACE
:
271 // const SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
272 SvxLongULSpaceItem
aLongUL(
273 static_cast<::tools::Long
>(pPage
->GetUpperBorder()),
274 static_cast<::tools::Long
>(pPage
->GetLowerBorder()),
275 SID_ATTR_PAGE_ULSPACE
);
283 nWhich
= aIter
.NextWhich();
287 bool DrawViewShell::ShouldDisableEditHyperlink() const
291 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
292 if (rMarkList
.GetMarkCount() == 0)
294 if (rMarkList
.GetMarkCount() != 1)
297 bool bDisableEditHyperlink
= true;
298 if( mpDrawView
->IsTextEdit() )
300 if (URLFieldHelper::IsCursorAtURLField(mpDrawView
->GetTextEditOutlinerView(),
301 /*AlsoCheckBeforeCursor=*/true))
302 bDisableEditHyperlink
= false;
306 SdrUnoObj
* pUnoCtrl
= dynamic_cast<SdrUnoObj
*>( rMarkList
.GetMark(0)->GetMarkedSdrObj() );
308 if ( pUnoCtrl
&& SdrInventor::FmForm
== pUnoCtrl
->GetObjInventor() )
310 const uno::Reference
< awt::XControlModel
>& xControlModel( pUnoCtrl
->GetUnoControlModel() );
311 if( xControlModel
.is() )
313 uno::Reference
< beans::XPropertySet
> xPropSet( xControlModel
, uno::UNO_QUERY
);
316 uno::Reference
< beans::XPropertySetInfo
> xPropInfo( xPropSet
->getPropertySetInfo() );
317 if( xPropInfo
.is() && xPropInfo
->hasPropertyByName( u
"TargetURL"_ustr
) )
319 bDisableEditHyperlink
= false;
325 return bDisableEditHyperlink
;
328 void DrawViewShell::GetMenuState( SfxItemSet
&rSet
)
330 if (mpDrawView
== nullptr)
332 // This assertion and return are here to prevent crashes.
333 DBG_ASSERT(mpDrawView
!=nullptr, "Please report this assertion to the Impress team.");
337 ViewShell::GetMenuState(rSet
);
338 bool bDisableVerticalText
= !SvtCJKOptions::IsVerticalTextEnabled();
340 if ( bDisableVerticalText
)
342 rSet
.DisableItem( SID_DRAW_FONTWORK_VERTICAL
);
343 rSet
.DisableItem( SID_DRAW_CAPTION_VERTICAL
);
344 rSet
.DisableItem( SID_TEXT_FITTOSIZE_VERTICAL
);
345 rSet
.DisableItem( SID_DRAW_TEXT_VERTICAL
);
348 bool bConvertToPathPossible
= mpDrawView
->IsConvertToPathObjPossible();
350 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
351 const size_t nMarkCount
= rMarkList
.GetMarkCount();
353 if( nMarkCount
== 1 )
355 bool bDisable
= true;
356 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
357 if( auto pGrafObj
= dynamic_cast<const SdrGrafObj
*>( pObj
) )
358 if( pGrafObj
->getQrCode() )
362 rSet
.DisableItem(SID_EDIT_QRCODE
);
367 FuFormatPaintBrush::GetMenuState( *this, rSet
);
369 // State of SfxChild-Windows (Animator, Fontwork etc.)
370 SetChildWindowState( rSet
);
372 if(HasCurrentFunction())
374 sal_uInt16 nSId
= GetCurrentFunction()->GetSlotID();
375 rSet
.Put( SfxBoolItem( nSId
, true ) );
378 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
380 GetMenuStateSel(rSet
);
382 if (SfxItemState::DEFAULT
== rSet
.GetItemState(SID_ASSIGN_LAYOUT
))
384 bool bDisable
= true;
387 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
389 if( pPage
&& !pPage
->IsMasterPage() )
391 rSet
.Put( SfxUInt32Item( SID_ASSIGN_LAYOUT
, static_cast< sal_uInt32
>(pPage
->GetAutoLayout()) ) );
398 rSet
.DisableItem(SID_ASSIGN_LAYOUT
);
402 if (SfxItemState::DEFAULT
== rSet
.GetItemState(SID_EXPAND_PAGE
))
404 bool bDisable
= true;
407 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
409 if( pPage
&& (pPage
->GetPageKind() == PageKind::Standard
) && !pPage
->IsMasterPage() )
411 SdrObject
* pObj
= pPage
->GetPresObj(PresObjKind::Outline
);
415 if( !pObj
->IsEmptyPresObj() )
421 // check if the object is in edit, then if it's temporarily not empty
422 SdrTextObj
* pTextObj
= DynCastSdrTextObj( pObj
);
425 if( pTextObj
->CanCreateEditOutlinerParaObject() )
437 rSet
.DisableItem(SID_EXPAND_PAGE
);
441 if (SfxItemState::DEFAULT
== rSet
.GetItemState(SID_SUMMARY_PAGE
))
443 bool bDisable
= true;
446 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
448 if( pPage
&& (pPage
->GetPageKind() == PageKind::Standard
) && !pPage
->IsMasterPage() )
450 SdrObject
* pObj
= pPage
->GetPresObj(PresObjKind::Title
);
452 if(pObj
&& !pObj
->IsEmptyPresObj())
461 rSet
.DisableItem(SID_SUMMARY_PAGE
);
465 if (SfxItemState::DEFAULT
== rSet
.GetItemState(SID_ASSIGN_LAYOUT
))
467 bool bDisable
= true;
470 SdPage
* pPage
= dynamic_cast< SdPage
* >( pPageView
->GetPage() );
472 if( pPage
&& !pPage
->IsMasterPage() )
474 rSet
.Put( SfxUInt32Item(SID_ASSIGN_LAYOUT
, pPage
->GetAutoLayout()) );
481 rSet
.DisableItem(SID_ASSIGN_LAYOUT
);
485 // is it possible to start the presentation?
486 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_PRESENTATION
) ||
487 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_REHEARSE_TIMINGS
) )
489 bool bDisable
= true;
490 sal_uInt16 nCount
= GetDoc()->GetSdPageCount( PageKind::Standard
);
492 for( sal_uInt16 i
= 0; i
< nCount
&& bDisable
; i
++ )
494 SdPage
* pPage
= GetDoc()->GetSdPage(i
, PageKind::Standard
);
496 if( !pPage
->IsExcluded() )
500 if( bDisable
|| GetDocSh()->IsPreview())
502 rSet
.DisableItem( SID_PRESENTATION
);
503 rSet
.DisableItem( SID_REHEARSE_TIMINGS
);
508 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_EDITMODE
) ||
509 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_INSERT_POINT
) ||
510 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_PERCENT
) ||
511 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR
) ||
512 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR_LEFT
) ||
513 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR_RIGHT
) ||
514 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR_TOP
) ||
515 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_ESCDIR_BOTTOM
) ||
516 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_HORZALIGN_CENTER
) ||
517 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_HORZALIGN_LEFT
) ||
518 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_HORZALIGN_RIGHT
) ||
519 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_VERTALIGN_CENTER
) ||
520 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_VERTALIGN_TOP
) ||
521 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GLUE_VERTALIGN_BOTTOM
) )
524 TriState eState
= mpDrawView
->IsMarkedGluePointsPercent();
525 if( eState
== TRISTATE_INDET
)
526 rSet
.InvalidateItem( SID_GLUE_PERCENT
);
528 rSet
.Put( SfxBoolItem( SID_GLUE_PERCENT
, eState
== TRISTATE_TRUE
) );
530 // alignment has no effect by percent
531 if( eState
== TRISTATE_TRUE
)
533 rSet
.DisableItem( SID_GLUE_HORZALIGN_CENTER
);
534 rSet
.DisableItem( SID_GLUE_HORZALIGN_LEFT
);
535 rSet
.DisableItem( SID_GLUE_HORZALIGN_RIGHT
);
536 rSet
.DisableItem( SID_GLUE_VERTALIGN_CENTER
);
537 rSet
.DisableItem( SID_GLUE_VERTALIGN_TOP
);
538 rSet
.DisableItem( SID_GLUE_VERTALIGN_BOTTOM
);
542 // horizontal alignment
543 SdrAlign nHorz
= mpDrawView
->GetMarkedGluePointsAlign( false );
544 rSet
.Put( SfxBoolItem( SID_GLUE_HORZALIGN_CENTER
, nHorz
== SdrAlign::HORZ_CENTER
) );
545 rSet
.Put( SfxBoolItem( SID_GLUE_HORZALIGN_LEFT
, nHorz
== SdrAlign::HORZ_LEFT
) );
546 rSet
.Put( SfxBoolItem( SID_GLUE_HORZALIGN_RIGHT
, nHorz
== SdrAlign::HORZ_RIGHT
) );
547 // vertical alignment
548 SdrAlign nVert
= mpDrawView
->GetMarkedGluePointsAlign( true );
549 rSet
.Put( SfxBoolItem( SID_GLUE_VERTALIGN_CENTER
, nVert
== SdrAlign::VERT_CENTER
) );
550 rSet
.Put( SfxBoolItem( SID_GLUE_VERTALIGN_TOP
, nVert
== SdrAlign::VERT_TOP
) );
551 rSet
.Put( SfxBoolItem( SID_GLUE_VERTALIGN_BOTTOM
, nVert
== SdrAlign::VERT_BOTTOM
) );
555 rSet
.Put( SfxBoolItem( SID_GLUE_INSERT_POINT
, mpDrawView
->IsInsGluePointMode() ) );
559 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SdrEscapeDirection::LEFT
);
560 if( eState
== TRISTATE_INDET
)
561 rSet
.InvalidateItem( SID_GLUE_ESCDIR_LEFT
);
563 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_LEFT
, eState
== TRISTATE_TRUE
) );
565 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SdrEscapeDirection::RIGHT
);
566 if( eState
== TRISTATE_INDET
)
567 rSet
.InvalidateItem( SID_GLUE_ESCDIR_RIGHT
);
569 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_RIGHT
, eState
== TRISTATE_TRUE
) );
571 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SdrEscapeDirection::TOP
);
572 if( eState
== TRISTATE_INDET
)
573 rSet
.InvalidateItem( SID_GLUE_ESCDIR_TOP
);
575 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_TOP
, eState
== TRISTATE_TRUE
) );
577 eState
= mpDrawView
->IsMarkedGluePointsEscDir( SdrEscapeDirection::BOTTOM
);
578 if( eState
== TRISTATE_INDET
)
579 rSet
.InvalidateItem( SID_GLUE_ESCDIR_BOTTOM
);
581 rSet
.Put( SfxBoolItem( SID_GLUE_ESCDIR_BOTTOM
, eState
== TRISTATE_TRUE
) );
584 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_GRID_FRONT
) ||
585 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_HELPLINES_FRONT
) )
587 rSet
.Put( SfxBoolItem( SID_GRID_FRONT
, mpDrawView
->IsGridFront() ) );
588 rSet
.Put( SfxBoolItem( SID_HELPLINES_FRONT
, mpDrawView
->IsHlplFront() ) );
591 if (!mpDrawView
->IsFrameDragSingles())
592 rSet
.Put(SfxBoolItem(SID_BEZIER_EDIT
, true));
594 rSet
.Put(SfxBoolItem(SID_BEZIER_EDIT
, false));
596 if(dynamic_cast<FuEditGluePoints
*>( GetCurrentFunction().get()))
597 rSet
.Put(SfxBoolItem(SID_GLUE_EDITMODE
, true));
599 rSet
.Put(SfxBoolItem(SID_GLUE_EDITMODE
, false));
601 if( !mpDrawView
->IsMirrorAllowed( true, true ) )
603 rSet
.DisableItem( SID_HORIZONTAL
);
604 rSet
.DisableItem( SID_VERTICAL
);
605 rSet
.DisableItem( SID_FLIP_HORIZONTAL
);
606 rSet
.DisableItem( SID_FLIP_VERTICAL
);
609 if( !mpDrawView
->IsMirrorAllowed() )
611 rSet
.DisableItem( SID_OBJECT_MIRROR
);
612 // rSet.DisableItem( SID_CONVERT_TO_3D_LATHE );
613 // rSet.DisableItem( SID_CONVERT_TO_3D_LATHE_FAST );
616 // interactive transparence control
617 if(!mpDrawView
->IsTransparenceAllowed())
619 rSet
.DisableItem( SID_OBJECT_TRANSPARENCE
);
622 // interactive gradient control
623 if(!mpDrawView
->IsGradientAllowed())
625 rSet
.DisableItem( SID_OBJECT_GRADIENT
);
628 // disable morphing if necessary
629 if ( !mpDrawView
->IsMorphingAllowed() )
630 rSet
.DisableItem( SID_POLYGON_MORPHING
);
632 if( !mpDrawView
->IsReverseOrderPossible() )
634 rSet
.DisableItem( SID_REVERSE_ORDER
);
637 if ( !bConvertToPathPossible
&&
638 !mpDrawView
->IsCrookAllowed( mpDrawView
->IsCrookNoContortion() ) )
640 // implicit transformation into curve not possible
641 rSet
.DisableItem(SID_OBJECT_CROOK_ROTATE
);
642 rSet
.DisableItem(SID_OBJECT_CROOK_SLANT
);
643 rSet
.DisableItem(SID_OBJECT_CROOK_STRETCH
);
646 if ( !mpDrawView
->IsGroupEntered() )
648 rSet
.DisableItem( SID_LEAVE_GROUP
);
649 rSet
.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS
, false ) );
650 rSet
.ClearItem( SID_LEAVE_ALL_GROUPS
);
651 rSet
.DisableItem( SID_LEAVE_ALL_GROUPS
);
654 rSet
.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS
, true ) );
656 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_THESAURUS
) )
658 if ( !mpDrawView
->IsTextEdit() )
660 rSet
.DisableItem( SID_THESAURUS
);
664 LanguageType eLang
= GetDoc()->GetLanguage( EE_CHAR_LANGUAGE
);
665 Reference
< XThesaurus
> xThesaurus( LinguMgr::GetThesaurus() );
667 if (!xThesaurus
.is() || eLang
== LANGUAGE_NONE
|| !xThesaurus
->hasLocale( LanguageTag::convertToLocale( eLang
)) )
668 rSet
.DisableItem( SID_THESAURUS
);
672 if ( !mpDrawView
->IsTextEdit() )
674 rSet
.DisableItem( SID_THESAURUS
);
677 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_SELECTALL
) ||
678 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_SIZE_ALL
) )
680 if( pPageView
&& pPageView
->GetObjList()->GetObjCount() == 0 )
682 // should be disabled if there is no object on the draw area:
683 rSet
.DisableItem( SID_SELECTALL
);
684 rSet
.DisableItem( SID_SIZE_ALL
);
688 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_CONTEXT
) )
689 rSet
.Put( SfxStringItem( SID_CONTEXT
, mpDrawView
->GetStatusText() ) );
692 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_PASTE
) ||
693 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_PASTE_SPECIAL
) ||
694 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_PASTE_UNFORMATTED
) ||
695 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS
) )
697 if ( !mxClipEvtLstnr
.is() )
699 // avoid clipboard initialization for
700 // read-only presentation views (workaround for NT4.0
701 // clipboard prob...)
702 if( dynamic_cast< const PresentationViewShell
*>( this ) == nullptr )
705 mxClipEvtLstnr
= new TransferableClipboardListener( LINK( this, DrawViewShell
, ClipboardChanged
) );
706 mxClipEvtLstnr
->AddListener( GetActiveWindow() );
709 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
710 mbPastePossible
= ( aDataHelper
.GetFormatCount() != 0 );
711 mpCurrentClipboardFormats
= GetSupportedClipboardFormats( aDataHelper
);
714 mbPastePossible
= false;
717 if( !mbPastePossible
)
719 rSet
.DisableItem( SID_PASTE
);
720 rSet
.DisableItem( SID_PASTE_SPECIAL
);
721 rSet
.DisableItem( SID_PASTE_UNFORMATTED
);
722 rSet
.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS
);
724 else if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS
) )
726 if (mpCurrentClipboardFormats
!= nullptr)
727 rSet
.Put(*mpCurrentClipboardFormats
);
731 if ( !bConvertToPathPossible
)
733 rSet
.DisableItem(SID_CHANGEBEZIER
);
736 if (mpDrawView
== nullptr)
738 // The mpDrawView was not NULL but is now.
739 // The reason for this may be that the DrawViewShell has been
740 // destroyed in the meantime.
741 // We can only return immediately and hope that the deleted
742 // DrawViewShell is not called again.
743 DBG_ASSERT(mpDrawView
!=nullptr, "Please report this assertion to the Impress team.");
747 if( !( mpDrawView
->IsConvertToPolyObjPossible() || mpDrawView
->IsVectorizeAllowed() ) )
748 rSet
.DisableItem(SID_CHANGEPOLYGON
);
750 if( !( mpDrawView
->IsConvertToPolyObjPossible() || mpDrawView
->IsConvertToContourPossible() ) )
751 rSet
.DisableItem(SID_CONVERT_TO_CONTOUR
);
753 if ( !mpDrawView
->IsConvertTo3DObjPossible() )
755 rSet
.DisableItem(SID_CONVERT_TO_3D
);
756 rSet
.DisableItem(SID_CONVERT_TO_3D_LATHE
);
757 rSet
.DisableItem(SID_CONVERT_TO_3D_LATHE_FAST
);
760 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_MANAGE_LINKS
) )
762 if ( GetDoc()->GetLinkCount() == 0 )
764 rSet
.DisableItem(SID_MANAGE_LINKS
);
768 if (mePageKind
== PageKind::Handout
)
770 rSet
.DisableItem(SID_PRESENTATION_LAYOUT
);
771 rSet
.DisableItem(SID_SELECT_BACKGROUND
);
772 rSet
.DisableItem(SID_SAVE_BACKGROUND
);
775 if (mePageKind
== PageKind::Notes
)
777 rSet
.DisableItem(SID_INSERTPAGE
);
778 rSet
.DisableItem(SID_RENAMEPAGE
);
779 rSet
.DisableItem(SID_RENAMEPAGE_QUICK
);
780 rSet
.DisableItem(SID_DUPLICATE_PAGE
);
781 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
782 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
783 rSet
.DisableItem(SID_ANIMATION_EFFECTS
);
784 rSet
.DisableItem(SID_EXECUTE_ANIMATION_EFFECT
);
786 if (meEditMode
== EditMode::MasterPage
)
787 rSet
.DisableItem(SID_MODIFYPAGE
);
789 rSet
.DisableItem(SID_SELECT_BACKGROUND
);
790 rSet
.DisableItem(SID_SAVE_BACKGROUND
);
791 rSet
.DisableItem(SID_INSERTLAYER
);
792 rSet
.DisableItem(SID_LAYERMODE
);
793 rSet
.DisableItem(SID_INSERTFILE
);
795 else if (mePageKind
== PageKind::Handout
)
797 rSet
.DisableItem(SID_INSERTPAGE
);
798 rSet
.DisableItem(SID_DUPLICATE_PAGE
);
799 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
800 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
801 rSet
.DisableItem(SID_ANIMATION_EFFECTS
);
802 rSet
.DisableItem(SID_EXECUTE_ANIMATION_EFFECT
);
803 rSet
.DisableItem(SID_RENAMEPAGE
);
804 rSet
.DisableItem(SID_RENAMEPAGE_QUICK
);
805 rSet
.DisableItem(SID_INSERTLAYER
);
806 rSet
.DisableItem(SID_MODIFYLAYER
);
807 rSet
.DisableItem(SID_TOGGLELAYERVISIBILITY
);
808 rSet
.DisableItem(SID_RENAMELAYER
);
809 rSet
.DisableItem(SID_LAYERMODE
);
810 rSet
.DisableItem(SID_INSERTFILE
);
811 rSet
.DisableItem(SID_PAGEMODE
);
812 rSet
.DisableItem(SID_SELECT_BACKGROUND
);
813 rSet
.DisableItem(SID_SAVE_BACKGROUND
);
817 if (meEditMode
== EditMode::MasterPage
)
819 rSet
.DisableItem(SID_INSERTPAGE
);
820 rSet
.DisableItem(SID_DUPLICATE_PAGE
);
821 rSet
.DisableItem(SID_MODIFYPAGE
);
822 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
823 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
826 rSet
.Put (SfxBoolItem (SID_LAYERMODE
, IsLayerModeActive()));
829 if ( ! IsLayerModeActive())
831 rSet
.DisableItem( SID_INSERTLAYER
);
832 rSet
.DisableItem( SID_MODIFYLAYER
);
833 rSet
.DisableItem( SID_TOGGLELAYERVISIBILITY
);
834 rSet
.DisableItem( SID_DELETE_LAYER
);
835 rSet
.DisableItem( SID_RENAMELAYER
);
838 if (meEditMode
== EditMode::Page
)
840 /**********************************************************************
842 **********************************************************************/
843 rSet
.Put(SfxBoolItem(SID_PAGEMODE
, true));
844 rSet
.Put(SfxBoolItem(SID_MASTERPAGE
, false));
845 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTER_MODE
, false));
846 rSet
.Put(SfxBoolItem(SID_NOTES_MASTER_MODE
, false));
847 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTER_MODE
, false));
849 rSet
.DisableItem (SID_INSERT_MASTER_PAGE
);
850 rSet
.DisableItem (SID_DELETE_MASTER_PAGE
);
851 rSet
.DisableItem (SID_RENAME_MASTER_PAGE
);
852 rSet
.DisableItem (SID_CLOSE_MASTER_VIEW
);
856 rSet
.Put(SfxBoolItem(SID_PAGEMODE
, false));
857 rSet
.Put(SfxBoolItem(SID_MASTERPAGE
, true));
859 /**********************************************************************
860 * Background page mode
861 **********************************************************************/
862 if (mePageKind
== PageKind::Standard
)
864 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTER_MODE
, true));
865 rSet
.Put(SfxBoolItem(SID_NOTES_MASTER_MODE
, false));
866 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTER_MODE
, false));
869 else if (mePageKind
== PageKind::Notes
)
871 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTER_MODE
, false));
872 rSet
.Put(SfxBoolItem(SID_NOTES_MASTER_MODE
, true));
873 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTER_MODE
, false));
875 else if (mePageKind
== PageKind::Handout
)
877 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTER_MODE
, false));
878 rSet
.Put(SfxBoolItem(SID_NOTES_MASTER_MODE
, false));
879 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTER_MODE
, true));
883 // set state of the ruler
884 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_RULER
) )
885 rSet
.Put( SfxBoolItem( SID_RULER
, HasRuler() ) );
887 // do not delete the last page or a master page
888 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DELETE_PAGE
)
889 || SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DELETE_MASTER_PAGE
) )
891 if (maTabControl
->GetPageCount() == 1 ||
892 meEditMode
== EditMode::MasterPage
||
893 mePageKind
== PageKind::Notes
||
894 mePageKind
== PageKind::Handout
||
895 (GetShellType()!=ST_DRAW
&&IsLayerModeActive()))
897 if (rSet
.GetItemState(SID_DELETE_PAGE
) == SfxItemState::DEFAULT
)
898 rSet
.DisableItem(SID_DELETE_PAGE
);
899 if (rSet
.GetItemState(SID_DELETE_MASTER_PAGE
)==SfxItemState::DEFAULT
)
900 rSet
.DisableItem(SID_DELETE_MASTER_PAGE
);
904 // is it allowed to delete the current layer?
905 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_DELETE_LAYER
)
906 || SfxItemState::DEFAULT
== rSet
.GetItemState( SID_RENAMELAYER
) )
908 if(GetLayerTabControl()) // #i87182#
910 sal_uInt16 nCurrentLayer
= GetLayerTabControl()->GetCurPageId();
911 const OUString aName
= GetLayerTabControl()->GetLayerName(nCurrentLayer
);
913 if (!IsLayerModeActive() || LayerTabBar::IsRealNameOfStandardLayer(aName
))
915 rSet
.DisableItem(SID_DELETE_LAYER
);
916 rSet
.DisableItem(SID_RENAMELAYER
);
921 OSL_ENSURE(false, "No LayerTabBar (!)");
925 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_CUT
) ||
926 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_COPY
) ||
927 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_OUTLINE_BULLET
))
929 OutlinerView
* pOlView
= mpDrawView
->GetTextEditOutlinerView();
931 // special treatment of for SID_OUTLINE_BULLET if objects with different
932 // kinds of NumBullets are marked
933 bool bHasOutliner
= false;
934 bool bHasOther
= false;
935 for(size_t nNum
= 0; nNum
< nMarkCount
; ++nNum
)
937 SdrObject
* pObj
= rMarkList
.GetMark(nNum
)->GetMarkedSdrObj();
938 if( pObj
->GetObjInventor() == SdrInventor::Default
)
940 if( pObj
->GetObjIdentifier() == SdrObjKind::OutlineText
)
955 if( bHasOther
&& bHasOutliner
)
956 rSet
.DisableItem( SID_OUTLINE_BULLET
);
960 if (pOlView
->GetSelected().isEmpty() || GetObjectShell()->isContentExtractionLocked())
962 rSet
.DisableItem( SID_CUT
);
963 rSet
.DisableItem( SID_COPY
);
969 FuBullet::GetSlotState( rSet
, this, GetViewFrame() );
971 if ( GetDocSh()->IsUIActive() )
973 rSet
.DisableItem( SID_INSERT_OBJECT
);
974 rSet
.DisableItem( SID_INSERT_FLOATINGFRAME
);
975 rSet
.DisableItem( SID_INSERT_MATH
);
976 rSet
.DisableItem( SID_INSERT_DIAGRAM
);
977 rSet
.DisableItem( SID_ATTR_TABLE
);
978 rSet
.DisableItem( SID_SIZE_REAL
);
979 rSet
.DisableItem( SID_SIZE_OPTIMAL
);
980 rSet
.DisableItem( SID_SIZE_ALL
);
981 rSet
.DisableItem( SID_SIZE_PAGE_WIDTH
);
982 rSet
.DisableItem( SID_SIZE_PAGE
);
983 rSet
.DisableItem( SID_DUPLICATE_PAGE
);
984 rSet
.DisableItem( SID_ZOOM_TOOLBOX
);
988 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_ZOOM_IN
) ||
989 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_ZOOM_OUT
)||
990 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_ZOOM_PANNING
) )
992 if( GetActiveWindow()->GetZoom() <= GetActiveWindow()->GetMinZoom() || GetDocSh()->IsUIActive() )
994 rSet
.DisableItem( SID_ZOOM_OUT
);
995 rSet
.DisableItem( SID_ZOOM_PANNING
);
997 if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() )
998 rSet
.DisableItem( SID_ZOOM_IN
);
1001 if (!mpZoomList
->IsNextPossible())
1003 rSet
.DisableItem(SID_ZOOM_NEXT
);
1005 if (!mpZoomList
->IsPreviousPossible())
1007 rSet
.DisableItem(SID_ZOOM_PREV
);
1010 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_REMOTE_DLG
) )
1013 bool bDisableSdremoteForGood
= false;
1014 #ifndef ENABLE_SDREMOTE
1015 bDisableSdremoteForGood
= true;
1017 bDisableSdremoteForGood
|= !(officecfg::Office::Impress::Misc::Start::EnableSdremote::get()
1018 && officecfg::Office::Security::Net::AllowInsecureImpressRemoteWiFi::get()
1021 // This dialog is only useful for TCP/IP remote control
1022 // which is unusual, under-tested and a security issue.
1023 if ( bDisableSdremoteForGood
)
1025 rSet
.Put(SfxVisibilityItem(SID_REMOTE_DLG
, false));
1030 if (GetViewShellBase().GetViewShellManager()->GetShell(ToolbarId::Draw_Text_Toolbox_Sd
) != nullptr)
1032 sal_uInt16 nCurrentSId
= SID_ATTR_CHAR
;
1034 if(HasCurrentFunction())
1036 nCurrentSId
= GetCurrentFunction()->GetSlotID();
1038 if( nCurrentSId
!= SID_TEXT_FITTOSIZE
&&
1039 nCurrentSId
!= SID_TEXT_FITTOSIZE_VERTICAL
&&
1040 nCurrentSId
!= SID_ATTR_CHAR_VERTICAL
)
1041 nCurrentSId
= SID_ATTR_CHAR
;
1043 rSet
.Put( SfxBoolItem( nCurrentSId
, true ) );
1046 if ( GetDocSh()->IsReadOnly() )
1048 rSet
.DisableItem( SID_AUTOSPELL_CHECK
);
1052 if (GetDoc()->GetOnlineSpell())
1054 rSet
.Put(SfxBoolItem(SID_AUTOSPELL_CHECK
, true));
1058 rSet
.Put(SfxBoolItem(SID_AUTOSPELL_CHECK
, false));
1062 SdrPageView
* pPV
= mpDrawView
->GetSdrPageView();
1063 OUString aActiveLayer
= mpDrawView
->GetActiveLayer();
1065 if ( ( !aActiveLayer
.isEmpty() && pPV
&& ( pPV
->IsLayerLocked(aActiveLayer
) ||
1066 !pPV
->IsLayerVisible(aActiveLayer
) ) ) ||
1067 SdModule::get()->GetWaterCan() )
1069 rSet
.DisableItem( SID_PASTE
);
1070 rSet
.DisableItem( SID_PASTE_SPECIAL
);
1071 rSet
.DisableItem( SID_PASTE_UNFORMATTED
);
1072 rSet
.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS
);
1074 rSet
.DisableItem( SID_INSERT_FLD_DATE_FIX
);
1075 rSet
.DisableItem( SID_INSERT_FLD_DATE_VAR
);
1076 rSet
.DisableItem( SID_INSERT_FLD_TIME_FIX
);
1077 rSet
.DisableItem( SID_INSERT_FLD_TIME_VAR
);
1078 rSet
.DisableItem( SID_INSERT_FLD_AUTHOR
);
1079 rSet
.DisableItem( SID_INSERT_FLD_PAGE
);
1080 rSet
.DisableItem( SID_INSERT_FLD_PAGE_TITLE
);
1081 rSet
.DisableItem( SID_INSERT_FLD_PAGES
);
1082 rSet
.DisableItem( SID_INSERT_FLD_FILE
);
1084 rSet
.DisableItem( SID_INSERT_GRAPHIC
);
1085 rSet
.DisableItem( SID_INSERT_AVMEDIA
);
1086 rSet
.DisableItem( SID_INSERT_DIAGRAM
);
1087 rSet
.DisableItem( SID_INSERT_OBJECT
);
1088 rSet
.DisableItem( SID_INSERT_FLOATINGFRAME
);
1090 rSet
.DisableItem( SID_INSERT_MATH
);
1091 rSet
.DisableItem( SID_INSERT_FRAME
);
1092 rSet
.DisableItem( SID_INSERTFILE
);
1093 rSet
.DisableItem( SID_ATTR_TABLE
);
1094 rSet
.DisableItem( SID_COPYOBJECTS
);
1096 rSet
.DisableItem( SID_SCAN
);
1097 rSet
.DisableItem( SID_TWAIN_SELECT
);
1098 rSet
.DisableItem( SID_TWAIN_TRANSFER
);
1100 // rSet.DisableItem( SID_BEZIER_EDIT );
1101 rSet
.DisableItem( SID_GLUE_EDITMODE
);
1102 rSet
.DisableItem( SID_OBJECT_ROTATE
);
1103 rSet
.DisableItem( SID_OBJECT_SHEAR
);
1104 rSet
.DisableItem( SID_OBJECT_MIRROR
);
1105 rSet
.DisableItem( SID_OBJECT_CROP
);
1106 rSet
.DisableItem( SID_ATTR_GRAF_CROP
);
1107 rSet
.DisableItem( SID_OBJECT_TRANSPARENCE
);
1108 rSet
.DisableItem( SID_OBJECT_GRADIENT
);
1109 rSet
.DisableItem( SID_OBJECT_CROOK_ROTATE
);
1110 rSet
.DisableItem( SID_OBJECT_CROOK_SLANT
);
1111 rSet
.DisableItem( SID_OBJECT_CROOK_STRETCH
);
1113 // Disable all object-creating tools
1114 rSet
.ClearItem( SID_ATTR_CHAR
);
1115 rSet
.DisableItem( SID_ATTR_CHAR
);
1116 rSet
.ClearItem( SID_ATTR_CHAR_VERTICAL
);
1117 rSet
.DisableItem( SID_ATTR_CHAR_VERTICAL
);
1118 rSet
.ClearItem(SID_DRAW_LINE
);
1119 rSet
.DisableItem(SID_DRAW_LINE
);
1120 rSet
.ClearItem(SID_DRAW_MEASURELINE
);
1121 rSet
.DisableItem(SID_DRAW_MEASURELINE
);
1122 rSet
.ClearItem(SID_DRAW_XLINE
);
1123 rSet
.DisableItem(SID_DRAW_XLINE
);
1124 rSet
.ClearItem( SID_LINE_ARROW_START
);
1125 rSet
.DisableItem( SID_LINE_ARROW_START
);
1126 rSet
.ClearItem( SID_LINE_ARROW_END
);
1127 rSet
.DisableItem( SID_LINE_ARROW_END
);
1128 rSet
.ClearItem( SID_LINE_ARROWS
);
1129 rSet
.DisableItem( SID_LINE_ARROWS
);
1130 rSet
.ClearItem( SID_LINE_ARROW_CIRCLE
);
1131 rSet
.DisableItem( SID_LINE_ARROW_CIRCLE
);
1132 rSet
.ClearItem( SID_LINE_CIRCLE_ARROW
);
1133 rSet
.DisableItem( SID_LINE_CIRCLE_ARROW
);
1134 rSet
.ClearItem( SID_LINE_ARROW_SQUARE
);
1135 rSet
.DisableItem( SID_LINE_ARROW_SQUARE
);
1136 rSet
.ClearItem( SID_LINE_SQUARE_ARROW
);
1137 rSet
.DisableItem( SID_LINE_SQUARE_ARROW
);
1139 rSet
.ClearItem(SID_DRAW_RECT
);
1140 rSet
.DisableItem(SID_DRAW_RECT
);
1141 rSet
.ClearItem(SID_DRAW_RECT_NOFILL
);
1142 rSet
.DisableItem(SID_DRAW_RECT_NOFILL
);
1143 rSet
.ClearItem(SID_DRAW_RECT_ROUND
);
1144 rSet
.DisableItem(SID_DRAW_RECT_ROUND
);
1145 rSet
.ClearItem(SID_DRAW_RECT_ROUND_NOFILL
);
1146 rSet
.DisableItem(SID_DRAW_RECT_ROUND_NOFILL
);
1147 rSet
.ClearItem(SID_DRAW_SQUARE
);
1148 rSet
.DisableItem(SID_DRAW_SQUARE
);
1149 rSet
.ClearItem(SID_DRAW_SQUARE_NOFILL
);
1150 rSet
.DisableItem(SID_DRAW_SQUARE_NOFILL
);
1151 rSet
.ClearItem(SID_DRAW_SQUARE_ROUND
);
1152 rSet
.DisableItem(SID_DRAW_SQUARE_ROUND
);
1153 rSet
.ClearItem(SID_DRAW_SQUARE_ROUND_NOFILL
);
1154 rSet
.DisableItem(SID_DRAW_SQUARE_ROUND_NOFILL
);
1155 rSet
.ClearItem(SID_DRAW_ELLIPSE
);
1156 rSet
.DisableItem(SID_DRAW_ELLIPSE
);
1157 rSet
.ClearItem(SID_DRAW_ELLIPSE_NOFILL
);
1158 rSet
.DisableItem(SID_DRAW_ELLIPSE_NOFILL
);
1159 rSet
.ClearItem(SID_DRAW_CIRCLE
);
1160 rSet
.DisableItem(SID_DRAW_CIRCLE
);
1161 rSet
.ClearItem(SID_DRAW_CIRCLE_NOFILL
);
1162 rSet
.DisableItem(SID_DRAW_CIRCLE_NOFILL
);
1163 rSet
.ClearItem(SID_DRAW_CAPTION
);
1164 rSet
.DisableItem(SID_DRAW_CAPTION
);
1165 rSet
.ClearItem(SID_DRAW_FONTWORK
);
1166 rSet
.DisableItem(SID_DRAW_FONTWORK
);
1167 rSet
.ClearItem(SID_DRAW_FONTWORK_VERTICAL
);
1168 rSet
.DisableItem(SID_DRAW_FONTWORK_VERTICAL
);
1169 rSet
.ClearItem(SID_DRAW_CAPTION_VERTICAL
);
1170 rSet
.DisableItem(SID_DRAW_CAPTION_VERTICAL
);
1171 rSet
.ClearItem(SID_TEXT_FITTOSIZE
);
1172 rSet
.DisableItem(SID_TEXT_FITTOSIZE
);
1173 rSet
.ClearItem(SID_TEXT_FITTOSIZE_VERTICAL
);
1174 rSet
.DisableItem(SID_TEXT_FITTOSIZE_VERTICAL
);
1175 rSet
.ClearItem(SID_TOOL_CONNECTOR
);
1176 rSet
.DisableItem(SID_TOOL_CONNECTOR
);
1177 rSet
.ClearItem(SID_CONNECTOR_ARROW_START
);
1178 rSet
.DisableItem(SID_CONNECTOR_ARROW_START
);
1179 rSet
.ClearItem(SID_CONNECTOR_ARROW_END
);
1180 rSet
.DisableItem(SID_CONNECTOR_ARROW_END
);
1181 rSet
.ClearItem(SID_CONNECTOR_ARROWS
);
1182 rSet
.DisableItem(SID_CONNECTOR_ARROWS
);
1183 rSet
.ClearItem(SID_CONNECTOR_CIRCLE_START
);
1184 rSet
.DisableItem(SID_CONNECTOR_CIRCLE_START
);
1185 rSet
.ClearItem(SID_CONNECTOR_CIRCLE_END
);
1186 rSet
.DisableItem(SID_CONNECTOR_CIRCLE_END
);
1187 rSet
.ClearItem(SID_CONNECTOR_CIRCLES
);
1188 rSet
.DisableItem(SID_CONNECTOR_CIRCLES
);
1189 rSet
.ClearItem(SID_CONNECTOR_LINE
);
1190 rSet
.DisableItem(SID_CONNECTOR_LINE
);
1191 rSet
.ClearItem(SID_CONNECTOR_LINE_ARROW_START
);
1192 rSet
.DisableItem(SID_CONNECTOR_LINE_ARROW_START
);
1193 rSet
.ClearItem(SID_CONNECTOR_LINE_ARROW_END
);
1194 rSet
.DisableItem(SID_CONNECTOR_LINE_ARROW_END
);
1195 rSet
.ClearItem(SID_CONNECTOR_LINE_ARROWS
);
1196 rSet
.DisableItem(SID_CONNECTOR_LINE_ARROWS
);
1197 rSet
.ClearItem(SID_CONNECTOR_LINE_CIRCLE_START
);
1198 rSet
.DisableItem(SID_CONNECTOR_LINE_CIRCLE_START
);
1199 rSet
.ClearItem(SID_CONNECTOR_LINE_CIRCLE_END
);
1200 rSet
.DisableItem(SID_CONNECTOR_LINE_CIRCLE_END
);
1201 rSet
.ClearItem(SID_CONNECTOR_LINE_CIRCLES
);
1202 rSet
.DisableItem(SID_CONNECTOR_LINE_CIRCLES
);
1203 rSet
.ClearItem(SID_CONNECTOR_CURVE
);
1204 rSet
.DisableItem(SID_CONNECTOR_CURVE
);
1205 rSet
.ClearItem(SID_CONNECTOR_CURVE_ARROW_START
);
1206 rSet
.DisableItem(SID_CONNECTOR_CURVE_ARROW_START
);
1207 rSet
.ClearItem(SID_CONNECTOR_CURVE_ARROW_END
);
1208 rSet
.DisableItem(SID_CONNECTOR_CURVE_ARROW_END
);
1209 rSet
.ClearItem(SID_CONNECTOR_CURVE_ARROWS
);
1210 rSet
.DisableItem(SID_CONNECTOR_CURVE_ARROWS
);
1211 rSet
.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_START
);
1212 rSet
.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_START
);
1213 rSet
.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_END
);
1214 rSet
.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_END
);
1215 rSet
.ClearItem(SID_CONNECTOR_CURVE_CIRCLES
);
1216 rSet
.DisableItem(SID_CONNECTOR_CURVE_CIRCLES
);
1217 rSet
.ClearItem(SID_CONNECTOR_LINES
);
1218 rSet
.DisableItem(SID_CONNECTOR_LINES
);
1219 rSet
.ClearItem(SID_CONNECTOR_LINES_ARROW_START
);
1220 rSet
.DisableItem(SID_CONNECTOR_LINES_ARROW_START
);
1221 rSet
.ClearItem(SID_CONNECTOR_LINES_ARROW_END
);
1222 rSet
.DisableItem(SID_CONNECTOR_LINES_ARROW_END
);
1223 rSet
.ClearItem(SID_CONNECTOR_LINES_ARROWS
);
1224 rSet
.DisableItem(SID_CONNECTOR_LINES_ARROWS
);
1225 rSet
.ClearItem(SID_CONNECTOR_LINES_CIRCLE_START
);
1226 rSet
.DisableItem(SID_CONNECTOR_LINES_CIRCLE_START
);
1227 rSet
.ClearItem(SID_CONNECTOR_LINES_CIRCLE_END
);
1228 rSet
.DisableItem(SID_CONNECTOR_LINES_CIRCLE_END
);
1229 rSet
.ClearItem(SID_CONNECTOR_LINES_CIRCLES
);
1230 rSet
.DisableItem(SID_CONNECTOR_LINES_CIRCLES
);
1231 rSet
.ClearItem(SID_DRAW_ARC
);
1232 rSet
.DisableItem(SID_DRAW_ARC
);
1233 rSet
.ClearItem(SID_DRAW_CIRCLEARC
);
1234 rSet
.DisableItem(SID_DRAW_CIRCLEARC
);
1235 rSet
.ClearItem(SID_DRAW_PIE
);
1236 rSet
.DisableItem(SID_DRAW_PIE
);
1237 rSet
.ClearItem(SID_DRAW_PIE_NOFILL
);
1238 rSet
.DisableItem(SID_DRAW_PIE_NOFILL
);
1239 rSet
.ClearItem(SID_DRAW_CIRCLEPIE
);
1240 rSet
.DisableItem(SID_DRAW_CIRCLEPIE
);
1241 rSet
.ClearItem(SID_DRAW_CIRCLEPIE_NOFILL
);
1242 rSet
.DisableItem(SID_DRAW_CIRCLEPIE_NOFILL
);
1243 rSet
.ClearItem(SID_DRAW_ELLIPSECUT
);
1244 rSet
.DisableItem(SID_DRAW_ELLIPSECUT
);
1245 rSet
.ClearItem(SID_DRAW_ELLIPSECUT_NOFILL
);
1246 rSet
.DisableItem(SID_DRAW_ELLIPSECUT_NOFILL
);
1247 rSet
.ClearItem(SID_DRAW_CIRCLECUT
);
1248 rSet
.DisableItem(SID_DRAW_CIRCLECUT
);
1249 rSet
.ClearItem(SID_DRAW_CIRCLECUT_NOFILL
);
1250 rSet
.DisableItem(SID_DRAW_CIRCLECUT_NOFILL
);
1251 rSet
.ClearItem(SID_DRAW_POLYGON
);
1252 rSet
.DisableItem(SID_DRAW_POLYGON
);
1253 rSet
.ClearItem(SID_DRAW_POLYGON_NOFILL
);
1254 rSet
.DisableItem(SID_DRAW_POLYGON_NOFILL
);
1255 rSet
.ClearItem(SID_DRAW_FREELINE
);
1256 rSet
.DisableItem(SID_DRAW_FREELINE
);
1257 rSet
.ClearItem(SID_DRAW_FREELINE_NOFILL
);
1258 rSet
.DisableItem(SID_DRAW_FREELINE_NOFILL
);
1259 rSet
.ClearItem(SID_DRAW_XPOLYGON
);
1260 rSet
.DisableItem(SID_DRAW_XPOLYGON
);
1261 rSet
.ClearItem(SID_DRAW_XPOLYGON_NOFILL
);
1262 rSet
.DisableItem(SID_DRAW_XPOLYGON_NOFILL
);
1263 rSet
.ClearItem(SID_DRAW_BEZIER_FILL
);
1264 rSet
.DisableItem(SID_DRAW_BEZIER_FILL
);
1265 rSet
.ClearItem(SID_DRAW_BEZIER_NOFILL
);
1266 rSet
.DisableItem(SID_DRAW_BEZIER_NOFILL
);
1267 rSet
.ClearItem(SID_3D_CUBE
);
1268 rSet
.DisableItem(SID_3D_CUBE
);
1269 rSet
.ClearItem(SID_3D_SHELL
);
1270 rSet
.DisableItem(SID_3D_SHELL
);
1271 rSet
.ClearItem(SID_3D_SPHERE
);
1272 rSet
.DisableItem(SID_3D_SPHERE
);
1273 rSet
.ClearItem(SID_3D_HALF_SPHERE
);
1274 rSet
.DisableItem(SID_3D_HALF_SPHERE
);
1275 rSet
.ClearItem(SID_3D_CYLINDER
);
1276 rSet
.DisableItem(SID_3D_CYLINDER
);
1277 rSet
.ClearItem(SID_3D_CONE
);
1278 rSet
.DisableItem(SID_3D_CONE
);
1279 rSet
.ClearItem(SID_3D_TORUS
);
1280 rSet
.DisableItem(SID_3D_TORUS
);
1281 rSet
.ClearItem(SID_3D_PYRAMID
);
1282 rSet
.DisableItem(SID_3D_PYRAMID
);
1285 if ( !aActiveLayer
.isEmpty() && pPV
)
1286 rSet
.Put( SfxBoolItem(SID_TOGGLELAYERVISIBILITY
, !pPageView
->IsLayerVisible(aActiveLayer
)) );
1288 // are the modules available?
1290 if (!SvtModuleOptions().IsCalcInstalled())
1292 // remove menu entry if module is not available
1293 rSet
.Put( SfxVisibilityItem( SID_ATTR_TABLE
, false ) );
1295 if (!SvtModuleOptions().IsChartInstalled())
1297 rSet
.DisableItem( SID_INSERT_DIAGRAM
);
1299 if (!SvtModuleOptions().IsMathInstalled())
1301 rSet
.DisableItem( SID_INSERT_MATH
);
1304 rtl::Reference
< sd::SlideShow
> xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
1305 if( (xSlideshow
.is() && xSlideshow
->isRunning() && !xSlideshow
->IsInteractiveSlideshow() // IASS
1306 && (xSlideshow
->getAnimationMode() != ANIMATIONMODE_PREVIEW
) ) || GetDocSh()->IsPreview() )
1309 rSet
.DisableItem( SID_PRESENTATION
);
1310 rSet
.DisableItem( SID_ZOOM_IN
);
1311 rSet
.DisableItem( SID_ZOOM_OUT
);
1312 rSet
.DisableItem( SID_ZOOM_PANNING
);
1313 rSet
.DisableItem( SID_ZOOM_MODE
);
1314 rSet
.DisableItem( SID_ZOOM_NEXT
);
1315 rSet
.DisableItem( SID_ZOOM_PREV
);
1316 rSet
.DisableItem( SID_SIZE_REAL
);
1317 rSet
.DisableItem( SID_SIZE_OPTIMAL
);
1318 rSet
.DisableItem( SID_SIZE_ALL
);
1319 rSet
.DisableItem( SID_SIZE_PAGE_WIDTH
);
1320 rSet
.DisableItem( SID_SIZE_PAGE
);
1321 rSet
.DisableItem( SID_INSERTPAGE
);
1322 rSet
.DisableItem( SID_DUPLICATE_PAGE
);
1323 rSet
.DisableItem( SID_MODIFYPAGE
);
1324 rSet
.DisableItem( SID_RENAMEPAGE
);
1325 rSet
.DisableItem( SID_RENAMEPAGE_QUICK
);
1326 rSet
.DisableItem( SID_DELETE_PAGE
);
1327 rSet
.DisableItem( SID_PAGESETUP
);
1329 if( xSlideshow
.is() && xSlideshow
->isRunning() && !xSlideshow
->IsInteractiveSlideshow() ) // IASS
1331 rSet
.ClearItem(SID_INSERTFILE
);
1332 rSet
.ClearItem(SID_OBJECT_ROTATE
);
1333 rSet
.ClearItem(SID_FM_CONFIG
);
1334 rSet
.ClearItem(SID_ANIMATION_EFFECTS
);
1335 rSet
.ClearItem(SID_EXECUTE_ANIMATION_EFFECT
);
1336 rSet
.ClearItem(SID_ANIMATION_OBJECTS
);
1337 rSet
.ClearItem(SID_3D_WIN
);
1339 rSet
.DisableItem(SID_OBJECT_ALIGN
);
1340 rSet
.DisableItem(SID_ALIGN_PAGE
);
1341 rSet
.DisableItem(SID_ZOOM_TOOLBOX
);
1342 rSet
.DisableItem(SID_OBJECT_CHOOSE_MODE
);
1343 rSet
.DisableItem(SID_DRAWTBX_TEXT
);
1344 rSet
.DisableItem(SID_DRAWTBX_RECTANGLES
);
1345 rSet
.DisableItem(SID_DRAWTBX_ELLIPSES
);
1346 rSet
.DisableItem(SID_DRAWTBX_LINES
);
1347 rSet
.DisableItem(SID_DRAWTBX_ARROWS
);
1348 rSet
.DisableItem(SID_DRAWTBX_3D_OBJECTS
);
1349 rSet
.DisableItem(SID_DRAWTBX_CONNECTORS
);
1350 rSet
.DisableItem(SID_OBJECT_CHOOSE_MODE
);
1351 rSet
.DisableItem(SID_DRAWTBX_INSERT
);
1352 rSet
.DisableItem(SID_INSERTFILE
);
1353 rSet
.DisableItem(SID_OBJECT_ROTATE
);
1354 rSet
.DisableItem(SID_POSITION
);
1355 rSet
.DisableItem(SID_FM_CONFIG
);
1356 rSet
.DisableItem(SID_ANIMATION_EFFECTS
);
1357 rSet
.DisableItem(SID_EXECUTE_ANIMATION_EFFECT
);
1358 rSet
.DisableItem(SID_ANIMATION_OBJECTS
);
1359 rSet
.DisableItem(SID_3D_WIN
);
1363 // Menuoption: Change->Convert->To Bitmap, Change->Convert->To Metafile
1364 // disable, if there only Bitmap or Metafiles marked
1365 // Menuoption: Format->Area, Format->Line
1366 // disabled, if the marked objects not able to handle
1369 bool bSingleGraphicSelected
= false;
1371 if (rMarkList
.GetMarkCount() == 0)
1373 rSet
.DisableItem (SID_CONVERT_TO_METAFILE
);
1374 rSet
.DisableItem (SID_CONVERT_TO_BITMAP
);
1379 SdrMarkList aMarkList
= mpDrawView
->GetMarkedObjectList();
1381 bool bFoundBitmap
= false;
1382 bool bFoundMetafile
= false;
1383 bool bFoundObjNoArea
= false;
1384 bool bFoundNoGraphicObj
= false;
1385 bool bFoundAny
= false;
1386 bool bFoundTable
= false;
1388 // const size_t nMarkCount = aMarkList.GetMarkCount();
1389 for (size_t i
=0; i
< nMarkCount
&& !bFoundAny
; ++i
)
1391 SdrObject
* pObj
= aMarkList
.GetMark(i
)->GetMarkedSdrObj();
1392 SdrObjKind nId
= pObj
->GetObjIdentifier();
1393 SdrInventor nInv
= pObj
->GetObjInventor();
1395 if(nInv
== SdrInventor::Default
)
1400 case SdrObjKind::PathLine
:
1401 case SdrObjKind::PolyLine
:
1402 case SdrObjKind::Line
:
1403 case SdrObjKind::FreehandLine
:
1404 case SdrObjKind::Edge
:
1405 case SdrObjKind::CircleArc
:
1406 bFoundObjNoArea
= true;
1407 bFoundNoGraphicObj
= true;
1409 case SdrObjKind::OLE2
:
1410 // #i118485# #i118525# Allow Line, Area and Graphic (Metafile, Bitmap)
1411 bSingleGraphicSelected
= nMarkCount
== 1;
1412 bFoundBitmap
= true;
1413 bFoundMetafile
= true;
1415 case SdrObjKind::Graphic
:
1417 bSingleGraphicSelected
= nMarkCount
== 1;
1418 const SdrGrafObj
* pSdrGrafObj
= static_cast< const SdrGrafObj
* >(pObj
);
1420 // Current size of the OBJ_GRAF
1421 const ::tools::Rectangle aRect
= pObj
->GetLogicRect();
1422 const Size aCurrentSizeofObj
= aRect
.GetSize();
1424 // Original size of the OBJ_GRAF
1425 const Size aOriginalSizeofObj
= pSdrGrafObj
->getOriginalSize();
1427 if(aCurrentSizeofObj
== aOriginalSizeofObj
)
1428 rSet
.DisableItem(SID_ORIGINAL_SIZE
);
1430 switch(pSdrGrafObj
->GetGraphicType())
1432 case GraphicType::Bitmap
:
1433 bFoundBitmap
= true;
1434 if(pSdrGrafObj
->isEmbeddedVectorGraphicData())
1436 bFoundMetafile
= true;
1439 case GraphicType::GdiMetafile
:
1440 bFoundMetafile
= true;
1447 case SdrObjKind::Table
:
1454 else if(nInv
== SdrInventor::E3d
)
1462 rSet
.DisableItem( SID_ATTRIBUTES_LINE
);
1466 // Disable menuitem for area-dialog
1467 if( bFoundObjNoArea
) // #i25616#
1468 rSet
.DisableItem( SID_ATTRIBUTES_AREA
);
1470 if( bFoundBitmap
&& !bFoundMetafile
&& !bFoundNoGraphicObj
) // only Bitmaps marked
1471 rSet
.DisableItem( SID_CONVERT_TO_BITMAP
);
1472 else if( !bFoundBitmap
&& bFoundMetafile
&& !bFoundNoGraphicObj
) // only Metafiles marked
1473 rSet
.DisableItem( SID_CONVERT_TO_METAFILE
);
1474 else if( !bFoundBitmap
&& !bFoundMetafile
&& !bFoundNoGraphicObj
) // nothing to do
1476 rSet
.DisableItem( SID_CONVERT_TO_BITMAP
);
1477 rSet
.DisableItem( SID_CONVERT_TO_METAFILE
);
1482 if( !bSingleGraphicSelected
)
1484 rSet
.DisableItem (SID_OBJECT_CROP
);
1485 rSet
.DisableItem (SID_ATTR_GRAF_CROP
);
1488 // Menuoption: Edit->Hyperlink
1489 // Disable, if there is no hyperlink
1490 bool bDisableEditHyperlink
= ShouldDisableEditHyperlink();
1492 //highlight selected custom shape
1494 if(HasCurrentFunction())
1496 rtl::Reference
< FuPoor
> xFunc( GetCurrentFunction() );
1497 FuConstructCustomShape
* pShapeFunc
= dynamic_cast< FuConstructCustomShape
* >( xFunc
.get() );
1499 static const sal_uInt16 nCSTbArray
[] = { SID_DRAWTBX_CS_BASIC
, SID_DRAWTBX_CS_SYMBOL
,
1500 SID_DRAWTBX_CS_ARROW
, SID_DRAWTBX_CS_FLOWCHART
,
1501 SID_DRAWTBX_CS_CALLOUT
, SID_DRAWTBX_CS_STAR
};
1503 const sal_uInt16 nCurrentSId
= GetCurrentFunction()->GetSlotID();
1504 for (sal_uInt16 i
: nCSTbArray
)
1506 rSet
.ClearItem( i
); // Why is this necessary?
1507 rSet
.Put( SfxStringItem( i
, nCurrentSId
== i
&& pShapeFunc
1508 ? pShapeFunc
->GetShapeType() : OUString() ) );
1513 if ( bDisableEditHyperlink
|| GetDocSh()->IsReadOnly() )
1514 rSet
.DisableItem( SID_EDIT_HYPERLINK
);
1516 if ( bDisableEditHyperlink
)
1518 rSet
.DisableItem( SID_OPEN_HYPERLINK
);
1519 rSet
.DisableItem( SID_COPY_HYPERLINK_LOCATION
);
1522 //fdo#78151 enable show next level/hide last level if editing a master page
1523 //PresObjKind::Outline object and the current selection allow that to happen
1525 bool bDisableShowNextLevel
= true;
1526 bool bDisableHideLastLevel
= true;
1529 ::Outliner
* pOL
= GetOutlinerForMasterPageOutlineTextObj(aSel
);
1532 //and are on the last paragraph
1534 if (aSel
.end
.nPara
== pOL
->GetParagraphCount() - 1)
1536 sal_uInt16 nDepth
= pOL
->GetDepth(aSel
.end
.nPara
);
1537 if (nDepth
!= sal_uInt16(-1))
1539 //there exists another numbering level that
1540 //is currently hidden
1542 bDisableShowNextLevel
= false;
1543 //there exists a previous numbering level
1545 bDisableHideLastLevel
= false;
1550 if (bDisableShowNextLevel
)
1551 rSet
.DisableItem(SID_SHOW_NEXT_LEVEL
);
1553 if (bDisableHideLastLevel
)
1554 rSet
.DisableItem(SID_HIDE_LAST_LEVEL
);
1557 #if defined(_WIN32) || defined UNX
1558 if( !mxScannerManager
.is() )
1560 rSet
.DisableItem( SID_TWAIN_SELECT
);
1561 rSet
.DisableItem( SID_TWAIN_TRANSFER
);
1565 // Set the state of two entries in the 'Slide' context sub-menu
1566 // concerning the visibility of master page background and master page
1568 if (rSet
.GetItemState(SID_DISPLAY_MASTER_BACKGROUND
) == SfxItemState::DEFAULT
1569 || rSet
.GetItemState(SID_DISPLAY_MASTER_OBJECTS
) == SfxItemState::DEFAULT
)
1571 SdPage
* pPage
= GetActualPage();
1572 if (pPage
!= nullptr && GetDoc() != nullptr)
1574 SdrLayerIDSet aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
1575 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
1576 SdrLayerID aBackgroundId
= rLayerAdmin
.GetLayerID(sUNO_LayerName_background
);
1577 SdrLayerID aObjectId
= rLayerAdmin
.GetLayerID(sUNO_LayerName_background_objects
);
1578 rSet
.Put(SfxBoolItem(SID_DISPLAY_MASTER_BACKGROUND
,
1579 aVisibleLayers
.IsSet(aBackgroundId
)));
1580 rSet
.Put(SfxBoolItem(SID_DISPLAY_MASTER_OBJECTS
,
1581 aVisibleLayers
.IsSet(aObjectId
)));
1585 if (rSet
.GetItemState(SID_SAVE_BACKGROUND
) == SfxItemState::DEFAULT
)
1587 bool bDisableSaveBackground
= true;
1588 SdPage
* pPage
= GetActualPage();
1589 if (pPage
!= nullptr && GetDoc() != nullptr)
1591 SfxItemSetFixed
<XATTR_FILL_FIRST
, XATTR_FILL_LAST
> aMergedAttr(GetDoc()->GetPool());
1592 SdStyleSheet
* pStyleSheet
= pPage
->getPresentationStyle(HID_PSEUDOSHEET_BACKGROUND
);
1593 MergePageBackgroundFilling(pPage
, pStyleSheet
, meEditMode
== EditMode::MasterPage
, aMergedAttr
);
1594 if (drawing::FillStyle_BITMAP
== aMergedAttr
.Get(XATTR_FILLSTYLE
).GetValue())
1596 bDisableSaveBackground
= false;
1599 if (bDisableSaveBackground
)
1600 rSet
.DisableItem(SID_SAVE_BACKGROUND
);
1603 if (GetObjectShell()->isExportLocked())
1604 rSet
.DisableItem(SID_PRESENTATION_MINIMIZER
);
1606 if (rSet
.GetItemState(SID_INSERT_SIGNATURELINE
) == SfxItemState::DEFAULT
)
1608 if (!GetObjectShell()->IsSignPDF())
1610 // Currently SID_INSERT_SIGNATURELINE assumes a PDF that was opened for signing, disable
1612 rSet
.DisableItem(SID_INSERT_SIGNATURELINE
);
1616 GetModeSwitchingMenuState (rSet
);
1619 void DrawViewShell::GetModeSwitchingMenuState (SfxItemSet
&rSet
)
1622 rSet
.Put(SfxBoolItem(SID_SLIDE_SORTER_MODE
, false));
1623 rSet
.Put(SfxBoolItem(SID_OUTLINE_MODE
, false));
1624 rSet
.Put(SfxBoolItem(SID_SLIDE_MASTER_MODE
, false));
1625 rSet
.Put(SfxBoolItem(SID_NOTES_MASTER_MODE
, false));
1626 if (mePageKind
== PageKind::Notes
)
1628 rSet
.Put(SfxBoolItem(SID_DRAWINGMODE
, false));
1629 rSet
.Put(SfxBoolItem(SID_NOTES_MODE
, true));
1630 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTER_MODE
, false));
1632 else if (mePageKind
== PageKind::Handout
)
1634 rSet
.Put(SfxBoolItem(SID_DRAWINGMODE
, false));
1635 rSet
.Put(SfxBoolItem(SID_NOTES_MODE
, false));
1636 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTER_MODE
, true));
1640 rSet
.Put(SfxBoolItem(SID_DRAWINGMODE
, true));
1641 rSet
.Put(SfxBoolItem(SID_NOTES_MODE
, false));
1642 rSet
.Put(SfxBoolItem(SID_HANDOUT_MASTER_MODE
, false));
1645 // Removed [GetDocSh()->GetCurrentFunction() ||] from the following
1646 // clause because the current function of the docshell can only be
1647 // search and replace or spell checking and in that case switching the
1648 // view mode is allowed.
1649 const bool bIsRunning
= SlideShow::IsRunning(GetViewShellBase())
1650 && !SlideShow::IsInteractiveSlideshow(&GetViewShellBase()); // IASS
1652 SfxViewFrame
* pViewFrame
= GetViewFrame();
1653 const bool bIsInPlace
= pViewFrame
&& pViewFrame
->GetFrame().IsInPlace() ? true : false;
1654 if (bIsInPlace
|| bIsRunning
)
1658 rSet
.ClearItem( SID_DRAWINGMODE
);
1659 rSet
.DisableItem( SID_DRAWINGMODE
);
1662 rSet
.ClearItem( SID_NOTES_MODE
);
1663 rSet
.DisableItem( SID_NOTES_MODE
);
1665 rSet
.ClearItem( SID_HANDOUT_MASTER_MODE
);
1666 rSet
.DisableItem( SID_HANDOUT_MASTER_MODE
);
1668 rSet
.ClearItem( SID_OUTLINE_MODE
);
1669 rSet
.DisableItem( SID_OUTLINE_MODE
);
1671 rSet
.ClearItem( SID_SLIDE_MASTER_MODE
);
1672 rSet
.DisableItem( SID_SLIDE_MASTER_MODE
);
1674 rSet
.ClearItem( SID_NOTES_MASTER_MODE
);
1675 rSet
.DisableItem( SID_NOTES_MASTER_MODE
);
1677 rSet
.ClearItem( SID_SLIDE_SORTER_MODE
);
1678 rSet
.DisableItem( SID_SLIDE_SORTER_MODE
);
1681 if (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED
)
1683 // Outplace-Edit: do not allow switch
1684 rSet
.ClearItem( SID_OUTLINE_MODE
);
1685 rSet
.DisableItem( SID_OUTLINE_MODE
);
1687 rSet
.ClearItem( SID_SLIDE_SORTER_MODE
);
1688 rSet
.DisableItem( SID_SLIDE_SORTER_MODE
);
1690 rSet
.ClearItem( SID_NOTES_MODE
);
1691 rSet
.DisableItem( SID_NOTES_MODE
);
1693 rSet
.ClearItem( SID_HANDOUT_MASTER_MODE
);
1694 rSet
.DisableItem( SID_HANDOUT_MASTER_MODE
);
1696 rSet
.ClearItem( SID_SLIDE_MASTER_MODE
);
1697 rSet
.DisableItem( SID_SLIDE_MASTER_MODE
);
1699 rSet
.ClearItem( SID_NOTES_MASTER_MODE
);
1700 rSet
.DisableItem( SID_NOTES_MASTER_MODE
);
1703 svx::ExtrusionBar::getState( mpDrawView
.get(), rSet
);
1704 svx::FontworkBar::getState( mpDrawView
.get(), rSet
);
1707 void DrawViewShell::GetPageProperties( SfxItemSet
&rSet
)
1709 SdPage
*pPage
= getCurrentPage();
1711 if (pPage
== nullptr || GetDoc() == nullptr)
1714 SvxPageItem
aPageItem(SID_ATTR_PAGE
);
1715 aPageItem
.SetLandscape( pPage
->GetOrientation() == Orientation::Landscape
);
1717 rSet
.Put(SvxSizeItem( SID_ATTR_PAGE_SIZE
, pPage
->GetSize() ));
1718 rSet
.Put(aPageItem
);
1720 const SfxItemSet
&rPageAttr
= pPage
->getSdrPageProperties().GetItemSet();
1721 const XFillStyleItem
* pFillStyle
= rPageAttr
.GetItem(XATTR_FILLSTYLE
);
1725 drawing::FillStyle eXFS
= pFillStyle
->GetValue();
1726 XFillStyleItem
aFillStyleItem( eXFS
);
1727 aFillStyleItem
.SetWhich( SID_ATTR_PAGE_FILLSTYLE
);
1728 rSet
.Put(aFillStyleItem
);
1732 case drawing::FillStyle_SOLID
:
1733 if (const XFillColorItem
* pColorItem
= rPageAttr
.GetItem(XATTR_FILLCOLOR
))
1735 Color aColor
= pColorItem
->GetColorValue();
1736 XFillColorItem
aFillColorItem( OUString(), aColor
);
1737 aFillColorItem
.SetWhich( SID_ATTR_PAGE_COLOR
);
1738 rSet
.Put( aFillColorItem
);
1742 case drawing::FillStyle_GRADIENT
:
1744 const XFillGradientItem
*pGradient
= rPageAttr
.GetItem( XATTR_FILLGRADIENT
);
1745 XFillGradientItem
aFillGradientItem( pGradient
->GetName(), pGradient
->GetGradientValue(), SID_ATTR_PAGE_GRADIENT
);
1746 rSet
.Put( aFillGradientItem
);
1750 case drawing::FillStyle_HATCH
:
1752 const XFillHatchItem
*pFillHatchItem( rPageAttr
.GetItem( XATTR_FILLHATCH
) );
1753 XFillHatchItem
aFillHatchItem( pFillHatchItem
->GetName(), pFillHatchItem
->GetHatchValue());
1754 aFillHatchItem
.SetWhich( SID_ATTR_PAGE_HATCH
);
1755 rSet
.Put( aFillHatchItem
);
1759 case drawing::FillStyle_BITMAP
:
1761 const XFillBitmapItem
*pFillBitmapItem
= rPageAttr
.GetItem( XATTR_FILLBITMAP
);
1762 XFillBitmapItem
aFillBitmapItem( pFillBitmapItem
->GetName(), pFillBitmapItem
->GetGraphicObject() );
1763 aFillBitmapItem
.SetWhich( SID_ATTR_PAGE_BITMAP
);
1764 rSet
.Put( aFillBitmapItem
);
1773 void DrawViewShell::SetPageProperties (SfxRequest
& rReq
)
1775 SdPage
*pPage
= getCurrentPage();
1778 sal_uInt16 nSlotId
= rReq
.GetSlot();
1779 const SfxItemSet
*pArgs
= rReq
.GetArgs();
1783 if ( ( nSlotId
>= SID_ATTR_PAGE_COLOR
) && ( nSlotId
<= SID_ATTR_PAGE_FILLSTYLE
) )
1785 SdrPageProperties
& rPageProperties
= pPage
->getSdrPageProperties();
1786 const SfxItemSet
&aPageItemSet
= rPageProperties
.GetItemSet();
1787 SfxItemSet aTempSet
= aPageItemSet
.CloneAsValue(false, &mpDrawView
->GetModel().GetItemPool());
1788 const SfxPoolItem
* pItem
= nullptr;
1790 rPageProperties
.ClearItem(XATTR_FILLSTYLE
);
1791 rPageProperties
.ClearItem(XATTR_FILLGRADIENT
);
1792 rPageProperties
.ClearItem(XATTR_FILLHATCH
);
1793 rPageProperties
.ClearItem(XATTR_FILLBITMAP
);
1797 case SID_ATTR_PAGE_FILLSTYLE
:
1799 XFillStyleItem
aFSItem( pArgs
->Get( XATTR_FILLSTYLE
) );
1800 drawing::FillStyle eXFS
= aFSItem
.GetValue();
1802 if ( eXFS
== drawing::FillStyle_NONE
)
1803 rPageProperties
.PutItem( XFillStyleItem( eXFS
) );
1807 case SID_ATTR_PAGE_COLOR
:
1809 rPageProperties
.PutItem( XFillStyleItem( drawing::FillStyle_SOLID
) );
1810 if (const XFillColorItem
* pColorItem
= static_cast<const XFillColorItem
*>(pArgs
->GetItem(SID_ATTR_PAGE_COLOR
)))
1811 rPageProperties
.PutItem(XFillColorItem(u
""_ustr
, pColorItem
->GetColorValue()));
1813 rPageProperties
.PutItem(pArgs
->Get(XATTR_FILLCOLOR
));
1817 case SID_ATTR_PAGE_GRADIENT
:
1819 if (SfxItemState::SET
== pArgs
->GetItemState(SID_FILL_GRADIENT_JSON
, false, &pItem
))
1821 const SfxStringItem
* pJSON
= static_cast<const SfxStringItem
*>(pItem
);
1822 XFillGradientItem
aGradientItem( basegfx::BGradient::fromJSON(pJSON
->GetValue()) );
1824 // MigrateItemSet guarantees unique gradient names
1825 SfxItemSetFixed
<XATTR_FILLGRADIENT
, XATTR_FILLGRADIENT
> aMigrateSet(mpDrawView
->GetModel().GetItemPool());
1826 aMigrateSet
.Put( aGradientItem
);
1827 SdrModel::MigrateItemSet(&aMigrateSet
, &aTempSet
, mpDrawView
->GetModel());
1829 rPageProperties
.PutItem( XFillStyleItem( drawing::FillStyle_GRADIENT
) );
1830 rPageProperties
.PutItemSet( aTempSet
);
1834 XFillGradientItem
aGradientItem( pArgs
->Get( XATTR_FILLGRADIENT
) );
1836 // MigrateItemSet guarantees unique gradient names
1837 SfxItemSetFixed
<XATTR_FILLGRADIENT
, XATTR_FILLGRADIENT
> aMigrateSet(mpDrawView
->GetModel().GetItemPool());
1838 aMigrateSet
.Put( aGradientItem
);
1839 SdrModel::MigrateItemSet(&aMigrateSet
, &aTempSet
, mpDrawView
->GetModel());
1841 rPageProperties
.PutItem( XFillStyleItem( drawing::FillStyle_GRADIENT
) );
1842 rPageProperties
.PutItemSet( aTempSet
);
1847 case SID_ATTR_PAGE_HATCH
:
1849 XFillHatchItem
aHatchItem( pArgs
->Get( XATTR_FILLHATCH
) );
1850 rPageProperties
.PutItem( XFillStyleItem( drawing::FillStyle_HATCH
) );
1851 rPageProperties
.PutItem( aHatchItem
);
1855 case SID_ATTR_PAGE_BITMAP
:
1857 XFillBitmapItem
aBitmapItem( pArgs
->Get( XATTR_FILLBITMAP
) );
1858 rPageProperties
.PutItem( XFillStyleItem( drawing::FillStyle_BITMAP
) );
1859 rPageProperties
.PutItem( aBitmapItem
);
1871 PageKind ePageKind
= GetPageKind();
1872 const SfxPoolItem
* pPoolItem
= nullptr;
1873 Size
aNewSize(pPage
->GetSize());
1874 sal_Int32 nLeft
= -1, nRight
= -1, nUpper
= -1, nLower
= -1;
1875 bool bScaleAll
= true;
1876 Orientation eOrientation
= pPage
->GetOrientation();
1877 SdPage
* pMasterPage
= pPage
->IsMasterPage() ? pPage
: &static_cast<SdPage
&>(pPage
->TRG_GetMasterPage());
1878 bool bFullSize
= pMasterPage
->IsBackgroundFullSize();
1879 sal_uInt16 nPaperBin
= pPage
->GetPaperBin();
1883 case SID_ATTR_PAGE_LRSPACE
:
1884 if( pArgs
->GetItemState(SID_ATTR_PAGE_LRSPACE
,
1885 true,&pPoolItem
) == SfxItemState::SET
)
1887 nLeft
= static_cast<const SvxLongLRSpaceItem
*>(pPoolItem
)->GetLeft();
1888 nRight
= static_cast<const SvxLongLRSpaceItem
*>(pPoolItem
)->GetRight();
1891 nUpper
= pPage
->GetUpperBorder();
1892 nLower
= pPage
->GetLowerBorder();
1894 SetPageSizeAndBorder(ePageKind
, aNewSize
, nLeft
, nRight
, nUpper
, nLower
, bScaleAll
, eOrientation
, nPaperBin
, bFullSize
);
1898 case SID_ATTR_PAGE_ULSPACE
:
1899 if( pArgs
->GetItemState(SID_ATTR_PAGE_ULSPACE
,
1900 true,&pPoolItem
) == SfxItemState::SET
)
1902 nUpper
= static_cast<const SvxLongULSpaceItem
*>(pPoolItem
)->GetUpper();
1903 nLower
= static_cast<const SvxLongULSpaceItem
*>(pPoolItem
)->GetLower();
1906 nLeft
= pPage
->GetLeftBorder();
1907 nRight
= pPage
->GetRightBorder();
1909 SetPageSizeAndBorder(ePageKind
, aNewSize
, nLeft
, nRight
, nUpper
, nLower
, bScaleAll
, eOrientation
, nPaperBin
, bFullSize
);
1919 void DrawViewShell::GetState (SfxItemSet
& rSet
)
1921 // Iterate over all requested items in the set.
1922 SfxWhichIter
aIter( rSet
);
1923 sal_uInt16 nWhich
= aIter
.FirstWhich();
1928 case FID_SEARCH_NOW
:
1929 case SID_SEARCH_ITEM
:
1930 case SID_SEARCH_OPTIONS
:
1931 // Forward this request to the common (old) code of the
1933 GetDocSh()->GetState (rSet
);
1936 SAL_WARN("sd", "DrawViewShell::GetState(): can not handle which id " << nWhich
);
1939 nWhich
= aIter
.NextWhich();
1943 void DrawViewShell::Execute (SfxRequest
& rReq
)
1945 if(SlideShow::IsRunning(GetViewShellBase())
1946 && !SlideShow::IsInteractiveSlideshow(&GetViewShellBase())) // IASS
1948 // Do not execute anything during a native slide show.
1952 switch (rReq
.GetSlot())
1954 case FID_SEARCH_NOW
:
1955 // Forward this request to the common (old) code of the
1957 GetDocSh()->Execute(rReq
);
1960 case SID_SEARCH_ITEM
:
1961 // Forward this request to the common (old) code of the
1963 GetDocSh()->Execute (rReq
);
1966 case SID_SPELL_DIALOG
:
1968 SfxViewFrame
* pViewFrame
= GetViewFrame();
1969 if (rReq
.GetArgs() != nullptr)
1970 pViewFrame
->SetChildWindow (SID_SPELL_DIALOG
,
1971 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
1972 Get(SID_SPELL_DIALOG
)).GetValue());
1974 pViewFrame
->ToggleChildWindow(SID_SPELL_DIALOG
);
1976 pViewFrame
->GetBindings().Invalidate(SID_SPELL_DIALOG
);
1982 SAL_WARN("sd", "DrawViewShell::Execute(): can not handle slot " << rReq
.GetSlot());
1987 } // end of namespace sd
1989 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */