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

Generated by: LCOV version 1.10