1efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5efeef26fSAndrew Rist * distributed with this work for additional information 6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10efeef26fSAndrew Rist * 11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12efeef26fSAndrew Rist * 13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14efeef26fSAndrew Rist * software distributed under the License is distributed on an 15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17efeef26fSAndrew Rist * specific language governing permissions and limitations 18efeef26fSAndrew Rist * under the License. 19efeef26fSAndrew Rist * 20efeef26fSAndrew Rist *************************************************************/ 21efeef26fSAndrew Rist 22efeef26fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sw.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <hintids.hxx> 28cdf0e10cSrcweir #include <com/sun/star/linguistic2/XThesaurus.hpp> 29cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 30cdf0e10cSrcweir #include <svl/aeitem.hxx> 31cdf0e10cSrcweir #include <svl/whiter.hxx> 32cdf0e10cSrcweir #include <svl/cjkoptions.hxx> 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 35cdf0e10cSrcweir #include <sfx2/objitem.hxx> 36cdf0e10cSrcweir #include <svl/imageitm.hxx> 37cdf0e10cSrcweir #include <svl/languageoptions.hxx> 38cdf0e10cSrcweir #include <editeng/protitem.hxx> 39cdf0e10cSrcweir #include <sfx2/linkmgr.hxx> 40cdf0e10cSrcweir #include <editeng/langitem.hxx> 41cdf0e10cSrcweir #include <editeng/brshitem.hxx> 42cdf0e10cSrcweir #include <svx/htmlmode.hxx> 43cdf0e10cSrcweir #include <editeng/unolingu.hxx> 44cdf0e10cSrcweir #include <sfx2/msgpool.hxx> 45cdf0e10cSrcweir #include <swmodule.hxx> 46cdf0e10cSrcweir #include <tox.hxx> 47cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 48cdf0e10cSrcweir #include <sfx2/app.hxx> 49cdf0e10cSrcweir #include <view.hxx> 50cdf0e10cSrcweir #include <wrtsh.hxx> 51cdf0e10cSrcweir #include <basesh.hxx> 52cdf0e10cSrcweir #include <uitool.hxx> 53cdf0e10cSrcweir #include <viewopt.hxx> 54cdf0e10cSrcweir #include <tablemgr.hxx> 55cdf0e10cSrcweir #include <pagedesc.hxx> 56cdf0e10cSrcweir #include <wview.hxx> 57cdf0e10cSrcweir #include <globdoc.hxx> 58cdf0e10cSrcweir #include <svl/stritem.hxx> 59cdf0e10cSrcweir #include <unotools/moduleoptions.hxx> 60cdf0e10cSrcweir #include <svl/visitem.hxx> 61cdf0e10cSrcweir 62cdf0e10cSrcweir #include <cmdid.h> 63cdf0e10cSrcweir 64cdf0e10cSrcweir #include <IDocumentRedlineAccess.hxx> 65cdf0e10cSrcweir 66cdf0e10cSrcweir using namespace ::com::sun::star; 67cdf0e10cSrcweir 68cdf0e10cSrcweir /*-------------------------------------------------------------------- 69cdf0e10cSrcweir Beschreibung: 70cdf0e10cSrcweir --------------------------------------------------------------------*/ 71cdf0e10cSrcweir 72cdf0e10cSrcweir void SwView::GetState(SfxItemSet &rSet) 73cdf0e10cSrcweir { 74cdf0e10cSrcweir SfxWhichIter aIter(rSet); 75cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 76cdf0e10cSrcweir sal_uInt16 eFrmType = FRMTYPE_NONE; 77cdf0e10cSrcweir int bGetFrmType = sal_False; 78cdf0e10cSrcweir sal_Bool bWeb = 0 != PTR_CAST(SwWebView, this); 79cdf0e10cSrcweir 80cdf0e10cSrcweir while(nWhich) 81cdf0e10cSrcweir { 82cdf0e10cSrcweir switch(nWhich) 83cdf0e10cSrcweir { 84cdf0e10cSrcweir case FN_EDIT_LINK_DLG: 85cdf0e10cSrcweir if( !pWrtShell->GetLinkManager().GetLinks().Count() ) 86cdf0e10cSrcweir rSet.DisableItem(nWhich); 87cdf0e10cSrcweir else if( pWrtShell->IsSelFrmMode() && 88cdf0e10cSrcweir pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT)) 89cdf0e10cSrcweir rSet.DisableItem(nWhich); 90cdf0e10cSrcweir break; 91cdf0e10cSrcweir 92cdf0e10cSrcweir case FN_INSERT_CAPTION: 93cdf0e10cSrcweir { 94cdf0e10cSrcweir // Captions gibt's fuer Grafiken, OLE-Objekte, Rahmen und Tabellen 95cdf0e10cSrcweir if( !bGetFrmType ) 96cdf0e10cSrcweir eFrmType = pWrtShell->GetFrmType(0,sal_True), bGetFrmType = sal_True; 97cdf0e10cSrcweir if (! ( ((eFrmType & FRMTYPE_FLY_ANY) && nSelectionType != nsSelectionType::SEL_DRW_TXT)|| 98cdf0e10cSrcweir nSelectionType & nsSelectionType::SEL_TBL || 99cdf0e10cSrcweir nSelectionType & nsSelectionType::SEL_DRW) ) 100cdf0e10cSrcweir rSet.DisableItem(nWhich); 101cdf0e10cSrcweir else if((pWrtShell->IsObjSelected()||pWrtShell->IsFrmSelected()) && 102cdf0e10cSrcweir (pWrtShell->IsSelObjProtected( FLYPROTECT_PARENT)|| 103cdf0e10cSrcweir pWrtShell->IsSelObjProtected( FLYPROTECT_CONTENT ))) 104cdf0e10cSrcweir rSet.DisableItem(nWhich); 105cdf0e10cSrcweir else if( pWrtShell->IsTableMode() ) 106cdf0e10cSrcweir rSet.DisableItem(nWhich); 107cdf0e10cSrcweir } 108cdf0e10cSrcweir break; 109cdf0e10cSrcweir 110cdf0e10cSrcweir case FN_EDIT_FOOTNOTE: 111cdf0e10cSrcweir { 112cdf0e10cSrcweir if( !pWrtShell->GetCurFtn() ) 113cdf0e10cSrcweir rSet.DisableItem(nWhich); 114cdf0e10cSrcweir } 115cdf0e10cSrcweir break; 116cdf0e10cSrcweir 117cdf0e10cSrcweir case FN_CHANGE_PAGENUM: 118cdf0e10cSrcweir { 119cdf0e10cSrcweir sal_uInt16 nType = pWrtShell->GetFrmType(0,sal_True); 120cdf0e10cSrcweir if( ( FRMTYPE_FLY_ANY | FRMTYPE_HEADER | FRMTYPE_FOOTER | 121cdf0e10cSrcweir FRMTYPE_FOOTNOTE | FRMTYPE_DRAWOBJ ) & nType ) 122cdf0e10cSrcweir rSet.DisableItem(nWhich); 123cdf0e10cSrcweir else 124cdf0e10cSrcweir rSet.Put(SfxUInt16Item(nWhich, pWrtShell->GetPageOffset())); 125cdf0e10cSrcweir } 126cdf0e10cSrcweir break; 127cdf0e10cSrcweir case SID_PRINTDOC: 128cdf0e10cSrcweir case SID_PRINTDOCDIRECT: 129cdf0e10cSrcweir GetSlotState( nWhich, SfxViewShell::GetInterface(), &rSet ); 130cdf0e10cSrcweir break; 131cdf0e10cSrcweir case SID_ATTR_PAGE: 132cdf0e10cSrcweir case SID_ATTR_PAGE_SIZE: 133cdf0e10cSrcweir case SID_ATTR_PAGE_PAPERBIN: 134cdf0e10cSrcweir case RES_PAPER_BIN: 135cdf0e10cSrcweir case FN_PARAM_FTN_INFO: 136cdf0e10cSrcweir { 137cdf0e10cSrcweir const sal_uInt16 nCurIdx = pWrtShell->GetCurPageDesc(); 138cdf0e10cSrcweir const SwPageDesc& rDesc = pWrtShell->GetPageDesc( nCurIdx ); 139cdf0e10cSrcweir ::PageDescToItemSet( rDesc, rSet); 140cdf0e10cSrcweir } 141cdf0e10cSrcweir break; 142cdf0e10cSrcweir case RES_BACKGROUND: 143cdf0e10cSrcweir case SID_ATTR_BRUSH: 144cdf0e10cSrcweir { 145cdf0e10cSrcweir const sal_uInt16 nCurIdx = pWrtShell->GetCurPageDesc(); 146cdf0e10cSrcweir const SwPageDesc& rDesc = pWrtShell->GetPageDesc( nCurIdx ); 147cdf0e10cSrcweir const SwFrmFmt& rMaster = rDesc.GetMaster(); 148cdf0e10cSrcweir const SvxBrushItem& rBrush = (const SvxBrushItem&) 149cdf0e10cSrcweir rMaster.GetFmtAttr(RES_BACKGROUND, sal_True); 150cdf0e10cSrcweir rSet.Put(rBrush); 151cdf0e10cSrcweir } 152cdf0e10cSrcweir break; 153cdf0e10cSrcweir case SID_CLEARHISTORY: 154cdf0e10cSrcweir { 155cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich, pWrtShell->GetLastUndoInfo(0, 0))); 156cdf0e10cSrcweir } 157cdf0e10cSrcweir break; 158cdf0e10cSrcweir case SID_UNDO: 159cdf0e10cSrcweir { 160cdf0e10cSrcweir //JP 21.07.98: Bug 53429 - die muss noch nicht vorhanden sein 161cdf0e10cSrcweir // also lasse sie mal anlegen: 162cdf0e10cSrcweir if( !pShell ) 163cdf0e10cSrcweir SelectShell(); 164cdf0e10cSrcweir 165cdf0e10cSrcweir const SfxPoolItem* pState = pShell->GetSlotState(SID_UNDO); 166cdf0e10cSrcweir if(pState) 167cdf0e10cSrcweir rSet.Put(*pState); 168cdf0e10cSrcweir else 169cdf0e10cSrcweir rSet.DisableItem(nWhich); 170cdf0e10cSrcweir } 171cdf0e10cSrcweir break; 172cdf0e10cSrcweir case FN_INSERT_CTRL: 173cdf0e10cSrcweir { 174cdf0e10cSrcweir SfxImageItem aImgItem(nWhich, bWeb ? SwView::nWebInsertCtrlState : SwView::nInsertCtrlState); 175cdf0e10cSrcweir SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( GetViewFrame() ); 176cdf0e10cSrcweir const SfxSlot* pSlot = rPool.GetSlot( aImgItem.GetValue() ); 177cdf0e10cSrcweir if(pSlot && pSlot->IsMode( SFX_SLOT_IMAGEROTATION )) 178cdf0e10cSrcweir { 179cdf0e10cSrcweir if(pWrtShell->IsInVerticalText()) 180cdf0e10cSrcweir aImgItem.SetRotation(2700); 181cdf0e10cSrcweir if(pWrtShell->IsInRightToLeftText()) 182cdf0e10cSrcweir aImgItem.SetMirrored(sal_True); 183cdf0e10cSrcweir } 184cdf0e10cSrcweir rSet.Put(aImgItem); 185cdf0e10cSrcweir } 186cdf0e10cSrcweir break; 187cdf0e10cSrcweir case FN_INSERT_OBJ_CTRL: 188cdf0e10cSrcweir if(bWeb) 189cdf0e10cSrcweir rSet.DisableItem(nWhich); 190cdf0e10cSrcweir else 191cdf0e10cSrcweir { 192cdf0e10cSrcweir SfxImageItem aImgItem(nWhich, SwView::nInsertObjectCtrlState); 193cdf0e10cSrcweir SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( GetViewFrame() ); 194cdf0e10cSrcweir const SfxSlot* pSlot = rPool.GetSlot( aImgItem.GetValue() ); 195cdf0e10cSrcweir if(pSlot && pSlot->IsMode( SFX_SLOT_IMAGEROTATION )) 196cdf0e10cSrcweir { 197cdf0e10cSrcweir if(pWrtShell->IsInVerticalText()) 198cdf0e10cSrcweir aImgItem.SetRotation(2700); 199cdf0e10cSrcweir if(pWrtShell->IsInRightToLeftText()) 200cdf0e10cSrcweir aImgItem.SetMirrored(sal_True); 201cdf0e10cSrcweir } 202cdf0e10cSrcweir rSet.Put(aImgItem); 203cdf0e10cSrcweir } 204cdf0e10cSrcweir break; 205cdf0e10cSrcweir case FN_UPDATE_TOX: 206cdf0e10cSrcweir if(!pWrtShell->GetTOXCount()) 207cdf0e10cSrcweir rSet.DisableItem(nWhich); 208cdf0e10cSrcweir break; 209cdf0e10cSrcweir case FN_EDIT_CURRENT_TOX: 210cdf0e10cSrcweir case FN_UPDATE_CUR_TOX: 211cdf0e10cSrcweir { 212cdf0e10cSrcweir const SwTOXBase* pBase = 0; 213cdf0e10cSrcweir if(0 == (pBase = pWrtShell->GetCurTOX()) || 214cdf0e10cSrcweir (FN_EDIT_CURRENT_TOX == nWhich && pBase->IsTOXBaseInReadonly())) 215cdf0e10cSrcweir rSet.DisableItem(nWhich); 216cdf0e10cSrcweir } 217cdf0e10cSrcweir break; 218cdf0e10cSrcweir case SID_TWAIN_SELECT: 219cdf0e10cSrcweir case SID_TWAIN_TRANSFER: 220cdf0e10cSrcweir #if defined WNT || defined UNX 221cdf0e10cSrcweir { 222cdf0e10cSrcweir if(!SW_MOD()->GetScannerManager().is()) 223cdf0e10cSrcweir rSet.DisableItem(nWhich); 224cdf0e10cSrcweir } 225cdf0e10cSrcweir #endif 226cdf0e10cSrcweir break; 227cdf0e10cSrcweir case RES_PARATR_TABSTOP: 228cdf0e10cSrcweir case SID_ATTR_DEFTABSTOP: 229cdf0e10cSrcweir { 230cdf0e10cSrcweir const SvxTabStopItem& rDefTabs = 231cdf0e10cSrcweir (const SvxTabStopItem&)pWrtShell-> 232cdf0e10cSrcweir GetDefault(RES_PARATR_TABSTOP); 233cdf0e10cSrcweir rSet.Put( SfxUInt16Item( nWhich, 234cdf0e10cSrcweir (sal_uInt16)::GetTabDist(rDefTabs))); 235cdf0e10cSrcweir } 236cdf0e10cSrcweir break; 237cdf0e10cSrcweir case SID_ATTR_LANGUAGE: 238cdf0e10cSrcweir { 239cdf0e10cSrcweir rSet.Put((const SvxLanguageItem&) 240cdf0e10cSrcweir pWrtShell->GetDefault(RES_CHRATR_LANGUAGE), SID_ATTR_LANGUAGE); 241cdf0e10cSrcweir } 242cdf0e10cSrcweir break; 243cdf0e10cSrcweir case RES_CHRATR_CJK_LANGUAGE: 244cdf0e10cSrcweir rSet.Put((const SvxLanguageItem&) 245cdf0e10cSrcweir pWrtShell->GetDefault(RES_CHRATR_CJK_LANGUAGE), RES_CHRATR_CJK_LANGUAGE); 246cdf0e10cSrcweir break; 247cdf0e10cSrcweir case RES_CHRATR_CTL_LANGUAGE: 248cdf0e10cSrcweir rSet.Put((const SvxLanguageItem&) 249cdf0e10cSrcweir pWrtShell->GetDefault(RES_CHRATR_CTL_LANGUAGE), RES_CHRATR_CTL_LANGUAGE); 250cdf0e10cSrcweir break; 251cdf0e10cSrcweir case FN_HYPHENATE_OPT_DLG: 252cdf0e10cSrcweir { 253cdf0e10cSrcweir sal_Bool bCheck = sal_False; 254cdf0e10cSrcweir 255cdf0e10cSrcweir if (pWrtShell->GetSelectionType() & (nsSelectionType::SEL_DRW_TXT|nsSelectionType::SEL_DRW)) 256cdf0e10cSrcweir bCheck = IsDrawTextHyphenate(); 257cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich, bCheck)); 258cdf0e10cSrcweir } 259cdf0e10cSrcweir break; 260cdf0e10cSrcweir case FN_REDLINE_ON: 261cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, GetDocShell()->IsChangeRecording() ) ); 262cdf0e10cSrcweir break; 263cdf0e10cSrcweir case FN_REDLINE_PROTECT : 264cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, GetDocShell()->HasChangeRecordProtection() ) ); 265cdf0e10cSrcweir break; 266cdf0e10cSrcweir case FN_REDLINE_SHOW: 267cdf0e10cSrcweir { 268cdf0e10cSrcweir sal_uInt16 nMask = nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE; 269cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, 270cdf0e10cSrcweir (pWrtShell->GetRedlineMode() & nMask) == nMask )); 271cdf0e10cSrcweir } 272cdf0e10cSrcweir break; 273cdf0e10cSrcweir case SID_GALLERY : 274cdf0e10cSrcweir case SID_AVMEDIA_PLAYER : 275cdf0e10cSrcweir case FN_REDLINE_ACCEPT : 276cdf0e10cSrcweir { 277cdf0e10cSrcweir SfxViewFrame* pVFrame = GetViewFrame(); 278cdf0e10cSrcweir if (pVFrame->KnowsChildWindow(nWhich)) 279cdf0e10cSrcweir rSet.Put(SfxBoolItem( nWhich, pVFrame->HasChildWindow(nWhich))); 280cdf0e10cSrcweir else 281cdf0e10cSrcweir rSet.DisableItem(nWhich); 282cdf0e10cSrcweir } 283cdf0e10cSrcweir break; 284cdf0e10cSrcweir case FN_REDLINE_ACCEPT_DIRECT: 285cdf0e10cSrcweir case FN_REDLINE_REJECT_DIRECT: 286cdf0e10cSrcweir { 287cdf0e10cSrcweir SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE ); 288cdf0e10cSrcweir Point aCrsrPos = pWrtShell->GetCrsrDocPos( sal_True ); 289cdf0e10cSrcweir if( !pWrtShell->GetContentAtPos( aCrsrPos, aCntntAtPos ) ) 290cdf0e10cSrcweir rSet.DisableItem( nWhich ); 291cdf0e10cSrcweir } 292cdf0e10cSrcweir break; 293cdf0e10cSrcweir case SID_THESAURUS: 294cdf0e10cSrcweir { 295cdf0e10cSrcweir SwWrtShell &rSh = GetWrtShell(); 296cdf0e10cSrcweir if (2 <= rSh.GetCrsrCnt()) // multi selection? 297cdf0e10cSrcweir rSet.DisableItem(nWhich); 298cdf0e10cSrcweir else 299cdf0e10cSrcweir { 300cdf0e10cSrcweir LanguageType nLang = rSh.GetCurLang(); 301cdf0e10cSrcweir 302cdf0e10cSrcweir // disable "Thesaurus" (menu entry and key shortcut) if the 303cdf0e10cSrcweir // language is not supported (by default it is enabled) 304cdf0e10cSrcweir uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); 305cdf0e10cSrcweir if (!xThes.is() || nLang == LANGUAGE_NONE || 306cdf0e10cSrcweir !xThes->hasLocale( SvxCreateLocale( nLang ) )) 307cdf0e10cSrcweir rSet.DisableItem(nWhich); 308cdf0e10cSrcweir } 309cdf0e10cSrcweir } 310cdf0e10cSrcweir break; 311cdf0e10cSrcweir case SID_HANGUL_HANJA_CONVERSION: 312cdf0e10cSrcweir case SID_CHINESE_CONVERSION: 313cdf0e10cSrcweir { 314cdf0e10cSrcweir if (!SvtCJKOptions().IsAnyEnabled()) 315cdf0e10cSrcweir { 316cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False ); 317cdf0e10cSrcweir rSet.DisableItem(nWhich); 318cdf0e10cSrcweir } 319cdf0e10cSrcweir else 320cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True ); 321cdf0e10cSrcweir } 322cdf0e10cSrcweir break; 323cdf0e10cSrcweir case SID_MAIL_SCROLLBODY_PAGEDOWN: 324cdf0e10cSrcweir { 325cdf0e10cSrcweir const long nBottom = pWrtShell->GetDocSize().Height() + DOCUMENTBORDER; 326cdf0e10cSrcweir const long nAct = GetVisArea().Bottom(); 327cdf0e10cSrcweir rSet.Put(SfxBoolItem(SID_MAIL_SCROLLBODY_PAGEDOWN, nAct < nBottom )); 328cdf0e10cSrcweir } 329cdf0e10cSrcweir break; 330cdf0e10cSrcweir 331cdf0e10cSrcweir case SID_DOCUMENT_COMPARE: 332cdf0e10cSrcweir case SID_DOCUMENT_MERGE: 333cdf0e10cSrcweir if( GetDocShell()->IsA( SwGlobalDocShell::StaticType() ) || 334cdf0e10cSrcweir // pWrtShell->IsAnySectionInDoc( sal_True, sal_True, sal_True )|| 335cdf0e10cSrcweir (SID_DOCUMENT_MERGE == nWhich && pWrtShell->getIDocumentRedlineAccess()->GetRedlinePassword().getLength())) 336cdf0e10cSrcweir rSet.DisableItem(nWhich); 337cdf0e10cSrcweir break; 338cdf0e10cSrcweir case SID_VIEW_DATA_SOURCE_BROWSER: 339cdf0e10cSrcweir if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) ) 340cdf0e10cSrcweir rSet.Put( SfxVisibilityItem( nWhich, sal_False ) ); 341cdf0e10cSrcweir else 342cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, GetViewFrame()->HasChildWindow( SID_BROWSER ) ) ); 343cdf0e10cSrcweir break; 344cdf0e10cSrcweir case SID_READONLY_MODE: 345cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich, 346cdf0e10cSrcweir pWrtShell->HasReadonlySel()||GetDocShell()->IsReadOnly())); 347cdf0e10cSrcweir break; 348cdf0e10cSrcweir case SID_IMAGE_ORIENTATION: 349cdf0e10cSrcweir { 350cdf0e10cSrcweir SfxImageItem aImageItem(nWhich); 351cdf0e10cSrcweir if(pWrtShell->IsInVerticalText()) 352cdf0e10cSrcweir aImageItem.SetRotation( 2700 ); 353cdf0e10cSrcweir if(pWrtShell->IsInRightToLeftText()) 354cdf0e10cSrcweir aImageItem.SetMirrored( sal_True ); 355cdf0e10cSrcweir rSet.Put(aImageItem); 356cdf0e10cSrcweir } 357cdf0e10cSrcweir break; 358cdf0e10cSrcweir case FN_INSERT_FIELD_DATA_ONLY : 359cdf0e10cSrcweir if(!bInMailMerge && !GetViewFrame()->HasChildWindow(nWhich)) 360cdf0e10cSrcweir rSet.DisableItem(nWhich); 361cdf0e10cSrcweir break; 362cdf0e10cSrcweir case FN_MAILMERGE_SENDMAIL_CHILDWINDOW: 363cdf0e10cSrcweir break; 364cdf0e10cSrcweir case FN_MAILMERGE_CHILDWINDOW: 365cdf0e10cSrcweir { 366cdf0e10cSrcweir if(!GetMailMergeConfigItem()) 367cdf0e10cSrcweir rSet.DisableItem(nWhich); 368cdf0e10cSrcweir } 369cdf0e10cSrcweir break; 370cdf0e10cSrcweir case SID_ALIGN_ANY_LEFT : 371cdf0e10cSrcweir case SID_ALIGN_ANY_HCENTER : 372cdf0e10cSrcweir case SID_ALIGN_ANY_RIGHT : 373cdf0e10cSrcweir case SID_ALIGN_ANY_JUSTIFIED: 374cdf0e10cSrcweir case SID_ALIGN_ANY_TOP : 375cdf0e10cSrcweir case SID_ALIGN_ANY_VCENTER : 376cdf0e10cSrcweir case SID_ALIGN_ANY_BOTTOM : 377cdf0e10cSrcweir case SID_ALIGN_ANY_HDEFAULT : 378cdf0e10cSrcweir case SID_ALIGN_ANY_VDEFAULT : 379cdf0e10cSrcweir { 380cdf0e10cSrcweir if( !pShell ) 381cdf0e10cSrcweir SelectShell(); 382cdf0e10cSrcweir sal_uInt16 nAlias = 0; 383cdf0e10cSrcweir bool bDraw = false; 384cdf0e10cSrcweir if( nSelectionType & (nsSelectionType::SEL_DRW_TXT|nsSelectionType::SEL_TXT) ) 385cdf0e10cSrcweir { 386cdf0e10cSrcweir switch( nWhich ) 387cdf0e10cSrcweir { 388cdf0e10cSrcweir case SID_ALIGN_ANY_LEFT : nAlias = SID_ATTR_PARA_ADJUST_LEFT; break; 389cdf0e10cSrcweir case SID_ALIGN_ANY_HCENTER : nAlias = SID_ATTR_PARA_ADJUST_CENTER; break; 390cdf0e10cSrcweir case SID_ALIGN_ANY_RIGHT : nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break; 391cdf0e10cSrcweir case SID_ALIGN_ANY_JUSTIFIED: nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break; 392*23257455SOliver-Rainer Wittmann case SID_ALIGN_ANY_TOP : nAlias = SID_TABLE_VERT_NONE; break; 393*23257455SOliver-Rainer Wittmann case SID_ALIGN_ANY_VCENTER : nAlias = SID_TABLE_VERT_CENTER; break; 394*23257455SOliver-Rainer Wittmann case SID_ALIGN_ANY_BOTTOM : nAlias = SID_TABLE_VERT_BOTTOM; break; 395cdf0e10cSrcweir } 396cdf0e10cSrcweir } 397cdf0e10cSrcweir else if(nSelectionType & (nsSelectionType::SEL_DRW)) 398cdf0e10cSrcweir { 399cdf0e10cSrcweir //the draw shell cannot provide a status per item - only one for SID_OBJECT_ALIGN 400cdf0e10cSrcweir if(nWhich != SID_ALIGN_ANY_JUSTIFIED) 401cdf0e10cSrcweir { 402cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 403cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->QueryState( SID_OBJECT_ALIGN, pItem ); 404cdf0e10cSrcweir if(pItem) 405cdf0e10cSrcweir bDraw = true; 406cdf0e10cSrcweir } 407cdf0e10cSrcweir } 408cdf0e10cSrcweir else 409cdf0e10cSrcweir { 410cdf0e10cSrcweir switch( nWhich ) 411cdf0e10cSrcweir { 412cdf0e10cSrcweir case SID_ALIGN_ANY_LEFT : nAlias = SID_OBJECT_ALIGN_LEFT ; break; 413cdf0e10cSrcweir case SID_ALIGN_ANY_HCENTER : nAlias = SID_OBJECT_ALIGN_CENTER ; break; 414cdf0e10cSrcweir case SID_ALIGN_ANY_RIGHT : nAlias = SID_OBJECT_ALIGN_RIGHT ; break; 415cdf0e10cSrcweir case SID_ALIGN_ANY_TOP : nAlias = SID_OBJECT_ALIGN_UP ; break; 416cdf0e10cSrcweir case SID_ALIGN_ANY_VCENTER : nAlias = SID_OBJECT_ALIGN_MIDDLE ; break; 417cdf0e10cSrcweir case SID_ALIGN_ANY_BOTTOM : nAlias = SID_OBJECT_ALIGN_DOWN ; break; 418cdf0e10cSrcweir } 419cdf0e10cSrcweir } 420cdf0e10cSrcweir //these slots are either re-mapped to text or object alignment 421cdf0e10cSrcweir const SfxPoolItem* pState = 0; 422cdf0e10cSrcweir if(nAlias) 423cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->QueryState( nAlias, pState ); 424cdf0e10cSrcweir if(pState) 425cdf0e10cSrcweir rSet.Put(*pState, nWhich); 426cdf0e10cSrcweir else if(!bDraw) 427cdf0e10cSrcweir rSet.DisableItem(nWhich); 428cdf0e10cSrcweir } 429cdf0e10cSrcweir break; 430cdf0e10cSrcweir } 431cdf0e10cSrcweir nWhich = aIter.NextWhich(); 432cdf0e10cSrcweir } 433cdf0e10cSrcweir } 434cdf0e10cSrcweir 435cdf0e10cSrcweir 436cdf0e10cSrcweir /*-------------------------------------------------------------------- 437cdf0e10cSrcweir Beschreibung: 438cdf0e10cSrcweir --------------------------------------------------------------------*/ 439cdf0e10cSrcweir 440cdf0e10cSrcweir void SwView::GetDrawState(SfxItemSet &rSet) 441cdf0e10cSrcweir { 442cdf0e10cSrcweir SfxWhichIter aIter(rSet); 443cdf0e10cSrcweir sal_Bool bWeb = 0 != PTR_CAST(SwWebView, this); 444cdf0e10cSrcweir 445cdf0e10cSrcweir for( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich; 446cdf0e10cSrcweir nWhich = aIter.NextWhich() ) 447cdf0e10cSrcweir switch(nWhich) 448cdf0e10cSrcweir { 449cdf0e10cSrcweir case SID_INSERT_DRAW: 450cdf0e10cSrcweir if ( bWeb ) 451cdf0e10cSrcweir rSet.DisableItem( nWhich ); 452cdf0e10cSrcweir else 453cdf0e10cSrcweir { 454cdf0e10cSrcweir SfxAllEnumItem aEnum(SID_INSERT_DRAW, nDrawSfxId); 455cdf0e10cSrcweir if ( !SvtLanguageOptions().IsVerticalTextEnabled() ) 456cdf0e10cSrcweir { 457cdf0e10cSrcweir aEnum.DisableValue( SID_DRAW_CAPTION_VERTICAL ); 458cdf0e10cSrcweir aEnum.DisableValue( SID_DRAW_TEXT_VERTICAL ); 459cdf0e10cSrcweir } 460cdf0e10cSrcweir rSet.Put(aEnum); 461cdf0e10cSrcweir } 462cdf0e10cSrcweir break; 463cdf0e10cSrcweir 464cdf0e10cSrcweir case SID_SHOW_HIDDEN: 465cdf0e10cSrcweir case SID_SHOW_FORMS: 466cdf0e10cSrcweir rSet.DisableItem( nWhich ); 467cdf0e10cSrcweir // rSet.Put( SfxBoolItem(nWhich,sal_True )); 468cdf0e10cSrcweir break; 469cdf0e10cSrcweir 470cdf0e10cSrcweir case SID_DRAW_TEXT_MARQUEE: 471cdf0e10cSrcweir if (::GetHtmlMode(GetDocShell()) & HTMLMODE_SOME_STYLES) 472cdf0e10cSrcweir rSet.Put( SfxBoolItem(nWhich, nDrawSfxId == nWhich)); 473cdf0e10cSrcweir else 474cdf0e10cSrcweir rSet.DisableItem(nWhich); 475cdf0e10cSrcweir break; 476cdf0e10cSrcweir case SID_OBJECT_SELECT: 477cdf0e10cSrcweir rSet.Put( SfxBoolItem(nWhich, nDrawSfxId == nWhich || 478cdf0e10cSrcweir nFormSfxId == nWhich)); 479cdf0e10cSrcweir break; 480cdf0e10cSrcweir 481cdf0e10cSrcweir case SID_FONTWORK_GALLERY_FLOATER : 482cdf0e10cSrcweir { 483cdf0e10cSrcweir if ( bWeb ) 484cdf0e10cSrcweir rSet.DisableItem( nWhich ); 485cdf0e10cSrcweir } 486cdf0e10cSrcweir break; 487cdf0e10cSrcweir 488cdf0e10cSrcweir case SID_DRAWTBX_CS_BASIC : 489cdf0e10cSrcweir case SID_DRAWTBX_CS_SYMBOL : 490cdf0e10cSrcweir case SID_DRAWTBX_CS_ARROW : 491cdf0e10cSrcweir case SID_DRAWTBX_CS_FLOWCHART : 492cdf0e10cSrcweir case SID_DRAWTBX_CS_CALLOUT : 493cdf0e10cSrcweir case SID_DRAWTBX_CS_STAR : 494cdf0e10cSrcweir { 495cdf0e10cSrcweir if ( bWeb ) 496cdf0e10cSrcweir rSet.DisableItem( nWhich ); 497cdf0e10cSrcweir else 498cdf0e10cSrcweir rSet.Put(SfxStringItem(nWhich, aCurrShapeEnumCommand[ nWhich - SID_DRAWTBX_CS_BASIC ] )); 499cdf0e10cSrcweir } 500cdf0e10cSrcweir break; 501cdf0e10cSrcweir 502cdf0e10cSrcweir } 503cdf0e10cSrcweir } 504cdf0e10cSrcweir 505cdf0e10cSrcweir /*-------------------------------------------------------------------- 506cdf0e10cSrcweir Beschreibung: 507cdf0e10cSrcweir --------------------------------------------------------------------*/ 508cdf0e10cSrcweir 509cdf0e10cSrcweir sal_Bool SwView::HasUIFeature( sal_uInt32 nFeature ) 510cdf0e10cSrcweir { 511cdf0e10cSrcweir sal_Bool bRet = sal_False; 512cdf0e10cSrcweir switch(nFeature) 513cdf0e10cSrcweir { 514cdf0e10cSrcweir case CHILDWIN_LABEL : bRet = pWrtShell->IsLabelDoc(); break; 515cdf0e10cSrcweir case CHILDWIN_MAILMERGE : bRet = 0 != GetMailMergeConfigItem(); break; 516cdf0e10cSrcweir } 517cdf0e10cSrcweir return bRet; 518cdf0e10cSrcweir } 519cdf0e10cSrcweir 520