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

Generated by: LCOV version 1.11