LCOV - code coverage report
Current view: top level - sd/source/ui/view - drviews7.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 326 989 33.0 %
Date: 2015-06-13 12:38:46 Functions: 6 11 54.5 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11