1*efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*efeef26fSAndrew Rist * distributed with this work for additional information 6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*efeef26fSAndrew Rist * software distributed under the License is distributed on an 15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17*efeef26fSAndrew Rist * specific language governing permissions and limitations 18*efeef26fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*efeef26fSAndrew Rist *************************************************************/ 21*efeef26fSAndrew Rist 22*efeef26fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sw.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "hintids.hxx" 30cdf0e10cSrcweir #include <vcl/graph.hxx> 31cdf0e10cSrcweir #include <svx/galbrws.hxx> 32cdf0e10cSrcweir #include <svl/srchitem.hxx> 33cdf0e10cSrcweir #include <SwSpellDialogChildWindow.hxx> 34cdf0e10cSrcweir #include <svl/eitem.hxx> 35cdf0e10cSrcweir #include <unotools/linguprops.hxx> 36cdf0e10cSrcweir #include <unotools/lingucfg.hxx> 37cdf0e10cSrcweir #include <viewopt.hxx> 38cdf0e10cSrcweir #include <globals.h> 39cdf0e10cSrcweir #include <sfx2/app.hxx> 40cdf0e10cSrcweir #include <sfx2/request.hxx> 41cdf0e10cSrcweir #include <svl/whiter.hxx> 42cdf0e10cSrcweir #include <svx/srchdlg.hxx> 43cdf0e10cSrcweir #include <sfx2/templdlg.hxx> 44cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 45cdf0e10cSrcweir #include <sfx2/bindings.hxx> 46cdf0e10cSrcweir #include <uivwimp.hxx> 47cdf0e10cSrcweir #include <avmedia/mediaplayer.hxx> 48cdf0e10cSrcweir //#include <swlinguconfig.hxx> 49cdf0e10cSrcweir #include <swmodule.hxx> 50cdf0e10cSrcweir 51cdf0e10cSrcweir #include <sfx2/objface.hxx> 52cdf0e10cSrcweir #include <navipi.hxx> 53cdf0e10cSrcweir #include <wrtsh.hxx> 54cdf0e10cSrcweir #include <edtwin.hxx> 55cdf0e10cSrcweir #include "view.hxx" 56cdf0e10cSrcweir #include "basesh.hxx" 57cdf0e10cSrcweir #include "docsh.hxx" 58cdf0e10cSrcweir #include "doc.hxx" 59cdf0e10cSrcweir #include "globals.hrc" 60cdf0e10cSrcweir #include "cmdid.h" // FN_ ... 61cdf0e10cSrcweir #include "globdoc.hxx" 62cdf0e10cSrcweir #include "wview.hxx" 63cdf0e10cSrcweir #include "shells.hrc" 64cdf0e10cSrcweir 65cdf0e10cSrcweir #define OLEObjects 66cdf0e10cSrcweir #define SwView 67cdf0e10cSrcweir #define Frames 68cdf0e10cSrcweir #define Graphics 69cdf0e10cSrcweir #define Tables 70cdf0e10cSrcweir #define Controls 71cdf0e10cSrcweir #define GlobalContents 72cdf0e10cSrcweir #define Text 73cdf0e10cSrcweir #define Frame 74cdf0e10cSrcweir #define Graphic 75cdf0e10cSrcweir #define Object 76cdf0e10cSrcweir #define Draw 77cdf0e10cSrcweir #define TextDrawText 78cdf0e10cSrcweir #define TextInTable 79cdf0e10cSrcweir #define ListInText 80cdf0e10cSrcweir #define ListInTable 81cdf0e10cSrcweir #define WebTextInTable 82cdf0e10cSrcweir #define WebListInText 83cdf0e10cSrcweir #define WebListInTable 84cdf0e10cSrcweir #define TextPage 85cdf0e10cSrcweir #include <sfx2/msg.hxx> 86cdf0e10cSrcweir #include "swslots.hxx" 87cdf0e10cSrcweir #include <PostItMgr.hxx> 88cdf0e10cSrcweir 89cdf0e10cSrcweir 90cdf0e10cSrcweir using namespace ::com::sun::star; 91cdf0e10cSrcweir using ::rtl::OUString; 92cdf0e10cSrcweir 93cdf0e10cSrcweir #include <unotools/moduleoptions.hxx> 94cdf0e10cSrcweir 95cdf0e10cSrcweir #include <IDocumentSettingAccess.hxx> 96cdf0e10cSrcweir 97cdf0e10cSrcweir #include <unomid.h> 98cdf0e10cSrcweir 99cdf0e10cSrcweir SFX_IMPL_NAMED_VIEWFACTORY(SwView, "Default") 100cdf0e10cSrcweir { 101cdf0e10cSrcweir if ( SvtModuleOptions().IsWriter() ) 102cdf0e10cSrcweir { 103cdf0e10cSrcweir SFX_VIEW_REGISTRATION(SwDocShell); 104cdf0e10cSrcweir SFX_VIEW_REGISTRATION(SwGlobalDocShell); 105cdf0e10cSrcweir } 106cdf0e10cSrcweir } 107cdf0e10cSrcweir 108cdf0e10cSrcweir SFX_IMPL_INTERFACE( SwView, SfxViewShell, SW_RES(RID_TOOLS_TOOLBOX) ) 109cdf0e10cSrcweir { 110cdf0e10cSrcweir SFX_CHILDWINDOW_CONTEXT_REGISTRATION(SID_NAVIGATOR); 111cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(SID_TASKPANE); 112cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(SfxTemplateDialogWrapper::GetChildWindowId()); 113cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(SvxSearchDialogWrapper::GetChildWindowId()); 114cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(SwSpellDialogChildWindow::GetChildWindowId()); 115cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(FN_REDLINE_ACCEPT); 116cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(SID_HYPERLINK_DIALOG); 117cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(GalleryChildWindow::GetChildWindowId()); 118cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(::avmedia::MediaPlayer::GetChildWindowId()); 119cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_FIELD_DATA_ONLY); 120cdf0e10cSrcweir SFX_FEATURED_CHILDWINDOW_REGISTRATION(FN_SYNC_LABELS, CHILDWIN_LABEL ); 121cdf0e10cSrcweir SFX_FEATURED_CHILDWINDOW_REGISTRATION(FN_MAILMERGE_CHILDWINDOW, CHILDWIN_MAILMERGE); 122cdf0e10cSrcweir // SFX_CHILDWINDOW_REGISTRATION(FN_MAILMERGE_SENDMAIL_CHILDWINDOW); 123cdf0e10cSrcweir SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS| 124cdf0e10cSrcweir SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_SERVER, 125cdf0e10cSrcweir SW_RES(RID_TOOLS_TOOLBOX) ); 126cdf0e10cSrcweir } 127cdf0e10cSrcweir 128cdf0e10cSrcweir TYPEINIT1(SwView,SfxViewShell) 129cdf0e10cSrcweir 130cdf0e10cSrcweir /*-----------------13.12.97 11:06------------------- 131cdf0e10cSrcweir 132cdf0e10cSrcweir --------------------------------------------------*/ 133cdf0e10cSrcweir ShellModes SwView::GetShellMode() 134cdf0e10cSrcweir { 135cdf0e10cSrcweir return pViewImpl->GetShellMode(); 136cdf0e10cSrcweir } 137cdf0e10cSrcweir 138cdf0e10cSrcweir /*-----------------13.12.97 11:28------------------- 139cdf0e10cSrcweir 140cdf0e10cSrcweir --------------------------------------------------*/ 141cdf0e10cSrcweir view::XSelectionSupplier* SwView::GetUNOObject() 142cdf0e10cSrcweir { 143cdf0e10cSrcweir return pViewImpl->GetUNOObject(); 144cdf0e10cSrcweir } 145cdf0e10cSrcweir /* -----------------------------06.05.2002 13:18------------------------------ 146cdf0e10cSrcweir 147cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 148cdf0e10cSrcweir void SwView::ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions) 149cdf0e10cSrcweir { 150cdf0e10cSrcweir pWrtShell->ApplyAccessiblityOptions(rAccessibilityOptions); 151cdf0e10cSrcweir //to enable the right state of the selection cursor in readonly documents 152cdf0e10cSrcweir if(GetDocShell()->IsReadOnly()) 153cdf0e10cSrcweir pWrtShell->ShowCrsr(); 154cdf0e10cSrcweir 155cdf0e10cSrcweir } 156cdf0e10cSrcweir /*-- 26.05.2004 09:14:25--------------------------------------------------- 157cdf0e10cSrcweir 158cdf0e10cSrcweir -----------------------------------------------------------------------*/ 159cdf0e10cSrcweir void SwView::SetMailMergeConfigItem(SwMailMergeConfigItem* pConfigItem, 160cdf0e10cSrcweir sal_uInt16 nRestart, sal_Bool bIsSource) 161cdf0e10cSrcweir { 162cdf0e10cSrcweir pViewImpl->SetMailMergeConfigItem(pConfigItem, nRestart, bIsSource); 163cdf0e10cSrcweir UIFeatureChanged(); 164cdf0e10cSrcweir } 165cdf0e10cSrcweir /*-- 26.05.2004 09:14:25--------------------------------------------------- 166cdf0e10cSrcweir 167cdf0e10cSrcweir -----------------------------------------------------------------------*/ 168cdf0e10cSrcweir SwMailMergeConfigItem* SwView::GetMailMergeConfigItem() 169cdf0e10cSrcweir { 170cdf0e10cSrcweir return pViewImpl->GetMailMergeConfigItem(); 171cdf0e10cSrcweir } 172cdf0e10cSrcweir /*-- 26.05.2004 09:14:25--------------------------------------------------- 173cdf0e10cSrcweir 174cdf0e10cSrcweir -----------------------------------------------------------------------*/ 175cdf0e10cSrcweir sal_uInt16 SwView::GetMailMergeRestartPage() const 176cdf0e10cSrcweir { 177cdf0e10cSrcweir return pViewImpl->GetMailMergeRestartPage(); 178cdf0e10cSrcweir } 179cdf0e10cSrcweir /*-- 03.09.2004 11:56:33--------------------------------------------------- 180cdf0e10cSrcweir 181cdf0e10cSrcweir -----------------------------------------------------------------------*/ 182cdf0e10cSrcweir sal_Bool SwView::IsMailMergeSourceView() const 183cdf0e10cSrcweir { 184cdf0e10cSrcweir return pViewImpl->IsMailMergeSourceView(); 185cdf0e10cSrcweir } 186cdf0e10cSrcweir /*-- 12.04.2006 11:51:40--------------------------------------------------- 187cdf0e10cSrcweir 188cdf0e10cSrcweir -----------------------------------------------------------------------*/ 189cdf0e10cSrcweir sal_Bool lcl_IsViewMarks( const SwViewOption& rVOpt ) 190cdf0e10cSrcweir { 191cdf0e10cSrcweir return rVOpt.IsHardBlank() && 192cdf0e10cSrcweir rVOpt.IsSoftHyph() && 193cdf0e10cSrcweir SwViewOption::IsFieldShadings(); 194cdf0e10cSrcweir } 195cdf0e10cSrcweir void lcl_SetViewMarks(SwViewOption& rVOpt, sal_Bool bOn ) 196cdf0e10cSrcweir { 197cdf0e10cSrcweir rVOpt.SetHardBlank(bOn); 198cdf0e10cSrcweir rVOpt.SetSoftHyph(bOn); 199cdf0e10cSrcweir SwViewOption::SetAppearanceFlag( 200cdf0e10cSrcweir VIEWOPT_FIELD_SHADINGS, bOn, sal_True); 201cdf0e10cSrcweir } 202cdf0e10cSrcweir 203cdf0e10cSrcweir void lcl_SetViewMetaChars( SwViewOption& rVOpt, sal_Bool bOn) 204cdf0e10cSrcweir { 205cdf0e10cSrcweir rVOpt.SetViewMetaChars( bOn ); 206cdf0e10cSrcweir if(bOn && !(rVOpt.IsParagraph() || 207cdf0e10cSrcweir rVOpt.IsTab() || 208cdf0e10cSrcweir rVOpt.IsLineBreak() || 209cdf0e10cSrcweir rVOpt.IsShowHiddenChar() || 210cdf0e10cSrcweir rVOpt.IsBlank())) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir rVOpt.SetParagraph(bOn); 213cdf0e10cSrcweir rVOpt.SetTab(bOn); 214cdf0e10cSrcweir rVOpt.SetLineBreak(bOn); 215cdf0e10cSrcweir rVOpt.SetBlank(bOn); 216cdf0e10cSrcweir rVOpt.SetShowHiddenChar(bOn); 217cdf0e10cSrcweir } 218cdf0e10cSrcweir } 219cdf0e10cSrcweir 220cdf0e10cSrcweir void SwView::RecheckBrowseMode() 221cdf0e10cSrcweir { 222cdf0e10cSrcweir // OS: numerische Reihenfolge beachten! 223cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInva[] = 224cdf0e10cSrcweir { 225cdf0e10cSrcweir //SID_NEWWINDOW,/*5620*/ 226cdf0e10cSrcweir SID_BROWSER_MODE, /*6313*/ 227cdf0e10cSrcweir SID_RULER_BORDERS, SID_RULER_PAGE_POS, 228cdf0e10cSrcweir //SID_ATTR_LONG_LRSPACE, 229cdf0e10cSrcweir SID_HTML_MODE, 230cdf0e10cSrcweir SID_RULER_PROTECT, 231cdf0e10cSrcweir //SID_AUTOSPELL_CHECK, 232cdf0e10cSrcweir //SID_AUTOSPELL_MARKOFF, 233cdf0e10cSrcweir FN_RULER, /*20211*/ 234cdf0e10cSrcweir FN_VIEW_GRAPHIC, /*20213*/ 235cdf0e10cSrcweir FN_VIEW_BOUNDS, /**/ 236cdf0e10cSrcweir FN_VIEW_FIELDS, /*20215*/ 237cdf0e10cSrcweir FN_VLINEAL, /*20216*/ 238cdf0e10cSrcweir FN_VSCROLLBAR, /*20217*/ 239cdf0e10cSrcweir FN_HSCROLLBAR, /*20218*/ 240cdf0e10cSrcweir FN_VIEW_META_CHARS, /**/ 241cdf0e10cSrcweir FN_VIEW_MARKS, /**/ 242cdf0e10cSrcweir //FN_VIEW_FIELDNAME, /**/ 243cdf0e10cSrcweir FN_VIEW_TABLEGRID, /*20227*/ 244cdf0e10cSrcweir FN_PRINT_LAYOUT, /*20237*/ 245cdf0e10cSrcweir FN_QRY_MERGE, /*20364*/ 246cdf0e10cSrcweir FN_SHADOWCURSOR, /**/ 247cdf0e10cSrcweir 0 248cdf0e10cSrcweir }; 249cdf0e10cSrcweir // the view must not exist! 250cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate(aInva); 251cdf0e10cSrcweir CheckVisArea(); 252cdf0e10cSrcweir 253cdf0e10cSrcweir SvxZoomType eType; 254cdf0e10cSrcweir if( GetWrtShell().GetViewOptions()->getBrowseMode() && SVX_ZOOM_PERCENT != (eType = (SvxZoomType) 255cdf0e10cSrcweir GetWrtShell().GetViewOptions()->GetZoomType()) ) 256cdf0e10cSrcweir SetZoom( eType ); 257cdf0e10cSrcweir InvalidateBorder(); 258cdf0e10cSrcweir } 259cdf0e10cSrcweir 260cdf0e10cSrcweir /*-------------------------------------------------------------------- 261cdf0e10cSrcweir State of view options 262cdf0e10cSrcweir --------------------------------------------------------------------*/ 263cdf0e10cSrcweir void SwView::StateViewOptions(SfxItemSet &rSet) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir SfxWhichIter aIter(rSet); 266cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 267cdf0e10cSrcweir SfxBoolItem aBool; 268cdf0e10cSrcweir const SwViewOption* pOpt = GetWrtShell().GetViewOptions(); 269cdf0e10cSrcweir const IDocumentSettingAccess* pIDSA = GetDocShell()->getIDocumentSettingAccess(); 270cdf0e10cSrcweir 271cdf0e10cSrcweir while(nWhich) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir sal_Bool bReadonly = GetDocShell()->IsReadOnly(); 274cdf0e10cSrcweir if ( bReadonly && nWhich != FN_VIEW_GRAPHIC ) 275cdf0e10cSrcweir { 276cdf0e10cSrcweir rSet.DisableItem(nWhich); 277cdf0e10cSrcweir nWhich = 0; 278cdf0e10cSrcweir } 279cdf0e10cSrcweir switch(nWhich) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir case FN_RULER: 282cdf0e10cSrcweir { 283cdf0e10cSrcweir if(!pOpt->IsViewHRuler(sal_True) && !pOpt->IsViewVRuler(sal_True)) 284cdf0e10cSrcweir { 285cdf0e10cSrcweir rSet.DisableItem(nWhich); 286cdf0e10cSrcweir nWhich = 0; 287cdf0e10cSrcweir } 288cdf0e10cSrcweir else 289cdf0e10cSrcweir aBool.SetValue( pOpt->IsViewAnyRuler()); 290cdf0e10cSrcweir } 291cdf0e10cSrcweir break; 292cdf0e10cSrcweir case SID_BROWSER_MODE: 293cdf0e10cSrcweir case FN_PRINT_LAYOUT: 294cdf0e10cSrcweir { 295cdf0e10cSrcweir sal_Bool bState = pOpt->getBrowseMode(); 296cdf0e10cSrcweir if(FN_PRINT_LAYOUT == nWhich) 297cdf0e10cSrcweir bState = !bState; 298cdf0e10cSrcweir aBool.SetValue( bState ); 299cdf0e10cSrcweir } 300cdf0e10cSrcweir break; 301cdf0e10cSrcweir case FN_VIEW_BOUNDS: 302cdf0e10cSrcweir aBool.SetValue( SwViewOption::IsDocBoundaries()); break; 303cdf0e10cSrcweir case FN_VIEW_GRAPHIC: 304cdf0e10cSrcweir aBool.SetValue( !pOpt->IsGraphic() ); break; 305cdf0e10cSrcweir case FN_VIEW_FIELDS: 306cdf0e10cSrcweir aBool.SetValue( SwViewOption::IsFieldShadings() ); break; 307cdf0e10cSrcweir case FN_VIEW_FIELDNAME: 308cdf0e10cSrcweir aBool.SetValue( pOpt->IsFldName() ); break; 309cdf0e10cSrcweir case FN_VIEW_MARKS: 310cdf0e10cSrcweir aBool.SetValue( lcl_IsViewMarks(*pOpt) ); break; 311cdf0e10cSrcweir case FN_VIEW_META_CHARS: 312cdf0e10cSrcweir aBool.SetValue( pOpt->IsViewMetaChars() ); break; 313cdf0e10cSrcweir case FN_VIEW_TABLEGRID: 314cdf0e10cSrcweir aBool.SetValue( SwViewOption::IsTableBoundaries() ); break; 315cdf0e10cSrcweir case FN_VIEW_NOTES: 316cdf0e10cSrcweir { 317cdf0e10cSrcweir aBool.SetValue( pOpt->IsPostIts()); 318cdf0e10cSrcweir if (!GetPostItMgr()->HasNotes()) 319cdf0e10cSrcweir { 320cdf0e10cSrcweir aBool.SetWhich( nWhich ); 321cdf0e10cSrcweir rSet.Put( aBool ); 322cdf0e10cSrcweir rSet.DisableItem(nWhich); 323cdf0e10cSrcweir nWhich = 0; 324cdf0e10cSrcweir } 325cdf0e10cSrcweir break; 326cdf0e10cSrcweir } 327cdf0e10cSrcweir case FN_VIEW_HIDDEN_PARA: 328cdf0e10cSrcweir aBool.SetValue( pOpt->IsShowHiddenPara()); break; 329cdf0e10cSrcweir case SID_GRID_VISIBLE: 330cdf0e10cSrcweir aBool.SetValue( pOpt->IsGridVisible() ); break; 331cdf0e10cSrcweir case SID_GRID_USE: 332cdf0e10cSrcweir aBool.SetValue( pOpt->IsSnap() ); break; 333cdf0e10cSrcweir case SID_HELPLINES_MOVE: 334cdf0e10cSrcweir aBool.SetValue( pOpt->IsCrossHair() ); break; 335cdf0e10cSrcweir case FN_VIEW_SMOOTH_SCROLL: 336cdf0e10cSrcweir aBool.SetValue( pOpt->IsSmoothScroll()); break; 337cdf0e10cSrcweir case FN_VLINEAL: 338cdf0e10cSrcweir aBool.SetValue( 0 != StatVLineal() ); break; 339cdf0e10cSrcweir case FN_HSCROLLBAR: 340cdf0e10cSrcweir if( pOpt->getBrowseMode() ) 341cdf0e10cSrcweir { 342cdf0e10cSrcweir rSet.DisableItem(nWhich); 343cdf0e10cSrcweir nWhich = 0; 344cdf0e10cSrcweir } 345cdf0e10cSrcweir else 346cdf0e10cSrcweir aBool.SetValue( IsHScrollbarVisible() ); break; 347cdf0e10cSrcweir case FN_VSCROLLBAR: 348cdf0e10cSrcweir aBool.SetValue( IsVScrollbarVisible() ); break; 349cdf0e10cSrcweir case SID_AUTOSPELL_CHECK: 350cdf0e10cSrcweir aBool.SetValue( pOpt->IsOnlineSpell() ); 351cdf0e10cSrcweir break; 352cdf0e10cSrcweir case FN_SHADOWCURSOR: 353cdf0e10cSrcweir if (pIDSA == 0 || pOpt->getBrowseMode() ) 354cdf0e10cSrcweir { 355cdf0e10cSrcweir rSet.DisableItem( nWhich ); 356cdf0e10cSrcweir nWhich = 0; 357cdf0e10cSrcweir } 358cdf0e10cSrcweir else 359cdf0e10cSrcweir aBool.SetValue( pOpt->IsShadowCursor() ); 360cdf0e10cSrcweir break; 361cdf0e10cSrcweir 362cdf0e10cSrcweir } 363cdf0e10cSrcweir 364cdf0e10cSrcweir if( nWhich ) 365cdf0e10cSrcweir { 366cdf0e10cSrcweir aBool.SetWhich( nWhich ); 367cdf0e10cSrcweir rSet.Put( aBool ); 368cdf0e10cSrcweir } 369cdf0e10cSrcweir nWhich = aIter.NextWhich(); 370cdf0e10cSrcweir } 371cdf0e10cSrcweir } 372cdf0e10cSrcweir 373cdf0e10cSrcweir /*-------------------------------------------------------------------- 374cdf0e10cSrcweir execute view options 375cdf0e10cSrcweir --------------------------------------------------------------------*/ 376cdf0e10cSrcweir void SwView::ExecViewOptions(SfxRequest &rReq) 377cdf0e10cSrcweir { 378cdf0e10cSrcweir SwViewOption* pOpt = new SwViewOption( *GetWrtShell().GetViewOptions() ); 379cdf0e10cSrcweir sal_Bool bModified = GetWrtShell().IsModified(); 380cdf0e10cSrcweir 381cdf0e10cSrcweir int eState = STATE_TOGGLE; 382cdf0e10cSrcweir sal_Bool bSet = sal_False; 383cdf0e10cSrcweir bool bBrowseModeChanged = false; 384cdf0e10cSrcweir 385cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 386cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 387cdf0e10cSrcweir const SfxPoolItem* pAttr=NULL; 388cdf0e10cSrcweir 389cdf0e10cSrcweir if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nSlot , sal_False, &pAttr )) 390cdf0e10cSrcweir { 391cdf0e10cSrcweir bSet = ((SfxBoolItem*)pAttr)->GetValue(); 392cdf0e10cSrcweir eState = bSet ? STATE_ON : STATE_OFF; 393cdf0e10cSrcweir } 394cdf0e10cSrcweir 395cdf0e10cSrcweir sal_Bool bFlag = STATE_ON == eState; 396cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xLngProp( ::GetLinguPropertySet() ); 397cdf0e10cSrcweir 398cdf0e10cSrcweir switch ( nSlot ) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir case FN_VIEW_GRAPHIC: 401cdf0e10cSrcweir 402cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 403cdf0e10cSrcweir bFlag = !pOpt->IsGraphic(); 404cdf0e10cSrcweir pOpt->SetGraphic( bFlag ); 405cdf0e10cSrcweir break; 406cdf0e10cSrcweir 407cdf0e10cSrcweir case FN_VIEW_FIELDS: 408cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 409cdf0e10cSrcweir bFlag = !SwViewOption::IsFieldShadings() ; 410cdf0e10cSrcweir SwViewOption::SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS, bFlag, sal_True ); 411cdf0e10cSrcweir break; 412cdf0e10cSrcweir 413cdf0e10cSrcweir case FN_VIEW_BOUNDS: 414cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 415cdf0e10cSrcweir bFlag = !SwViewOption::IsDocBoundaries(); 416cdf0e10cSrcweir SwViewOption::SetAppearanceFlag(VIEWOPT_DOC_BOUNDARIES, bFlag, sal_True ); 417cdf0e10cSrcweir break; 418cdf0e10cSrcweir 419cdf0e10cSrcweir case SID_GRID_VISIBLE: 420cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 421cdf0e10cSrcweir bFlag = !pOpt->IsGridVisible(); 422cdf0e10cSrcweir 423cdf0e10cSrcweir pOpt->SetGridVisible( bFlag ); 424cdf0e10cSrcweir break; 425cdf0e10cSrcweir 426cdf0e10cSrcweir case SID_GRID_USE: 427cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 428cdf0e10cSrcweir bFlag = !pOpt->IsSnap(); 429cdf0e10cSrcweir 430cdf0e10cSrcweir pOpt->SetSnap( bFlag ); 431cdf0e10cSrcweir break; 432cdf0e10cSrcweir 433cdf0e10cSrcweir case SID_HELPLINES_MOVE: 434cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 435cdf0e10cSrcweir bFlag = !pOpt->IsCrossHair(); 436cdf0e10cSrcweir 437cdf0e10cSrcweir pOpt->SetCrossHair( bFlag ); 438cdf0e10cSrcweir break; 439cdf0e10cSrcweir 440cdf0e10cSrcweir case SID_BROWSER_MODE: 441cdf0e10cSrcweir case FN_PRINT_LAYOUT: 442cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 443cdf0e10cSrcweir bFlag = !pOpt->getBrowseMode(); 444cdf0e10cSrcweir else if( nSlot == FN_PRINT_LAYOUT ) 445cdf0e10cSrcweir bFlag = !bFlag; 446cdf0e10cSrcweir bBrowseModeChanged = bFlag != pOpt->getBrowseMode(); 447cdf0e10cSrcweir // Disable "multiple layout" 448cdf0e10cSrcweir GetDocShell()->ToggleBrowserMode( bFlag, this ); 449cdf0e10cSrcweir 450cdf0e10cSrcweir pOpt->setBrowseMode( bFlag ); 451cdf0e10cSrcweir break; 452cdf0e10cSrcweir 453cdf0e10cSrcweir case FN_VIEW_NOTES: 454cdf0e10cSrcweir if ( STATE_TOGGLE == eState ) 455cdf0e10cSrcweir bFlag = !pOpt->IsPostIts(); 456cdf0e10cSrcweir 457cdf0e10cSrcweir GetPostItMgr()->SetLayout(); 458cdf0e10cSrcweir pOpt->SetPostIts( bFlag ); 459cdf0e10cSrcweir if (pOpt->IsPostIts()) 460cdf0e10cSrcweir GetPostItMgr()->CheckMetaText(); 461cdf0e10cSrcweir break; 462cdf0e10cSrcweir 463cdf0e10cSrcweir case FN_VIEW_HIDDEN_PARA: 464cdf0e10cSrcweir if ( STATE_TOGGLE == eState ) 465cdf0e10cSrcweir bFlag = !pOpt->IsShowHiddenPara(); 466cdf0e10cSrcweir 467cdf0e10cSrcweir pOpt->SetShowHiddenPara( bFlag ); 468cdf0e10cSrcweir break; 469cdf0e10cSrcweir 470cdf0e10cSrcweir case FN_VIEW_SMOOTH_SCROLL: 471cdf0e10cSrcweir 472cdf0e10cSrcweir if ( STATE_TOGGLE == eState ) 473cdf0e10cSrcweir bFlag = !pOpt->IsSmoothScroll(); 474cdf0e10cSrcweir 475cdf0e10cSrcweir pOpt->SetSmoothScroll( bFlag ); 476cdf0e10cSrcweir break; 477cdf0e10cSrcweir 478cdf0e10cSrcweir 479cdf0e10cSrcweir case FN_VLINEAL: 480cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 481cdf0e10cSrcweir bFlag = !pOpt->IsViewVRuler(); 482cdf0e10cSrcweir 483cdf0e10cSrcweir pOpt->SetViewVRuler( bFlag ); 484cdf0e10cSrcweir break; 485cdf0e10cSrcweir 486cdf0e10cSrcweir case FN_VSCROLLBAR: 487cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 488cdf0e10cSrcweir bFlag = !pOpt->IsViewVScrollBar(); 489cdf0e10cSrcweir 490cdf0e10cSrcweir pOpt->SetViewVScrollBar( bFlag ); 491cdf0e10cSrcweir break; 492cdf0e10cSrcweir 493cdf0e10cSrcweir case FN_HSCROLLBAR: 494cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 495cdf0e10cSrcweir bFlag = !pOpt->IsViewHScrollBar(); 496cdf0e10cSrcweir 497cdf0e10cSrcweir pOpt->SetViewHScrollBar( bFlag ); 498cdf0e10cSrcweir break; 499cdf0e10cSrcweir case FN_RULER: 500cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 501cdf0e10cSrcweir bFlag = !pOpt->IsViewAnyRuler(); 502cdf0e10cSrcweir 503cdf0e10cSrcweir pOpt->SetViewAnyRuler( bFlag ); 504cdf0e10cSrcweir break; 505cdf0e10cSrcweir 506cdf0e10cSrcweir case FN_VIEW_TABLEGRID: 507cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 508cdf0e10cSrcweir bFlag = !SwViewOption::IsTableBoundaries(); 509cdf0e10cSrcweir SwViewOption::SetAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES, bFlag, sal_True ); 510cdf0e10cSrcweir break; 511cdf0e10cSrcweir 512cdf0e10cSrcweir case FN_VIEW_FIELDNAME: 513cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 514cdf0e10cSrcweir bFlag = !pOpt->IsFldName() ; 515cdf0e10cSrcweir 516cdf0e10cSrcweir pOpt->SetFldName( bFlag ); 517cdf0e10cSrcweir break; 518cdf0e10cSrcweir case FN_VIEW_MARKS: 519cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 520cdf0e10cSrcweir bFlag = !lcl_IsViewMarks(*pOpt) ; 521cdf0e10cSrcweir 522cdf0e10cSrcweir lcl_SetViewMarks( *pOpt, bFlag ); 523cdf0e10cSrcweir break; 524cdf0e10cSrcweir case FN_VIEW_META_CHARS: 525cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 526cdf0e10cSrcweir bFlag = !pOpt->IsViewMetaChars(); 527cdf0e10cSrcweir 528cdf0e10cSrcweir lcl_SetViewMetaChars( *pOpt, bFlag ); 529cdf0e10cSrcweir break; 530cdf0e10cSrcweir case SID_AUTOSPELL_CHECK: 531cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 532cdf0e10cSrcweir bFlag = bSet = !pOpt->IsOnlineSpell(); 533cdf0e10cSrcweir 534cdf0e10cSrcweir pOpt->SetOnlineSpell(bSet); 535cdf0e10cSrcweir { 536cdf0e10cSrcweir uno::Any aVal( &bSet, ::getCppuBooleanType() ); 537cdf0e10cSrcweir String aPropName( C2S(UPN_IS_SPELL_AUTO) ); 538cdf0e10cSrcweir 539cdf0e10cSrcweir SvtLinguConfig aCfg; 540cdf0e10cSrcweir aCfg.SetProperty( aPropName, aVal ); 541cdf0e10cSrcweir 542cdf0e10cSrcweir if (xLngProp.is()) 543cdf0e10cSrcweir xLngProp->setPropertyValue( aPropName, aVal ); 544cdf0e10cSrcweir 545cdf0e10cSrcweir // for the time being we do not have a specific option for grammarchecking. 546cdf0e10cSrcweir // thus we'll use the one for spell checking... 547cdf0e10cSrcweir if (bSet) 548cdf0e10cSrcweir { 549cdf0e10cSrcweir SwDocShell *pDocSh = GetDocShell(); 550cdf0e10cSrcweir SwDoc *pDoc = pDocSh? pDocSh->GetDoc() : NULL; 551cdf0e10cSrcweir 552cdf0e10cSrcweir // right now we don't have view options for automatic grammar checking. Thus... 553cdf0e10cSrcweir sal_Bool bIsAutoGrammar = sal_False; 554cdf0e10cSrcweir aCfg.GetProperty( C2U( UPN_IS_GRAMMAR_AUTO ) ) >>= bIsAutoGrammar; 555cdf0e10cSrcweir 556cdf0e10cSrcweir if (pDoc && bIsAutoGrammar) 557cdf0e10cSrcweir StartGrammarChecking( *pDoc ); 558cdf0e10cSrcweir } 559cdf0e10cSrcweir } 560cdf0e10cSrcweir break; 561cdf0e10cSrcweir case FN_SHADOWCURSOR: 562cdf0e10cSrcweir if( STATE_TOGGLE == eState ) 563cdf0e10cSrcweir bFlag = bSet = !pOpt->IsShadowCursor(); 564cdf0e10cSrcweir 565cdf0e10cSrcweir pOpt->SetShadowCursor(bSet); 566cdf0e10cSrcweir break; 567cdf0e10cSrcweir 568cdf0e10cSrcweir default: 569cdf0e10cSrcweir ASSERT(sal_False, Falsche Request-Methode); 570cdf0e10cSrcweir return; 571cdf0e10cSrcweir } 572cdf0e10cSrcweir 573cdf0e10cSrcweir // UserPrefs setzen Request als bearbeitet kennzeichnen 574cdf0e10cSrcweir sal_Bool bWebView = 0 != dynamic_cast<const SwWebView*>(this); 575cdf0e10cSrcweir SwWrtShell &rSh = GetWrtShell(); 576cdf0e10cSrcweir rSh.StartAction(); 577cdf0e10cSrcweir SwModule* pModule = SW_MOD(); 578cdf0e10cSrcweir if( !(*rSh.GetViewOptions() == *pOpt )) 579cdf0e10cSrcweir { 580cdf0e10cSrcweir rSh.ApplyViewOptions( *pOpt ); 581cdf0e10cSrcweir if( bBrowseModeChanged ) 582cdf0e10cSrcweir { 583cdf0e10cSrcweir RecheckBrowseMode(); 584cdf0e10cSrcweir CheckVisArea(); 585cdf0e10cSrcweir } 586cdf0e10cSrcweir 587cdf0e10cSrcweir //Die UsrPref muessen als Modified gekennzeichnet werden. 588cdf0e10cSrcweir //call for initialization 589cdf0e10cSrcweir pModule->GetUsrPref(bWebView); 590cdf0e10cSrcweir pModule->CheckSpellChanges( pOpt->IsOnlineSpell(), sal_False, sal_False, sal_False ); 591cdf0e10cSrcweir } 592cdf0e10cSrcweir //OS: Modified wieder zuruecksetzen, weil Ansicht/Felder 593cdf0e10cSrcweir // das Doc modified setzt. 594cdf0e10cSrcweir if( !bModified ) 595cdf0e10cSrcweir rSh.ResetModified(); 596cdf0e10cSrcweir 597cdf0e10cSrcweir pModule->ApplyUsrPref( *pOpt, this, bWebView ? VIEWOPT_DEST_WEB : VIEWOPT_DEST_TEXT ); 598cdf0e10cSrcweir 599cdf0e10cSrcweir //mod #i6193# let postits know about new spellcheck setting 600cdf0e10cSrcweir if ( nSlot == SID_AUTOSPELL_CHECK ) 601cdf0e10cSrcweir GetPostItMgr()->SetSpellChecking(); 602cdf0e10cSrcweir 603cdf0e10cSrcweir const sal_Bool bLockedView = rSh.IsViewLocked(); 604cdf0e10cSrcweir rSh.LockView( sal_True ); //lock visible section 605cdf0e10cSrcweir GetWrtShell().EndAction(); 606cdf0e10cSrcweir if( bBrowseModeChanged && !bFlag ) 607cdf0e10cSrcweir CalcVisArea( GetEditWin().GetOutputSizePixel() ); 608cdf0e10cSrcweir rSh.LockView( bLockedView ); 609cdf0e10cSrcweir 610cdf0e10cSrcweir delete pOpt; 611cdf0e10cSrcweir Invalidate(rReq.GetSlot()); 612cdf0e10cSrcweir if(!pArgs) 613cdf0e10cSrcweir rReq.AppendItem(SfxBoolItem(nSlot, (sal_Bool)bFlag)); 614cdf0e10cSrcweir rReq.Done(); 615cdf0e10cSrcweir } 616cdf0e10cSrcweir 617cdf0e10cSrcweir IMPL_LINK( SwView, HtmlOptionsHdl, void*, EMPTYARG ) 618cdf0e10cSrcweir { 619cdf0e10cSrcweir // Invalidierung, falls blinkender Text erlaubt/verboten wurde 620cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate(SID_DRAW_TEXT_MARQUEE); 621cdf0e10cSrcweir return 0; 622cdf0e10cSrcweir } 623