LCOV - code coverage report
Current view: top level - sw/source/core/uibase/uiview - viewstat.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 242 0.0 %
Date: 2014-04-14 Functions: 0 3 0.0 %
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 <hintids.hxx>
      21             : #include <com/sun/star/linguistic2/XThesaurus.hpp>
      22             : #include <com/sun/star/uno/Sequence.hxx>
      23             : #include <svl/aeitem.hxx>
      24             : #include <svl/whiter.hxx>
      25             : #include <svl/cjkoptions.hxx>
      26             : 
      27             : #include <sfx2/viewfrm.hxx>
      28             : #include <sfx2/objitem.hxx>
      29             : #include <svl/imageitm.hxx>
      30             : #include <svl/languageoptions.hxx>
      31             : #include <editeng/protitem.hxx>
      32             : #include <sfx2/linkmgr.hxx>
      33             : #include <editeng/langitem.hxx>
      34             : #include <editeng/brushitem.hxx>
      35             : #include <sfx2/htmlmode.hxx>
      36             : #include <editeng/unolingu.hxx>
      37             : #include <sfx2/msgpool.hxx>
      38             : #include <swmodule.hxx>
      39             : #include <tox.hxx>
      40             : #include <sfx2/dispatch.hxx>
      41             : #include <sfx2/app.hxx>
      42             : #include <view.hxx>
      43             : #include <wrtsh.hxx>
      44             : #include <basesh.hxx>
      45             : #include <uitool.hxx>
      46             : #include <viewopt.hxx>
      47             : #include <tablemgr.hxx>
      48             : #include <pagedesc.hxx>
      49             : #include <wview.hxx>
      50             : #include <globdoc.hxx>
      51             : #include <svl/stritem.hxx>
      52             : #include <unotools/moduleoptions.hxx>
      53             : #include <svl/visitem.hxx>
      54             : 
      55             : #include <cmdid.h>
      56             : 
      57             : #include <IDocumentRedlineAccess.hxx>
      58             : #include <doc.hxx>
      59             : 
      60             : using namespace ::com::sun::star;
      61             : 
      62           0 : void SwView::GetState(SfxItemSet &rSet)
      63             : {
      64           0 :     SfxWhichIter aIter(rSet);
      65           0 :     sal_uInt16 nWhich = aIter.FirstWhich();
      66           0 :     sal_uInt16 eFrmType = FRMTYPE_NONE;
      67           0 :     int bGetFrmType = sal_False;
      68           0 :     bool bWeb = 0 != PTR_CAST(SwWebView, this);
      69             : 
      70           0 :     while(nWhich)
      71             :     {
      72           0 :         switch(nWhich)
      73             :         {
      74             :         case FN_EDIT_LINK_DLG:
      75           0 :             if( m_pWrtShell->GetLinkManager().GetLinks().empty() )
      76           0 :                 rSet.DisableItem(nWhich);
      77           0 :             else if( m_pWrtShell->IsSelFrmMode() &&
      78           0 :                 m_pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT))
      79             :             {
      80           0 :                 rSet.DisableItem(nWhich);
      81             :             }
      82           0 :             break;
      83             : 
      84             :         case SID_INSERT_GRAPHIC:
      85           0 :             if( m_pWrtShell->CrsrInsideInputFld() )
      86             :             {
      87           0 :                 rSet.DisableItem(nWhich);
      88             :             }
      89           0 :             break;
      90             : 
      91             :             case FN_INSERT_CAPTION:
      92             :                 {
      93             :                     // There are captions for graphics, OLE objects, frames and tables
      94           0 :                     if( !bGetFrmType )
      95           0 :                         eFrmType = m_pWrtShell->GetFrmType(0,sal_True), bGetFrmType = sal_True;
      96           0 :                     if (! ( ((eFrmType & FRMTYPE_FLY_ANY) && m_nSelectionType != nsSelectionType::SEL_DRW_TXT)||
      97           0 :                         m_nSelectionType & nsSelectionType::SEL_TBL ||
      98           0 :                         m_nSelectionType & nsSelectionType::SEL_DRW) )
      99             :                     {
     100           0 :                         rSet.DisableItem(nWhich);
     101             :                     }
     102           0 :                     else if((m_pWrtShell->IsObjSelected() || m_pWrtShell->IsFrmSelected()) &&
     103           0 :                         (m_pWrtShell->IsSelObjProtected( FLYPROTECT_PARENT)||
     104           0 :                         m_pWrtShell->IsSelObjProtected( FLYPROTECT_CONTENT )))
     105             :                     {
     106           0 :                         rSet.DisableItem(nWhich);
     107             :                     }
     108           0 :                     else if( m_pWrtShell->IsTableMode()
     109           0 :                         || m_pWrtShell->CrsrInsideInputFld() )
     110             :                     {
     111           0 :                         rSet.DisableItem(nWhich);
     112             :                     }
     113             :                 }
     114           0 :                 break;
     115             : 
     116             :             case FN_EDIT_FOOTNOTE:
     117             :             {
     118           0 :                 if( !m_pWrtShell->GetCurFtn() )
     119           0 :                     rSet.DisableItem(nWhich);
     120             :             }
     121           0 :             break;
     122             : 
     123             :             case FN_CHANGE_PAGENUM:
     124             :             {
     125           0 :                 sal_uInt16 nType = m_pWrtShell->GetFrmType(0,sal_True);
     126           0 :                 if( ( FRMTYPE_FLY_ANY | FRMTYPE_HEADER | FRMTYPE_FOOTER |
     127           0 :                       FRMTYPE_FOOTNOTE | FRMTYPE_DRAWOBJ ) & nType )
     128           0 :                     rSet.DisableItem(nWhich);
     129             :                 else
     130           0 :                     rSet.Put(SfxUInt16Item(nWhich, m_pWrtShell->GetPageOffset()));
     131             :             }
     132           0 :             break;
     133             :             case SID_PRINTDOC:
     134             :             case SID_PRINTDOCDIRECT:
     135           0 :                 GetSlotState( nWhich, SfxViewShell::GetInterface(), &rSet );
     136           0 :             break;
     137             :             case SID_ATTR_PAGE:
     138             :             case SID_ATTR_PAGE_SIZE:
     139             :             case SID_ATTR_PAGE_PAPERBIN:
     140             :             case RES_PAPER_BIN:
     141             :             case FN_PARAM_FTN_INFO:
     142             :             {
     143           0 :                 const sal_uInt16 nCurIdx = m_pWrtShell->GetCurPageDesc();
     144           0 :                 const SwPageDesc& rDesc = m_pWrtShell->GetPageDesc( nCurIdx );
     145           0 :                 ::PageDescToItemSet( rDesc, rSet);
     146             :             }
     147           0 :             break;
     148             :             case RES_BACKGROUND:
     149             :             case SID_ATTR_BRUSH:
     150             :             {
     151           0 :                 const sal_uInt16 nCurIdx = m_pWrtShell->GetCurPageDesc();
     152           0 :                 const SwPageDesc& rDesc = m_pWrtShell->GetPageDesc( nCurIdx );
     153           0 :                 const SwFrmFmt& rMaster = rDesc.GetMaster();
     154             :                 const SvxBrushItem& rBrush = (const SvxBrushItem&)
     155           0 :                                     rMaster.GetFmtAttr(RES_BACKGROUND, sal_True);
     156           0 :                 rSet.Put(rBrush);
     157             :             }
     158           0 :             break;
     159             :             case SID_CLEARHISTORY:
     160             :             {
     161           0 :                 rSet.Put(SfxBoolItem(nWhich, m_pWrtShell->GetLastUndoInfo(0, 0)));
     162             :             }
     163           0 :             break;
     164             :             case SID_UNDO:
     165             :             {
     166             :                 // which must not be present, so let them create:
     167           0 :                 if( !m_pShell )
     168           0 :                     SelectShell();
     169             : 
     170           0 :                 const SfxPoolItem* pState = m_pShell->GetSlotState(SID_UNDO);
     171           0 :                 if(pState)
     172           0 :                     rSet.Put(*pState);
     173             :                 else
     174           0 :                     rSet.DisableItem(nWhich);
     175             :             }
     176           0 :             break;
     177             :             case FN_INSERT_CTRL:
     178             :             {
     179           0 :                 SfxImageItem aImgItem(nWhich, bWeb ? SwView::m_nWebInsertCtrlState : SwView::m_nInsertCtrlState);
     180           0 :                 SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( GetViewFrame() );
     181           0 :                 const SfxSlot* pSlot = rPool.GetSlot( aImgItem.GetValue() );
     182           0 :                 if(pSlot && pSlot->IsMode( SFX_SLOT_IMAGEROTATION ))
     183             :                 {
     184           0 :                     if(m_pWrtShell->IsInVerticalText())
     185           0 :                         aImgItem.SetRotation(2700);
     186           0 :                     if(m_pWrtShell->IsInRightToLeftText())
     187           0 :                         aImgItem.SetMirrored(true);
     188             :                 }
     189           0 :                 rSet.Put(aImgItem);
     190             :             }
     191           0 :             break;
     192             : 
     193             :             case FN_INSERT_OBJ_CTRL:
     194           0 :                 if( bWeb
     195           0 :                     || m_pWrtShell->CrsrInsideInputFld() )
     196             :                 {
     197           0 :                     rSet.DisableItem(nWhich);
     198             :                 }
     199             :                 else
     200             :                 {
     201           0 :                     SfxImageItem aImgItem(nWhich, SwView::m_nInsertObjectCtrlState);
     202           0 :                     SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( GetViewFrame() );
     203           0 :                     const SfxSlot* pSlot = rPool.GetSlot( aImgItem.GetValue() );
     204           0 :                     if(pSlot && pSlot->IsMode( SFX_SLOT_IMAGEROTATION ))
     205             :                     {
     206           0 :                         if (m_pWrtShell->IsInVerticalText())
     207           0 :                             aImgItem.SetRotation(2700);
     208           0 :                         if (m_pWrtShell->IsInRightToLeftText())
     209           0 :                             aImgItem.SetMirrored(true);
     210             :                     }
     211           0 :                     rSet.Put(aImgItem);
     212             :                 }
     213           0 :                 break;
     214             : 
     215             :             case FN_UPDATE_TOX:
     216           0 :                 if(!m_pWrtShell->GetTOXCount())
     217           0 :                     rSet.DisableItem(nWhich);
     218           0 :             break;
     219             :             case FN_EDIT_CURRENT_TOX:
     220             :             case FN_UPDATE_CUR_TOX:
     221             :             {
     222           0 :                 const SwTOXBase* pBase = 0;
     223           0 :                 if(0 == (pBase = m_pWrtShell->GetCurTOX()) ||
     224           0 :                     (FN_EDIT_CURRENT_TOX == nWhich && pBase->IsTOXBaseInReadonly()))
     225           0 :                     rSet.DisableItem(nWhich);
     226             :             }
     227           0 :             break;
     228             :             case SID_TWAIN_SELECT:
     229             :             case SID_TWAIN_TRANSFER:
     230             : #if defined WNT || defined UNX
     231             :             {
     232           0 :                 if(!SW_MOD()->GetScannerManager().is())
     233           0 :                     rSet.DisableItem(nWhich);
     234             :             }
     235             : #endif
     236           0 :             break;
     237             :             case RES_PARATR_TABSTOP:
     238             :             case SID_ATTR_DEFTABSTOP:
     239             :             {
     240             :                 const SvxTabStopItem& rDefTabs =
     241             :                     (const SvxTabStopItem&)m_pWrtShell->
     242           0 :                                         GetDefault(RES_PARATR_TABSTOP);
     243             :                 rSet.Put( SfxUInt16Item( nWhich,
     244           0 :                                                 (sal_uInt16)::GetTabDist(rDefTabs)));
     245             :             }
     246           0 :             break;
     247             :             case SID_ATTR_LANGUAGE:
     248             :             {
     249             :                 rSet.Put((const SvxLanguageItem&)
     250           0 :                     m_pWrtShell->GetDefault(RES_CHRATR_LANGUAGE), SID_ATTR_LANGUAGE);
     251             :             }
     252           0 :             break;
     253             :             case RES_CHRATR_CJK_LANGUAGE:
     254             :                 rSet.Put((const SvxLanguageItem&)
     255           0 :                     m_pWrtShell->GetDefault(RES_CHRATR_CJK_LANGUAGE), RES_CHRATR_CJK_LANGUAGE);
     256           0 :             break;
     257             :             case RES_CHRATR_CTL_LANGUAGE:
     258             :                 rSet.Put((const SvxLanguageItem&)
     259           0 :                     m_pWrtShell->GetDefault(RES_CHRATR_CTL_LANGUAGE), RES_CHRATR_CTL_LANGUAGE);
     260           0 :             break;
     261             :             case FN_REDLINE_ON:
     262           0 :                 rSet.Put( SfxBoolItem( nWhich, GetDocShell()->IsChangeRecording() ) );
     263           0 :             break;
     264             :             case FN_REDLINE_PROTECT :
     265           0 :                 rSet.Put( SfxBoolItem( nWhich, GetDocShell()->HasChangeRecordProtection() ) );
     266           0 :             break;
     267             :             case FN_REDLINE_SHOW:
     268             :             {
     269           0 :                 sal_uInt16 nMask = nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE;
     270             :                 rSet.Put( SfxBoolItem( nWhich,
     271           0 :                     (m_pWrtShell->GetRedlineMode() & nMask) == nMask ));
     272             :             }
     273           0 :             break;
     274             :             case SID_GALLERY :
     275             :             case SID_AVMEDIA_PLAYER :
     276             :             case FN_REDLINE_ACCEPT :
     277             :             {
     278           0 :                 SfxViewFrame* pVFrame = GetViewFrame();
     279           0 :                 if (pVFrame->KnowsChildWindow(nWhich))
     280           0 :                     rSet.Put(SfxBoolItem( nWhich, pVFrame->HasChildWindow(nWhich)));
     281             :                 else
     282           0 :                     rSet.DisableItem(nWhich);
     283             :             }
     284           0 :             break;
     285             :             case FN_REDLINE_ACCEPT_DIRECT:
     286             :             case FN_REDLINE_REJECT_DIRECT:
     287             :             {
     288             :                 // If the selection/cursor start position isn't on a redline, disable
     289             :                 // accepting/rejecting changes.
     290           0 :                 SwDoc *pDoc = m_pWrtShell->GetDoc();
     291           0 :                 SwPaM *pCursor = m_pWrtShell->GetCrsr();
     292           0 :                 if (0 == pDoc->GetRedline(*pCursor->Start(), 0))
     293           0 :                     rSet.DisableItem(nWhich);
     294           0 :                 if (GetDocShell()->HasChangeRecordProtection())
     295           0 :                     rSet.DisableItem(nWhich);
     296             :             }
     297           0 :             break;
     298             : 
     299             :             case FN_REDLINE_NEXT_CHANGE:
     300             :             case FN_REDLINE_PREV_CHANGE:
     301             :             {
     302             :                 // Enable change navigation if we have any redlines. Ideally we should disable
     303             :                 // "Next Change" if we're at or past the last change, and similarly for
     304             :                 // "Previous Change"
     305           0 :                 if (0 == m_pWrtShell->GetRedlineCount())
     306           0 :                     rSet.DisableItem(nWhich);
     307             :             }
     308           0 :             break;
     309             : 
     310             :             case SID_THESAURUS:
     311             :             {
     312           0 :                 SwWrtShell  &rSh = GetWrtShell();
     313           0 :                 if (2 <= rSh.GetCrsrCnt())  // multi selection?
     314           0 :                     rSet.DisableItem(nWhich);
     315             :                 else
     316             :                 {
     317           0 :                     LanguageType nLang = rSh.GetCurLang();
     318             : 
     319             :                     // disable "Thesaurus" (menu entry and key shortcut) if the
     320             :                     // language is not supported (by default it is enabled)
     321           0 :                     uno::Reference< linguistic2::XThesaurus >  xThes( ::GetThesaurus() );
     322           0 :                     if (!xThes.is() || nLang == LANGUAGE_NONE ||
     323           0 :                         !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) ))
     324           0 :                         rSet.DisableItem(nWhich);
     325             :                 }
     326             :             }
     327           0 :             break;
     328             :             case SID_HANGUL_HANJA_CONVERSION:
     329             :             case SID_CHINESE_CONVERSION:
     330             :             {
     331           0 :                 if (!SvtCJKOptions().IsAnyEnabled())
     332             :                 {
     333           0 :                     GetViewFrame()->GetBindings().SetVisibleState( nWhich, false );
     334           0 :                     rSet.DisableItem(nWhich);
     335             :                 }
     336             :                 else
     337           0 :                     GetViewFrame()->GetBindings().SetVisibleState( nWhich, true );
     338             :             }
     339           0 :             break;
     340             :             case SID_MAIL_SCROLLBODY_PAGEDOWN:
     341             :                 {
     342           0 :                     const long nBottom = m_pWrtShell->GetDocSize().Height() + DOCUMENTBORDER;
     343           0 :                     const long nAct = GetVisArea().Bottom();
     344           0 :                     rSet.Put(SfxBoolItem(SID_MAIL_SCROLLBODY_PAGEDOWN, nAct < nBottom ));
     345             :                 }
     346           0 :                 break;
     347             : 
     348             :             case SID_DOCUMENT_COMPARE:
     349             :             case SID_DOCUMENT_MERGE:
     350           0 :                 if( GetDocShell()->IsA( SwGlobalDocShell::StaticType() ) ||
     351           0 :                     (SID_DOCUMENT_MERGE == nWhich && m_pWrtShell->getIDocumentRedlineAccess()->GetRedlinePassword().getLength()))
     352           0 :                     rSet.DisableItem(nWhich);
     353           0 :             break;
     354             :             case  SID_VIEW_DATA_SOURCE_BROWSER:
     355           0 :                 if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
     356           0 :                     rSet.Put( SfxVisibilityItem( nWhich, false ) );
     357             :                 else
     358           0 :                     rSet.Put( SfxBoolItem( nWhich, GetViewFrame()->HasChildWindow( SID_BROWSER ) ) );
     359           0 :             break;
     360             :             case SID_READONLY_MODE:
     361             :                 rSet.Put(SfxBoolItem(nWhich,
     362           0 :                     m_pWrtShell->HasReadonlySel()||GetDocShell()->IsReadOnly()));
     363           0 :             break;
     364             :             case SID_IMAGE_ORIENTATION:
     365             :             {
     366           0 :                 SfxImageItem aImageItem(nWhich);
     367           0 :                 if(m_pWrtShell->IsInVerticalText())
     368           0 :                     aImageItem.SetRotation( 2700 );
     369           0 :                 if(m_pWrtShell->IsInRightToLeftText())
     370           0 :                     aImageItem.SetMirrored( true );
     371           0 :                 rSet.Put(aImageItem);
     372             :             }
     373           0 :             break;
     374             :             case FN_INSERT_FIELD_DATA_ONLY :
     375           0 :                 if(!m_bInMailMerge && !GetViewFrame()->HasChildWindow(nWhich))
     376           0 :                     rSet.DisableItem(nWhich);
     377           0 :             break;
     378             :             case FN_MAILMERGE_SENDMAIL_CHILDWINDOW:
     379           0 :             break;
     380             :             case FN_MAILMERGE_CHILDWINDOW:
     381             :             {
     382           0 :                 if(!GetMailMergeConfigItem())
     383           0 :                     rSet.DisableItem(nWhich);
     384             :             }
     385           0 :             break;
     386             :             case SID_ALIGN_ANY_LEFT :
     387             :             case SID_ALIGN_ANY_HCENTER  :
     388             :             case SID_ALIGN_ANY_RIGHT    :
     389             :             case SID_ALIGN_ANY_JUSTIFIED:
     390             :             case SID_ALIGN_ANY_TOP      :
     391             :             case SID_ALIGN_ANY_VCENTER  :
     392             :             case SID_ALIGN_ANY_BOTTOM   :
     393             :             case SID_ALIGN_ANY_HDEFAULT :
     394             :             case SID_ALIGN_ANY_VDEFAULT :
     395             :             {
     396           0 :                 if( !m_pShell )
     397           0 :                     SelectShell();
     398           0 :                 sal_uInt16 nAlias = 0;
     399           0 :                 bool bDraw = false;
     400           0 :                 if( m_nSelectionType & (nsSelectionType::SEL_DRW_TXT|nsSelectionType::SEL_TXT) )
     401             :                 {
     402           0 :                     switch( nWhich )
     403             :                     {
     404           0 :                         case SID_ALIGN_ANY_LEFT :       nAlias = SID_ATTR_PARA_ADJUST_LEFT; break;
     405           0 :                         case SID_ALIGN_ANY_HCENTER  :   nAlias = SID_ATTR_PARA_ADJUST_CENTER; break;
     406           0 :                         case SID_ALIGN_ANY_RIGHT    :   nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break;
     407           0 :                         case SID_ALIGN_ANY_JUSTIFIED:   nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break;
     408           0 :                         case SID_ALIGN_ANY_TOP      :   nAlias = SID_TABLE_VERT_NONE; break;
     409           0 :                         case SID_ALIGN_ANY_VCENTER  :   nAlias = SID_TABLE_VERT_CENTER; break;
     410           0 :                         case SID_ALIGN_ANY_BOTTOM   :   nAlias = SID_TABLE_VERT_BOTTOM; break;
     411             :                     }
     412             :                 }
     413           0 :                 else if(m_nSelectionType & (nsSelectionType::SEL_DRW))
     414             :                 {
     415             :                     //the draw shell cannot provide a status per item - only one for SID_OBJECT_ALIGN
     416           0 :                     if(nWhich != SID_ALIGN_ANY_JUSTIFIED)
     417             :                     {
     418           0 :                         const SfxPoolItem* pItem = 0;
     419           0 :                         GetViewFrame()->GetDispatcher()->QueryState( SID_OBJECT_ALIGN, pItem );
     420           0 :                         if(pItem)
     421           0 :                             bDraw = true;
     422             :                     }
     423             :                 }
     424             :                 else
     425             :                 {
     426           0 :                     switch( nWhich )
     427             :                     {
     428           0 :                         case SID_ALIGN_ANY_LEFT :       nAlias = SID_OBJECT_ALIGN_LEFT    ; break;
     429           0 :                         case SID_ALIGN_ANY_HCENTER  :   nAlias = SID_OBJECT_ALIGN_CENTER ; break;
     430           0 :                         case SID_ALIGN_ANY_RIGHT    :   nAlias = SID_OBJECT_ALIGN_RIGHT  ; break;
     431           0 :                         case SID_ALIGN_ANY_TOP      :   nAlias = SID_OBJECT_ALIGN_UP     ;  break;
     432           0 :                         case SID_ALIGN_ANY_VCENTER  :   nAlias = SID_OBJECT_ALIGN_MIDDLE ;  break;
     433           0 :                         case SID_ALIGN_ANY_BOTTOM   :   nAlias = SID_OBJECT_ALIGN_DOWN    ; break;
     434             :                     }
     435             :                 }
     436             :                 //these slots are either re-mapped to text or object alignment
     437           0 :                 const SfxPoolItem* pState = 0;
     438           0 :                 if(nAlias)
     439           0 :                     GetViewFrame()->GetDispatcher()->QueryState( nAlias, pState );
     440           0 :                 if(pState)
     441           0 :                     rSet.Put(*pState, nWhich);
     442           0 :                 else if(!bDraw)
     443           0 :                     rSet.DisableItem(nWhich);
     444             :             }
     445           0 :             break;
     446             :         }
     447           0 :         nWhich = aIter.NextWhich();
     448           0 :     }
     449           0 : }
     450             : 
     451           0 : void SwView::GetDrawState(SfxItemSet &rSet)
     452             : {
     453           0 :     SfxWhichIter aIter(rSet);
     454           0 :     bool bWeb = 0 != PTR_CAST(SwWebView, this);
     455             : 
     456           0 :     for( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich;
     457             :                                             nWhich = aIter.NextWhich() )
     458           0 :         switch(nWhich)
     459             :         {
     460             :         case SID_INSERT_DRAW:
     461           0 :             if ( bWeb )
     462           0 :                 rSet.DisableItem( nWhich );
     463             :             else
     464             :             {
     465           0 :                 SfxAllEnumItem aEnum(SID_INSERT_DRAW, m_nDrawSfxId);
     466           0 :                 if ( !SvtLanguageOptions().IsVerticalTextEnabled() )
     467             :                 {
     468           0 :                     aEnum.DisableValue( SID_DRAW_CAPTION_VERTICAL );
     469           0 :                     aEnum.DisableValue( SID_DRAW_TEXT_VERTICAL );
     470             :                 }
     471           0 :                 rSet.Put(aEnum);
     472             :             }
     473           0 :             break;
     474             : 
     475             :         case SID_SHOW_HIDDEN:
     476             :         case SID_SHOW_FORMS:
     477           0 :             rSet.DisableItem( nWhich );
     478           0 :             break;
     479             : 
     480             :         case SID_DRAW_TEXT_MARQUEE:
     481           0 :             if (::GetHtmlMode(GetDocShell()) & HTMLMODE_SOME_STYLES)
     482           0 :                 rSet.Put( SfxBoolItem(nWhich, m_nDrawSfxId == nWhich));
     483             :             else
     484           0 :                 rSet.DisableItem(nWhich);
     485           0 :             break;
     486             :         case SID_OBJECT_SELECT:
     487           0 :             rSet.Put( SfxBoolItem(nWhich, m_nDrawSfxId == nWhich ||
     488           0 :                                           m_nFormSfxId == nWhich));
     489           0 :             break;
     490             : 
     491             :         case SID_FONTWORK_GALLERY_FLOATER :
     492             :         {
     493           0 :             if ( bWeb )
     494           0 :                 rSet.DisableItem( nWhich );
     495             :         }
     496           0 :         break;
     497             : 
     498             :         case SID_DRAWTBX_CS_BASIC :
     499             :         case SID_DRAWTBX_CS_SYMBOL :
     500             :         case SID_DRAWTBX_CS_ARROW :
     501             :         case SID_DRAWTBX_CS_FLOWCHART :
     502             :         case SID_DRAWTBX_CS_CALLOUT :
     503             :         case SID_DRAWTBX_CS_STAR :
     504             :         {
     505           0 :             if ( bWeb )
     506           0 :                 rSet.DisableItem( nWhich );
     507             :             else
     508           0 :                 rSet.Put(SfxStringItem(nWhich, m_aCurrShapeEnumCommand[ nWhich - SID_DRAWTBX_CS_BASIC ] ));
     509             :         }
     510           0 :         break;
     511             : 
     512           0 :         }
     513           0 : }
     514             : 
     515           0 : bool SwView::HasUIFeature( sal_uInt32 nFeature )
     516             : {
     517           0 :     bool bRet = false;
     518           0 :     switch(nFeature)
     519             :     {
     520           0 :         case CHILDWIN_LABEL     : bRet = m_pWrtShell->IsLabelDoc(); break;
     521           0 :         case CHILDWIN_MAILMERGE : bRet = 0 != GetMailMergeConfigItem(); break;
     522             :     }
     523           0 :     return bRet;
     524             : }
     525             : 
     526             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10