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