LCOV - code coverage report
Current view: top level - sw/source/core/uibase/uiview - view0.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 279 0.0 %
Date: 2014-04-14 Functions: 0 27 0.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 "hintids.hxx"
      21             : #include <vcl/graph.hxx>
      22             : #include <svx/galbrws.hxx>
      23             : #include <svl/srchitem.hxx>
      24             : #include <SwSpellDialogChildWindow.hxx>
      25             : #include <svl/eitem.hxx>
      26             : #include <unotools/linguprops.hxx>
      27             : #include <unotools/lingucfg.hxx>
      28             : #include <viewopt.hxx>
      29             : #include <globals.h>
      30             : #include <sfx2/app.hxx>
      31             : #include <sfx2/infobar.hxx>
      32             : #include <sfx2/request.hxx>
      33             : #include <svl/whiter.hxx>
      34             : #include <svx/srchdlg.hxx>
      35             : #include <sfx2/templdlg.hxx>
      36             : #include <sfx2/viewfrm.hxx>
      37             : #include <sfx2/bindings.hxx>
      38             : #include <sfx2/sidebar/SidebarChildWindow.hxx>
      39             : #include <uivwimp.hxx>
      40             : #include <avmedia/mediaplayer.hxx>
      41             : #include <swmodule.hxx>
      42             : #include <com/sun/star/linguistic2/XLinguProperties.hpp>
      43             : 
      44             : #include <sfx2/objface.hxx>
      45             : #include <navipi.hxx>
      46             : #include <wrtsh.hxx>
      47             : #include <edtwin.hxx>
      48             : #include "view.hxx"
      49             : #include "basesh.hxx"
      50             : #include "docsh.hxx"
      51             : #include "doc.hxx"
      52             : #include "globals.hrc"
      53             : #include "cmdid.h"
      54             : #include "globdoc.hxx"
      55             : #include "wview.hxx"
      56             : #include "shells.hrc"
      57             : 
      58             : #define SwView
      59             : #define GlobalContents
      60             : #define Text
      61             : #define TextDrawText
      62             : #define TextInTable
      63             : #define ListInText
      64             : #define ListInTable
      65             : #define WebTextInTable
      66             : #define WebListInText
      67             : #define WebListInTable
      68             : #include <sfx2/msg.hxx>
      69             : #include "swslots.hxx"
      70             : #include <PostItMgr.hxx>
      71             : 
      72             : using namespace ::com::sun::star;
      73             : 
      74             : #include <unotools/moduleoptions.hxx>
      75             : 
      76             : #include <IDocumentSettingAccess.hxx>
      77             : 
      78             : #include <unomid.h>
      79             : 
      80           0 : SFX_IMPL_NAMED_VIEWFACTORY(SwView, "Default")
      81             : {
      82           0 :     if ( SvtModuleOptions().IsWriter() )
      83             :     {
      84           0 :         SFX_VIEW_REGISTRATION(SwDocShell);
      85           0 :         SFX_VIEW_REGISTRATION(SwGlobalDocShell);
      86             :     }
      87           0 : }
      88             : 
      89           0 : SFX_IMPL_INTERFACE( SwView, SfxViewShell, SW_RES(RID_TOOLS_TOOLBOX) )
      90             : {
      91           0 :     SFX_CHILDWINDOW_CONTEXT_REGISTRATION(SID_NAVIGATOR);
      92           0 :     SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId());
      93           0 :     SFX_CHILDWINDOW_REGISTRATION(SfxTemplateDialogWrapper::GetChildWindowId());
      94           0 :     SFX_CHILDWINDOW_REGISTRATION(SfxInfoBarContainerChild::GetChildWindowId());
      95           0 :     SFX_CHILDWINDOW_REGISTRATION(SvxSearchDialogWrapper::GetChildWindowId());
      96           0 :     SFX_CHILDWINDOW_REGISTRATION(SwSpellDialogChildWindow::GetChildWindowId());
      97           0 :     SFX_CHILDWINDOW_REGISTRATION(FN_REDLINE_ACCEPT);
      98           0 :     SFX_CHILDWINDOW_REGISTRATION(SID_HYPERLINK_DIALOG);
      99           0 :     SFX_CHILDWINDOW_REGISTRATION(FN_WORDCOUNT_DIALOG);
     100           0 :     SFX_CHILDWINDOW_REGISTRATION(GalleryChildWindow::GetChildWindowId());
     101           0 :     SFX_CHILDWINDOW_REGISTRATION(::avmedia::MediaPlayer::GetChildWindowId());
     102           0 :     SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_FIELD_DATA_ONLY);
     103           0 :         SFX_FEATURED_CHILDWINDOW_REGISTRATION(FN_SYNC_LABELS,           CHILDWIN_LABEL    );
     104           0 :         SFX_FEATURED_CHILDWINDOW_REGISTRATION(FN_MAILMERGE_CHILDWINDOW, CHILDWIN_MAILMERGE);
     105           0 :     SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS|
     106             :                                 SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_SERVER,
     107           0 :                                 SW_RES(RID_TOOLS_TOOLBOX) );
     108           0 : }
     109             : 
     110           0 : TYPEINIT1(SwView,SfxViewShell)
     111             : 
     112           0 : ShellModes  SwView::GetShellMode()
     113             : {
     114           0 :     return m_pViewImpl->GetShellMode();
     115             : }
     116             : 
     117           0 : view::XSelectionSupplier* SwView::GetUNOObject()
     118             : {
     119           0 :     return m_pViewImpl->GetUNOObject();
     120             : }
     121             : 
     122           0 : void SwView::ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions)
     123             : {
     124           0 :     m_pWrtShell->ApplyAccessiblityOptions(rAccessibilityOptions);
     125             :     //to enable the right state of the selection cursor in readonly documents
     126           0 :     if(GetDocShell()->IsReadOnly())
     127           0 :         m_pWrtShell->ShowCrsr();
     128             : 
     129           0 : }
     130             : 
     131           0 : void   SwView::SetMailMergeConfigItem(SwMailMergeConfigItem*  pConfigItem,
     132             :                 sal_uInt16 nRestart, sal_Bool bIsSource)
     133             : {
     134           0 :     m_pViewImpl->SetMailMergeConfigItem(pConfigItem, nRestart, bIsSource);
     135           0 :     UIFeatureChanged();
     136           0 : }
     137             : 
     138           0 : SwMailMergeConfigItem*  SwView::GetMailMergeConfigItem()
     139             : {
     140           0 :     return m_pViewImpl->GetMailMergeConfigItem();
     141             : }
     142             : 
     143           0 : sal_uInt16 SwView::GetMailMergeRestartPage() const
     144             : {
     145           0 :     return m_pViewImpl->GetMailMergeRestartPage();
     146             : }
     147             : 
     148           0 : sal_Bool SwView::IsMailMergeSourceView() const
     149             : {
     150           0 :     return m_pViewImpl->IsMailMergeSourceView();
     151             : }
     152             : 
     153           0 : static sal_Bool lcl_IsViewMarks( const SwViewOption& rVOpt )
     154             : {
     155           0 :     return  rVOpt.IsHardBlank() &&
     156           0 :             rVOpt.IsSoftHyph() &&
     157           0 :             SwViewOption::IsFieldShadings();
     158             : }
     159           0 : static void lcl_SetViewMarks(SwViewOption& rVOpt, sal_Bool bOn )
     160             : {
     161           0 :     rVOpt.SetHardBlank(bOn);
     162           0 :     rVOpt.SetSoftHyph(bOn);
     163             :     SwViewOption::SetAppearanceFlag(
     164           0 :             VIEWOPT_FIELD_SHADINGS, bOn, sal_True);
     165           0 : }
     166             : 
     167           0 : static void lcl_SetViewMetaChars( SwViewOption& rVOpt, sal_Bool bOn)
     168             : {
     169           0 :     rVOpt.SetViewMetaChars( bOn );
     170           0 :     if(bOn && !(rVOpt.IsParagraph()     ||
     171           0 :             rVOpt.IsTab()       ||
     172           0 :             rVOpt.IsLineBreak() ||
     173           0 :             rVOpt.IsShowHiddenChar() ||
     174           0 :             rVOpt.IsBlank()))
     175             :     {
     176           0 :         rVOpt.SetParagraph(bOn);
     177           0 :         rVOpt.SetTab(bOn);
     178           0 :         rVOpt.SetLineBreak(bOn);
     179           0 :         rVOpt.SetBlank(bOn);
     180           0 :         rVOpt.SetShowHiddenChar(bOn);
     181             :     }
     182           0 : }
     183             : 
     184           0 : void SwView::RecheckBrowseMode()
     185             : {
     186             :     // OS: pay attention to numerical order!
     187             :     static sal_uInt16 const aInva[] =
     188             :         {
     189             :             //SID_NEWWINDOW,/*5620*/
     190             :             SID_BROWSER_MODE, /*6313*/
     191             :             SID_RULER_BORDERS, SID_RULER_PAGE_POS,
     192             :             //SID_ATTR_LONG_LRSPACE,
     193             :             SID_HTML_MODE,
     194             :             SID_RULER_PROTECT,
     195             :             //SID_AUTOSPELL_CHECK,
     196             :             //SID_AUTOSPELL_MARKOFF,
     197             :             FN_RULER,       /*20211*/
     198             :             FN_VIEW_GRAPHIC,    /*20213*/
     199             :             FN_VIEW_BOUNDS,     /**/
     200             :             FN_VIEW_FIELDS,     /*20215*/
     201             :             FN_VLINEAL,             /*20216*/
     202             :             FN_VSCROLLBAR,      /*20217*/
     203             :             FN_HSCROLLBAR,      /*20218*/
     204             :             FN_VIEW_META_CHARS, /**/
     205             :             FN_VIEW_MARKS,      /**/
     206             :             //FN_VIEW_FIELDNAME,    /**/
     207             :             FN_VIEW_TABLEGRID,  /*20227*/
     208             :             FN_PRINT_LAYOUT, /*20237*/
     209             :             FN_QRY_MERGE,   /*20364*/
     210             :             FN_SHADOWCURSOR, /**/
     211             :             0
     212             :         };
     213             :     // the view must not exist!
     214           0 :     GetViewFrame()->GetBindings().Invalidate(aInva);
     215           0 :     CheckVisArea();
     216             : 
     217             :     SvxZoomType eType;
     218           0 :     if( GetWrtShell().GetViewOptions()->getBrowseMode() && SVX_ZOOM_PERCENT != (eType = (SvxZoomType)
     219           0 :         GetWrtShell().GetViewOptions()->GetZoomType()) )
     220           0 :         SetZoom( eType );
     221           0 :     InvalidateBorder();
     222           0 : }
     223             : 
     224             : // State of view options
     225             : 
     226           0 : void SwView::StateViewOptions(SfxItemSet &rSet)
     227             : {
     228           0 :     SfxWhichIter aIter(rSet);
     229           0 :     sal_uInt16 nWhich = aIter.FirstWhich();
     230           0 :     SfxBoolItem aBool;
     231           0 :     const SwViewOption* pOpt = GetWrtShell().GetViewOptions();
     232           0 :     const IDocumentSettingAccess* pIDSA = GetDocShell()->getIDocumentSettingAccess();
     233             : 
     234           0 :     while(nWhich)
     235             :     {
     236           0 :         sal_Bool bReadonly = GetDocShell()->IsReadOnly();
     237           0 :         if ( bReadonly && nWhich != FN_VIEW_GRAPHIC )
     238             :         {
     239           0 :             rSet.DisableItem(nWhich);
     240           0 :             nWhich = 0;
     241             :         }
     242           0 :         switch(nWhich)
     243             :         {
     244             :             case FN_RULER:
     245             :             {
     246           0 :                 if(!pOpt->IsViewHRuler(sal_True) && !pOpt->IsViewVRuler(sal_True))
     247             :                 {
     248           0 :                     rSet.DisableItem(nWhich);
     249           0 :                     nWhich = 0;
     250             :                 }
     251             :                 else
     252           0 :                     aBool.SetValue( pOpt->IsViewAnyRuler());
     253             :             }
     254           0 :             break;
     255             :             case SID_BROWSER_MODE:
     256             :             case FN_PRINT_LAYOUT:
     257             :             {
     258           0 :                 sal_Bool bState = pOpt->getBrowseMode();
     259           0 :                 if(FN_PRINT_LAYOUT == nWhich)
     260           0 :                     bState = !bState;
     261           0 :                 aBool.SetValue( bState );
     262             :             }
     263           0 :             break;
     264             :             case FN_VIEW_BOUNDS:
     265           0 :                 aBool.SetValue( SwViewOption::IsDocBoundaries()); break;
     266             :             case FN_VIEW_GRAPHIC:
     267           0 :                 aBool.SetValue( !pOpt->IsGraphic() ); break;
     268             :             case FN_VIEW_FIELDS:
     269           0 :                 aBool.SetValue( SwViewOption::IsFieldShadings() ); break;
     270             :             case FN_VIEW_FIELDNAME:
     271           0 :                 aBool.SetValue( pOpt->IsFldName() ); break;
     272             :             case FN_VIEW_MARKS:
     273           0 :                 aBool.SetValue( lcl_IsViewMarks(*pOpt) ); break;
     274             :             case FN_VIEW_META_CHARS:
     275           0 :                 aBool.SetValue( pOpt->IsViewMetaChars() ); break;
     276             :             case FN_VIEW_TABLEGRID:
     277           0 :                 aBool.SetValue( SwViewOption::IsTableBoundaries() ); break;
     278             :             case FN_VIEW_NOTES:
     279             :             {
     280           0 :                 aBool.SetValue( pOpt->IsPostIts());
     281           0 :                 if (!GetPostItMgr()->HasNotes())
     282             :                 {
     283           0 :                     aBool.SetWhich( nWhich );
     284           0 :                     rSet.Put( aBool );
     285           0 :                     rSet.DisableItem(nWhich);
     286           0 :                     nWhich = 0;
     287             :                 }
     288           0 :                 break;
     289             :             }
     290             :             case FN_VIEW_HIDDEN_PARA:
     291           0 :                 aBool.SetValue( pOpt->IsShowHiddenPara()); break;
     292             :             case SID_GRID_VISIBLE:
     293           0 :                 aBool.SetValue( pOpt->IsGridVisible() ); break;
     294             :             case SID_GRID_USE:
     295           0 :                 aBool.SetValue( pOpt->IsSnap() ); break;
     296             :             case SID_HELPLINES_MOVE:
     297           0 :                 aBool.SetValue( pOpt->IsCrossHair() ); break;
     298             :             case FN_VIEW_SMOOTH_SCROLL:
     299           0 :                 aBool.SetValue( pOpt->IsSmoothScroll()); break;
     300             :             case FN_VLINEAL:
     301           0 :                 aBool.SetValue( StatVRuler() ); break;
     302             :             case FN_HSCROLLBAR:
     303           0 :                 if( pOpt->getBrowseMode() )
     304             :                 {
     305           0 :                     rSet.DisableItem(nWhich);
     306           0 :                     nWhich = 0;
     307             :                 }
     308             :                 else
     309           0 :                     aBool.SetValue( IsHScrollbarVisible() ); break;
     310             :             case FN_VSCROLLBAR:
     311           0 :                 aBool.SetValue( IsVScrollbarVisible() ); break;
     312             :             case SID_AUTOSPELL_CHECK:
     313           0 :                 aBool.SetValue( pOpt->IsOnlineSpell() );
     314           0 :             break;
     315             :             case FN_SHADOWCURSOR:
     316           0 :                 if (pIDSA == 0 || pOpt->getBrowseMode() )
     317             :                 {
     318           0 :                     rSet.DisableItem( nWhich );
     319           0 :                     nWhich = 0;
     320             :                 }
     321             :                 else
     322           0 :                     aBool.SetValue( pOpt->IsShadowCursor() );
     323           0 :             break;
     324             : 
     325             :         }
     326             : 
     327           0 :         if( nWhich )
     328             :         {
     329           0 :             aBool.SetWhich( nWhich );
     330           0 :             rSet.Put( aBool );
     331             :         }
     332           0 :         nWhich = aIter.NextWhich();
     333           0 :     }
     334           0 : }
     335             : 
     336             : // execute view options
     337             : 
     338           0 : void SwView::ExecViewOptions(SfxRequest &rReq)
     339             : {
     340           0 :     SwViewOption* pOpt = new SwViewOption( *GetWrtShell().GetViewOptions() );
     341           0 :     sal_Bool bModified = GetWrtShell().IsModified();
     342             : 
     343           0 :     int eState = STATE_TOGGLE;
     344           0 :     sal_Bool bSet = sal_False;
     345           0 :     bool bBrowseModeChanged = false;
     346             : 
     347           0 :     const SfxItemSet *pArgs = rReq.GetArgs();
     348           0 :     sal_uInt16 nSlot = rReq.GetSlot();
     349           0 :     const SfxPoolItem* pAttr=NULL;
     350             : 
     351           0 :     if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nSlot , false, &pAttr ))
     352             :     {
     353           0 :         bSet = ((SfxBoolItem*)pAttr)->GetValue();
     354           0 :         eState = bSet ? STATE_ON : STATE_OFF;
     355             :     }
     356             : 
     357           0 :     sal_Bool bFlag = STATE_ON == eState;
     358           0 :     uno::Reference< linguistic2::XLinguProperties >  xLngProp( ::GetLinguPropertySet() );
     359             : 
     360           0 :     switch ( nSlot )
     361             :     {
     362             :     case FN_VIEW_GRAPHIC:
     363           0 :         if( STATE_TOGGLE == eState )
     364           0 :             bFlag = !pOpt->IsGraphic();
     365           0 :         pOpt->SetGraphic( bFlag );
     366           0 :         break;
     367             : 
     368             :     case FN_VIEW_FIELDS:
     369           0 :         if( STATE_TOGGLE == eState )
     370           0 :             bFlag = !SwViewOption::IsFieldShadings() ;
     371           0 :         SwViewOption::SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS, bFlag, sal_True );
     372           0 :         break;
     373             : 
     374             :     case FN_VIEW_BOUNDS:
     375           0 :         if( STATE_TOGGLE == eState )
     376           0 :             bFlag = !SwViewOption::IsDocBoundaries();
     377           0 :         SwViewOption::SetAppearanceFlag(VIEWOPT_DOC_BOUNDARIES, bFlag, sal_True );
     378           0 :         break;
     379             : 
     380             :     case SID_GRID_VISIBLE:
     381           0 :         if( STATE_TOGGLE == eState )
     382           0 :             bFlag = !pOpt->IsGridVisible();
     383             : 
     384           0 :         pOpt->SetGridVisible( bFlag );
     385           0 :         break;
     386             : 
     387             :     case SID_GRID_USE:
     388           0 :         if( STATE_TOGGLE == eState )
     389           0 :             bFlag = !pOpt->IsSnap();
     390             : 
     391           0 :         pOpt->SetSnap( bFlag );
     392           0 :         break;
     393             : 
     394             :     case SID_HELPLINES_MOVE:
     395           0 :         if( STATE_TOGGLE == eState )
     396           0 :             bFlag = !pOpt->IsCrossHair();
     397             : 
     398           0 :         pOpt->SetCrossHair( bFlag );
     399           0 :         break;
     400             : 
     401             :     case SID_BROWSER_MODE:
     402             :     case FN_PRINT_LAYOUT:
     403           0 :         if( STATE_TOGGLE == eState )
     404           0 :             bFlag = !pOpt->getBrowseMode();
     405           0 :         else if( nSlot == FN_PRINT_LAYOUT )
     406           0 :             bFlag = !bFlag;
     407           0 :         bBrowseModeChanged = bFlag != pOpt->getBrowseMode();
     408             :         // Disable "multiple layout"
     409           0 :         GetDocShell()->ToggleBrowserMode( bFlag, this );
     410           0 :         pOpt->setBrowseMode( bFlag );
     411           0 :         break;
     412             : 
     413             :     case FN_VIEW_NOTES:
     414           0 :         if ( STATE_TOGGLE == eState )
     415           0 :             bFlag = !pOpt->IsPostIts();
     416             : 
     417           0 :         GetPostItMgr()->SetLayout();
     418           0 :         pOpt->SetPostIts( bFlag );
     419           0 :         if (pOpt->IsPostIts())
     420           0 :             GetPostItMgr()->CheckMetaText();
     421           0 :         break;
     422             : 
     423             :     case FN_VIEW_HIDDEN_PARA:
     424           0 :         if ( STATE_TOGGLE == eState )
     425           0 :             bFlag = !pOpt->IsShowHiddenPara();
     426             : 
     427           0 :         pOpt->SetShowHiddenPara( bFlag );
     428           0 :         break;
     429             : 
     430             :     case FN_VIEW_SMOOTH_SCROLL:
     431             : 
     432           0 :         if ( STATE_TOGGLE == eState )
     433           0 :             bFlag = !pOpt->IsSmoothScroll();
     434             : 
     435           0 :         pOpt->SetSmoothScroll( bFlag );
     436           0 :         break;
     437             : 
     438             :     case FN_VLINEAL:
     439           0 :         if( STATE_TOGGLE == eState )
     440           0 :             bFlag = !pOpt->IsViewVRuler();
     441             : 
     442           0 :         pOpt->SetViewVRuler( bFlag );
     443           0 :         break;
     444             : 
     445             :     case FN_VSCROLLBAR:
     446           0 :         if( STATE_TOGGLE == eState )
     447           0 :             bFlag = !pOpt->IsViewVScrollBar();
     448             : 
     449           0 :         pOpt->SetViewVScrollBar( bFlag );
     450           0 :         break;
     451             : 
     452             :     case FN_HSCROLLBAR:
     453           0 :         if( STATE_TOGGLE == eState )
     454           0 :             bFlag = !pOpt->IsViewHScrollBar();
     455             : 
     456           0 :         pOpt->SetViewHScrollBar( bFlag );
     457           0 :         break;
     458             : 
     459             :     case FN_RULER:
     460           0 :         if( STATE_TOGGLE == eState )
     461           0 :             bFlag = !pOpt->IsViewAnyRuler();
     462             : 
     463           0 :         pOpt->SetViewAnyRuler( bFlag );
     464           0 :         break;
     465             : 
     466             :     case FN_VIEW_TABLEGRID:
     467           0 :         if( STATE_TOGGLE == eState )
     468           0 :             bFlag = !SwViewOption::IsTableBoundaries();
     469           0 :         SwViewOption::SetAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES, bFlag, sal_True );
     470           0 :         break;
     471             : 
     472             :     case FN_VIEW_FIELDNAME:
     473           0 :         if( STATE_TOGGLE == eState )
     474           0 :             bFlag = !pOpt->IsFldName() ;
     475             : 
     476           0 :         pOpt->SetFldName( bFlag );
     477           0 :         break;
     478             : 
     479             :     case FN_VIEW_MARKS:
     480           0 :         if( STATE_TOGGLE == eState )
     481           0 :             bFlag = !lcl_IsViewMarks(*pOpt) ;
     482             : 
     483           0 :         lcl_SetViewMarks( *pOpt, bFlag );
     484           0 :         break;
     485             : 
     486             :     case FN_VIEW_META_CHARS:
     487           0 :         if( STATE_TOGGLE == eState )
     488           0 :             bFlag = !pOpt->IsViewMetaChars();
     489             : 
     490           0 :         lcl_SetViewMetaChars( *pOpt, bFlag );
     491           0 :         break;
     492             : 
     493             :     case SID_AUTOSPELL_CHECK:
     494           0 :         if( STATE_TOGGLE == eState )
     495           0 :             bFlag = bSet = !pOpt->IsOnlineSpell();
     496             : 
     497           0 :         pOpt->SetOnlineSpell(bSet);
     498             :         {
     499           0 :             uno::Any aVal( &bSet, ::getCppuBooleanType() );
     500           0 :             OUString aPropName(UPN_IS_SPELL_AUTO);
     501             : 
     502           0 :             SvtLinguConfig  aCfg;
     503           0 :             aCfg.SetProperty( aPropName, aVal );
     504             : 
     505           0 :             if (xLngProp.is())
     506           0 :                 xLngProp->setIsSpellAuto( bSet );
     507             : 
     508             :             // for the time being we do not have a specific option for grammarchecking.
     509             :             // thus we'll use the one for spell checking...
     510           0 :             if (bSet)
     511             :             {
     512           0 :                 SwDocShell *pDocSh = GetDocShell();
     513           0 :                 SwDoc *pDoc = pDocSh? pDocSh->GetDoc() : NULL;
     514             : 
     515             :                 // right now we don't have view options for automatic grammar checking. Thus...
     516           0 :                 sal_Bool bIsAutoGrammar = sal_False;
     517           0 :                 aCfg.GetProperty( UPN_IS_GRAMMAR_AUTO ) >>= bIsAutoGrammar;
     518             : 
     519           0 :                 if (pDoc && bIsAutoGrammar)
     520           0 :                     StartGrammarChecking( *pDoc );
     521           0 :             }
     522             :         }
     523           0 :         break;
     524             : 
     525             :     case FN_SHADOWCURSOR:
     526           0 :         if( STATE_TOGGLE == eState )
     527           0 :             bFlag = bSet = !pOpt->IsShadowCursor();
     528             : 
     529           0 :         pOpt->SetShadowCursor(bSet);
     530           0 :         break;
     531             : 
     532             :     default:
     533           0 :         delete pOpt;
     534             :         OSL_FAIL("wrong request method");
     535           0 :         return;
     536             :     }
     537             : 
     538             :     // Set UserPrefs, mark request as modified
     539           0 :     sal_Bool bWebView =  0 != dynamic_cast<const SwWebView*>(this);
     540           0 :     SwWrtShell &rSh = GetWrtShell();
     541           0 :     rSh.StartAction();
     542           0 :     SwModule* pModule = SW_MOD();
     543           0 :     if( !(*rSh.GetViewOptions() == *pOpt ))
     544             :     {
     545           0 :         rSh.ApplyViewOptions( *pOpt );
     546           0 :         if( bBrowseModeChanged )
     547             :         {
     548           0 :             RecheckBrowseMode();
     549           0 :             CheckVisArea();
     550             :         }
     551             : 
     552             :         // The UsrPref must be marked as modified.
     553             :         // call for initialization
     554           0 :         pModule->GetUsrPref(bWebView);
     555           0 :         pModule->CheckSpellChanges( pOpt->IsOnlineSpell(), false, false, false );
     556             :     }
     557             :     //OS: Set back modified again, because view/fields sets the Doc modified.
     558           0 :     if( !bModified )
     559           0 :         rSh.ResetModified();
     560             : 
     561           0 :     pModule->ApplyUsrPref( *pOpt, this, bWebView ? VIEWOPT_DEST_WEB : VIEWOPT_DEST_TEXT );
     562             : 
     563             :     // #i6193# let postits know about new spellcheck setting
     564           0 :     if ( nSlot == SID_AUTOSPELL_CHECK )
     565           0 :         GetPostItMgr()->SetSpellChecking();
     566             : 
     567           0 :     const sal_Bool bLockedView = rSh.IsViewLocked();
     568           0 :     rSh.LockView( sal_True );    //lock visible section
     569           0 :     GetWrtShell().EndAction();
     570           0 :     if( bBrowseModeChanged && !bFlag )
     571           0 :         CalcVisArea( GetEditWin().GetOutputSizePixel() );
     572           0 :     rSh.LockView( bLockedView );
     573             : 
     574           0 :     delete pOpt;
     575           0 :     Invalidate(rReq.GetSlot());
     576           0 :     if(!pArgs)
     577           0 :         rReq.AppendItem(SfxBoolItem(nSlot, (sal_Bool)bFlag));
     578           0 :     rReq.Done();
     579           0 : }
     580             : 
     581             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10