LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/app - appopt.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 257 0.4 %
Date: 2012-12-27 Functions: 2 5 40.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 <cmdid.h>          // Function-Ids
      21             : 
      22             : 
      23             : #include <com/sun/star/i18n/ScriptType.hpp>
      24             : 
      25             : #include <hintids.hxx>
      26             : #include <cmdid.h>          // Funktion-Ids
      27             : #include <vcl/msgbox.hxx>
      28             : #include <svl/eitem.hxx>
      29             : #include <sfx2/request.hxx>
      30             : #include <sfx2/app.hxx>
      31             : #include <sfx2/printer.hxx>
      32             : #include <svx/htmlmode.hxx>
      33             : #include <sfx2/bindings.hxx>
      34             : #include <editeng/brshitem.hxx>
      35             : #include <editeng/tstpitem.hxx>
      36             : #include <svx/optgrid.hxx>
      37             : #include <svx/svxdlg.hxx>
      38             : #include <svx/dialogs.hrc>
      39             : #include <i18npool/mslangid.hxx>
      40             : #include <i18npool/languagetag.hxx>
      41             : #include <fontcfg.hxx>
      42             : #include <optload.hxx>
      43             : #include <optcomp.hxx>
      44             : #include <edtwin.hxx>
      45             : #include <swmodule.hxx>
      46             : #include <view.hxx>
      47             : #include <doc.hxx>
      48             : #include <wrtsh.hxx>
      49             : #include <IDocumentDeviceAccess.hxx>
      50             : #include <uitool.hxx>
      51             : #include <initui.hxx>                   // for ::GetGlossaries()
      52             : #include <fldbas.hxx>      //for UpdateFields
      53             : #include <wview.hxx>
      54             : #include <cfgitems.hxx>
      55             : #include <prtopt.hxx>
      56             : #include <pview.hxx>
      57             : #include <usrpref.hxx>
      58             : #include <modcfg.hxx>
      59             : #include <glosdoc.hxx>
      60             : #include <uiitems.hxx>
      61             : #include <editeng/langitem.hxx>
      62             : #include <unotools/lingucfg.hxx>
      63             : #include <editeng/unolingu.hxx>
      64             : #include <globals.hrc>
      65             : #include <globals.h>        // e.g. global Constants
      66             : #include <svl/slstitm.hxx>
      67             : #include "swabstdlg.hxx"
      68             : #include <swwrtshitem.hxx>
      69             : 
      70             : #include <unomid.h>
      71             : 
      72             : using namespace ::com::sun::star::uno;
      73             : using namespace ::com::sun::star::lang;
      74             : 
      75           0 : SfxItemSet*  SwModule::CreateItemSet( sal_uInt16 nId )
      76             : {
      77           0 :     sal_Bool bTextDialog = (nId == SID_SW_EDITOPTIONS) ? sal_True : sal_False;
      78             : 
      79             :     // the options for the Web- and Textdialog are put together here
      80           0 :         SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
      81           0 :         SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
      82             :         // no MakeUsrPref, because only options from textdoks can be used here
      83           0 :         SwView* pAppView = GetView();
      84           0 :         if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
      85           0 :             pAppView = 0;
      86           0 :         if(pAppView)
      87             :         {
      88             :         // if Text then no WebView and vice versa
      89           0 :             sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pAppView);
      90           0 :             if( (bWebView &&  !bTextDialog) ||(!bWebView &&  bTextDialog))
      91             :             {
      92           0 :                 aViewOpt = *pAppView->GetWrtShell().GetViewOptions();
      93             :             }
      94             :             else
      95           0 :                 pAppView = 0; // with View, there's nothing to win here
      96             :         }
      97             : 
      98             :     /********************************************************************/
      99             :     /* Options/Edit                                                     */
     100             :     /********************************************************************/
     101           0 :     SfxItemSet* pRet = new SfxItemSet (GetPool(),   FN_PARAM_DOCDISP,       FN_PARAM_ELEM,
     102             :                                     SID_PRINTPREVIEW,       SID_PRINTPREVIEW,
     103             :                                     SID_ATTR_GRID_OPTIONS,  SID_ATTR_GRID_OPTIONS,
     104             :                                     FN_PARAM_PRINTER,       FN_PARAM_STDFONTS,
     105             :                                     FN_PARAM_WRTSHELL,      FN_PARAM_WRTSHELL,
     106             :                                     FN_PARAM_ADDPRINTER,    FN_PARAM_ADDPRINTER,
     107             :                                     SID_ATTR_METRIC,        SID_ATTR_METRIC,
     108             :                                     SID_ATTR_APPLYCHARUNIT, SID_ATTR_APPLYCHARUNIT,
     109             :                                     SID_ATTR_DEFTABSTOP,    SID_ATTR_DEFTABSTOP,
     110             :                                     RES_BACKGROUND,         RES_BACKGROUND,
     111             :                                     SID_HTML_MODE,          SID_HTML_MODE,
     112             :                                     FN_PARAM_SHADOWCURSOR,  FN_PARAM_SHADOWCURSOR,
     113             :                                     FN_PARAM_CRSR_IN_PROTECTED, FN_PARAM_CRSR_IN_PROTECTED,
     114             :                                     FN_HSCROLL_METRIC,      FN_VSCROLL_METRIC,
     115             :                                     SID_ATTR_LANGUAGE,      SID_ATTR_LANGUAGE,
     116             :                                     SID_ATTR_CHAR_CJK_LANGUAGE,   SID_ATTR_CHAR_CJK_LANGUAGE,
     117             :                                     SID_ATTR_CHAR_CTL_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
     118             : #if OSL_DEBUG_LEVEL > 1
     119             :                                     FN_PARAM_SWTEST,        FN_PARAM_SWTEST,
     120             : #endif
     121           0 :                                     0);
     122             : 
     123           0 :     pRet->Put( SwDocDisplayItem( aViewOpt, FN_PARAM_DOCDISP) );
     124           0 :     pRet->Put( SwElemItem( aViewOpt, FN_PARAM_ELEM) );
     125           0 :     if( bTextDialog )
     126             :     {
     127           0 :         pRet->Put( SwShadowCursorItem( aViewOpt, FN_PARAM_SHADOWCURSOR ));
     128           0 :         pRet->Put( SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aViewOpt.IsCursorInProtectedArea()));
     129             :     }
     130             : 
     131           0 :     if( pAppView )
     132             :     {
     133           0 :         SwWrtShell& rWrtShell = pAppView->GetWrtShell();
     134             : 
     135           0 :         SfxPrinter* pPrt = rWrtShell.getIDocumentDeviceAccess()->getPrinter( false );
     136           0 :         if( pPrt )
     137           0 :             pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));
     138           0 :         pRet->Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell));
     139             : 
     140             :         pRet->Put((const SvxLanguageItem&)
     141           0 :             rWrtShell.GetDefault(RES_CHRATR_LANGUAGE), SID_ATTR_LANGUAGE);
     142             : 
     143             :         pRet->Put((const SvxLanguageItem&)
     144           0 :             rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE), SID_ATTR_CHAR_CJK_LANGUAGE);
     145             : 
     146             :         pRet->Put((const SvxLanguageItem&)
     147           0 :             rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE), SID_ATTR_CHAR_CTL_LANGUAGE);
     148             :     }
     149             :     else
     150             :     {
     151           0 :         SvtLinguConfig aLinguCfg;
     152           0 :         com::sun::star::lang::Locale aLocale;
     153             :         LanguageType nLang;
     154             : 
     155             :         using namespace ::com::sun::star::i18n::ScriptType;
     156             : 
     157           0 :         Any aLang = aLinguCfg.GetProperty(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultLocale")));
     158           0 :         aLang >>= aLocale;
     159           0 :         nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag(aLocale).getLanguageType(false), LATIN);
     160           0 :         pRet->Put(SvxLanguageItem(nLang, SID_ATTR_LANGUAGE));
     161             : 
     162           0 :         aLang = aLinguCfg.GetProperty(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultLocale_CJK")));
     163           0 :         aLang >>= aLocale;
     164           0 :         nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag(aLocale).getLanguageType(false), ASIAN);
     165           0 :         pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CJK_LANGUAGE));
     166             : 
     167           0 :         aLang = aLinguCfg.GetProperty(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultLocale_CTL")));
     168           0 :         aLang >>= aLocale;
     169           0 :         nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag(aLocale).getLanguageType(false), COMPLEX);
     170           0 :         pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CTL_LANGUAGE));
     171             :     }
     172           0 :     if(bTextDialog)
     173           0 :         pRet->Put(SwPtrItem(FN_PARAM_STDFONTS, GetStdFontConfig()));
     174           0 :     if( PTR_CAST( SwPagePreView, SfxViewShell::Current())!=0)
     175             :     {
     176           0 :         SfxBoolItem aBool(SfxBoolItem(SID_PRINTPREVIEW, sal_True));
     177           0 :         pRet->Put(aBool);
     178             :     }
     179             : 
     180           0 :     FieldUnit eUnit = pPref->GetHScrollMetric();
     181           0 :     if(pAppView)
     182           0 :         pAppView->GetHLinealMetric(eUnit);
     183           0 :     pRet->Put(SfxUInt16Item( FN_HSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit)));
     184             : 
     185           0 :     eUnit = pPref->GetVScrollMetric();
     186           0 :     if(pAppView)
     187           0 :         pAppView->GetVLinealMetric(eUnit);
     188           0 :     pRet->Put(SfxUInt16Item( FN_VSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit) ));
     189           0 :     pRet->Put(SfxUInt16Item( SID_ATTR_METRIC, static_cast< sal_uInt16 >(pPref->GetMetric()) ));
     190           0 :     pRet->Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, pPref->IsApplyCharUnit()));
     191           0 :     if(bTextDialog)
     192             :     {
     193           0 :         if(pAppView)
     194             :         {
     195             :             const SvxTabStopItem& rDefTabs =
     196           0 :                     (const SvxTabStopItem&)pAppView->GetWrtShell().
     197           0 :                                         GetDefault(RES_PARATR_TABSTOP);
     198           0 :                 pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, (sal_uInt16)::GetTabDist(rDefTabs)));
     199             :         }
     200             :         else
     201           0 :             pRet->Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, (sal_uInt16)pPref->GetDefTab()));
     202             :     }
     203             : 
     204             :     // Options for GridTabPage
     205           0 :     SvxGridItem aGridItem( SID_ATTR_GRID_OPTIONS);
     206             : 
     207           0 :     aGridItem.SetUseGridSnap( aViewOpt.IsSnap());
     208           0 :     aGridItem.SetSynchronize( aViewOpt.IsSynchronize());
     209           0 :     aGridItem.SetGridVisible( aViewOpt.IsGridVisible());
     210             : 
     211           0 :     const Size& rSnapSize = aViewOpt.GetSnapSize();
     212           0 :     aGridItem.SetFldDrawX( (sal_uInt16) (rSnapSize.Width() ));
     213           0 :     aGridItem.SetFldDrawY( (sal_uInt16) (rSnapSize.Height()));
     214             : 
     215           0 :     aGridItem.SetFldDivisionX( aViewOpt.GetDivisionX());
     216           0 :     aGridItem.SetFldDivisionY( aViewOpt.GetDivisionY());
     217             : 
     218           0 :     pRet->Put(aGridItem);
     219             : 
     220             :     // Options for PrintTabPage
     221             :     const SwPrintData* pOpt = pAppView ?
     222           0 :                         &pAppView->GetWrtShell().getIDocumentDeviceAccess()->getPrintData() :
     223           0 :                         0;
     224             : 
     225           0 :     if(!pOpt)
     226           0 :         pOpt = GetPrtOptions(!bTextDialog);
     227             : 
     228           0 :     SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, *pOpt );
     229           0 :     pRet->Put(aAddPrinterItem);
     230             : 
     231             :     // Options for Web background
     232           0 :     if(!bTextDialog)
     233             :     {
     234           0 :         pRet->Put(SvxBrushItem(aViewOpt.GetRetoucheColor(), RES_BACKGROUND));
     235             :     }
     236             : 
     237           0 :     if(!bTextDialog)
     238           0 :         pRet->Put(SfxUInt16Item(SID_HTML_MODE, HTMLMODE_ON));
     239           0 :     return pRet;
     240             : }
     241             : 
     242           0 : void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
     243             : {
     244           0 :     sal_Bool bTextDialog = nId == SID_SW_EDITOPTIONS;
     245           0 :     SwView* pAppView = GetView();
     246           0 :     if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
     247           0 :         pAppView = 0;
     248           0 :     if(pAppView)
     249             :     {
     250             :         // the text dialog mustn't apply data to the web view and vice versa
     251           0 :         sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pAppView);
     252           0 :         if(bWebView == bTextDialog)
     253           0 :             pAppView = 0;
     254             :     }
     255             : 
     256           0 :     SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
     257           0 :     SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
     258             : 
     259             :     const SfxPoolItem* pItem;
     260           0 :     SfxBindings *pBindings = pAppView ? &pAppView->GetViewFrame()->GetBindings()
     261           0 :                                  : NULL;
     262             : 
     263             :     /*---------------------------------------------------------------------
     264             :             Interpret the page Documentview
     265             :     -----------------------------------------------------------------------*/
     266           0 :     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_DOCDISP, sal_False, &pItem ))
     267             :     {
     268           0 :         const SwDocDisplayItem* pDocDispItem = (const SwDocDisplayItem*)pItem;
     269             : 
     270           0 :         if(!aViewOpt.IsViewMetaChars())
     271             :         {
     272           0 :             if(     (!aViewOpt.IsTab( sal_True ) &&  pDocDispItem->bTab) ||
     273           0 :                     (!aViewOpt.IsBlank( sal_True ) && pDocDispItem->bSpace) ||
     274           0 :                     (!aViewOpt.IsParagraph( sal_True ) && pDocDispItem->bParagraphEnd) ||
     275           0 :                     (!aViewOpt.IsLineBreak( sal_True ) && pDocDispItem->bManualBreak) )
     276             :             {
     277           0 :                 aViewOpt.SetViewMetaChars(sal_True);
     278           0 :                 if(pBindings)
     279           0 :                     pBindings->Invalidate(FN_VIEW_META_CHARS);
     280             :             }
     281             : 
     282             :         }
     283           0 :         pDocDispItem->FillViewOptions( aViewOpt );
     284           0 :         if(pBindings)
     285             :         {
     286           0 :             pBindings->Invalidate(FN_VIEW_GRAPHIC);
     287           0 :             pBindings->Invalidate(FN_VIEW_HIDDEN_PARA);
     288             :         }
     289             :     }
     290             : 
     291             :     /*---------------------------------------------------------------------
     292             :                 Elements - interpret Item
     293             :     -----------------------------------------------------------------------*/
     294             : 
     295           0 :     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ELEM, sal_False, &pItem ) )
     296             :     {
     297           0 :         const SwElemItem* pElemItem = (const SwElemItem*)pItem;
     298           0 :         pElemItem->FillViewOptions( aViewOpt );
     299             : 
     300             :     }
     301             : 
     302           0 :     if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_METRIC, sal_False, &pItem ) )
     303             :     {
     304           0 :         SFX_APP()->SetOptions(rSet);
     305           0 :         const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
     306           0 :         ::SetDfltMetric((FieldUnit)pMetricItem->GetValue(), !bTextDialog);
     307             :     }
     308           0 :     if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_APPLYCHARUNIT,
     309           0 :                                                     sal_False, &pItem ) )
     310             :     {
     311           0 :         SFX_APP()->SetOptions(rSet);
     312           0 :         const SfxBoolItem* pCharItem = (const SfxBoolItem*)pItem;
     313           0 :         ::SetApplyCharUnit(pCharItem->GetValue(), !bTextDialog);
     314             :     }
     315             : 
     316           0 :     if( SFX_ITEM_SET == rSet.GetItemState(FN_HSCROLL_METRIC, sal_False, &pItem ) )
     317             :     {
     318           0 :         const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
     319           0 :         FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
     320           0 :         pPref->SetHScrollMetric(eUnit);
     321           0 :         if(pAppView)
     322           0 :             pAppView->ChangeTabMetric(eUnit);
     323             :     }
     324             : 
     325           0 :     if( SFX_ITEM_SET == rSet.GetItemState(FN_VSCROLL_METRIC, sal_False, &pItem ) )
     326             :     {
     327           0 :         const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
     328           0 :         FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
     329           0 :         pPref->SetVScrollMetric(eUnit);
     330           0 :         if(pAppView)
     331           0 :             pAppView->ChangeVLinealMetric(eUnit);
     332             :     }
     333             : 
     334           0 :     if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP, sal_False, &pItem ) )
     335             :     {
     336           0 :         sal_uInt16 nTabDist = ((const SfxUInt16Item*)pItem)->GetValue();
     337           0 :         pPref->SetDefTab(nTabDist);
     338           0 :         if(pAppView)
     339             :         {
     340           0 :             SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
     341           0 :             MakeDefTabs( nTabDist, aDefTabs );
     342           0 :             pAppView->GetWrtShell().SetDefault( aDefTabs );
     343             :         }
     344             :     }
     345             : 
     346             : 
     347             :     /*------------------------------------------------
     348             :         Background only in WebDialog
     349             :     --------------------------------------------------*/
     350           0 :     if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND))
     351             :     {
     352             :         const SvxBrushItem& rBrushItem = (const SvxBrushItem&)rSet.Get(
     353           0 :                                 RES_BACKGROUND);
     354           0 :         aViewOpt.SetRetoucheColor( rBrushItem.GetColor() );
     355             :     }
     356             : 
     357             :     /*--------------------------------------------------------------------
     358             :             Interpret page Grid Settings
     359             :     ----------------------------------------------------------------------*/
     360             : 
     361           0 :     if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS, sal_False, &pItem ))
     362             :     {
     363           0 :         const SvxGridItem* pGridItem = (const SvxGridItem*)pItem;
     364             : 
     365           0 :         aViewOpt.SetSnap( pGridItem->GetUseGridSnap() );
     366           0 :         aViewOpt.SetSynchronize(pGridItem->GetSynchronize());
     367           0 :         if( aViewOpt.IsGridVisible() != pGridItem->GetGridVisible() )
     368           0 :             aViewOpt.SetGridVisible( pGridItem->GetGridVisible());
     369           0 :         Size aSize = Size( pGridItem->GetFldDrawX()  ,
     370           0 :                             pGridItem->GetFldDrawY()  );
     371           0 :         if( aViewOpt.GetSnapSize() != aSize )
     372           0 :             aViewOpt.SetSnapSize( aSize );
     373           0 :         short nDiv = (short)pGridItem->GetFldDivisionX() ;
     374           0 :         if( aViewOpt.GetDivisionX() != nDiv  )
     375           0 :             aViewOpt.SetDivisionX( nDiv );
     376           0 :         nDiv = (short)pGridItem->GetFldDivisionY();
     377           0 :         if( aViewOpt.GetDivisionY() != nDiv  )
     378           0 :             aViewOpt.SetDivisionY( nDiv  );
     379             : 
     380           0 :         if(pBindings)
     381             :         {
     382           0 :             pBindings->Invalidate(SID_GRID_VISIBLE);
     383           0 :             pBindings->Invalidate(SID_GRID_USE);
     384             :         }
     385             :     }
     386             : 
     387             :     /*--------------------------------------------------------------------
     388             :             Interpret Writer Printer Options
     389             :     ----------------------------------------------------------------------*/
     390             : 
     391           0 :     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ADDPRINTER, sal_False, &pItem ))
     392             :     {
     393           0 :         SwPrintOptions* pOpt = GetPrtOptions(!bTextDialog);
     394           0 :         if (pOpt)
     395             :         {
     396           0 :             const SwAddPrinterItem* pAddPrinterAttr = (const SwAddPrinterItem*)pItem;
     397           0 :             *pOpt = *pAddPrinterAttr;
     398             : 
     399           0 :             if(pAppView)
     400           0 :                 pAppView->GetWrtShell().getIDocumentDeviceAccess()->setPrintData( *pOpt );
     401             :         }
     402             : 
     403             :     }
     404             : 
     405           0 :     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, sal_False, &pItem ))
     406             :     {
     407           0 :         ((SwShadowCursorItem*)pItem)->FillViewOptions( aViewOpt );
     408           0 :         if(pBindings)
     409           0 :             pBindings->Invalidate(FN_SHADOWCURSOR);
     410             :     }
     411             : 
     412           0 :     if( pAppView )
     413             :     {
     414           0 :         SwWrtShell &rWrtSh = pAppView->GetWrtShell();
     415           0 :         const bool bAlignFormulas = rWrtSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT );
     416           0 :         pPref->SetAlignMathObjectsToBaseline( bAlignFormulas );
     417             : 
     418             :         // don't align formulas in documents that are currently loading
     419           0 :         if (bAlignFormulas && !rWrtSh.GetDoc()->IsInReading())
     420           0 :             rWrtSh.AlignAllFormulasToBaseline();
     421             :     }
     422             : 
     423           0 :     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, sal_False, &pItem ))
     424             :     {
     425           0 :         aViewOpt.SetCursorInProtectedArea(((const SfxBoolItem*)pItem)->GetValue());
     426             :     }
     427             : 
     428             : 
     429             :         // set elements for the current view and shell
     430           0 :     ApplyUsrPref( aViewOpt, pAppView, bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB);
     431           0 : }
     432             : 
     433           0 : SfxTabPage* SwModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet )
     434             : {
     435           0 :     SfxTabPage* pRet = NULL;
     436           0 :     SfxAllItemSet aSet(*(rSet.GetPool()));
     437           0 :     switch( nId )
     438             :     {
     439             :         case RID_SW_TP_CONTENT_OPT:
     440             :         case RID_SW_TP_HTML_CONTENT_OPT:
     441             :         {
     442           0 :             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     443           0 :             if ( pFact )
     444             :             {
     445           0 :                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
     446           0 :                 if ( fnCreatePage )
     447           0 :                     pRet = (*fnCreatePage)( pParent, rSet );
     448             :             }
     449           0 :             break;
     450             :         }
     451             :         case RID_SW_TP_HTML_OPTGRID_PAGE:
     452             :         case RID_SVXPAGE_GRID:
     453           0 :             pRet = SvxGridTabPage::Create(pParent, rSet);
     454           0 :         break;
     455             : 
     456             :         case RID_SW_TP_STD_FONT:
     457             :         case RID_SW_TP_STD_FONT_CJK:
     458             :         case RID_SW_TP_STD_FONT_CTL:
     459             :         {
     460           0 :             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     461           0 :             if ( pFact )
     462             :             {
     463           0 :                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
     464           0 :                 if ( fnCreatePage )
     465           0 :                     pRet = (*fnCreatePage)( pParent, rSet );
     466             :             }
     467           0 :             if(RID_SW_TP_STD_FONT != nId)
     468             :             {
     469           0 :                 aSet.Put (SfxUInt16Item(SID_FONTMODE_TYPE, RID_SW_TP_STD_FONT_CJK == nId ? FONT_GROUP_CJK : FONT_GROUP_CTL));
     470           0 :                 pRet->PageCreated(aSet);
     471             :             }
     472             :         }
     473           0 :         break;
     474             :         case RID_SW_TP_HTML_OPTPRINT_PAGE:
     475             :         case RID_SW_TP_OPTPRINT_PAGE:
     476             :         {
     477           0 :             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     478           0 :             if ( pFact )
     479             :             {
     480           0 :                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
     481           0 :                 if ( fnCreatePage )
     482           0 :                     pRet = (*fnCreatePage)( pParent, rSet );
     483             :             }
     484           0 :             aSet.Put (SfxBoolItem(SID_FAX_LIST, sal_True));
     485           0 :             pRet->PageCreated(aSet);
     486             :         }
     487           0 :         break;
     488             :         case RID_SW_TP_HTML_OPTTABLE_PAGE:
     489             :         case RID_SW_TP_OPTTABLE_PAGE:
     490             :         {
     491           0 :             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     492           0 :             if ( pFact )
     493             :             {
     494           0 :                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
     495           0 :                 if ( fnCreatePage )
     496           0 :                     pRet = (*fnCreatePage)( pParent, rSet );
     497             :             }
     498           0 :             SwView* pCurrView = GetView();
     499           0 :             if(pCurrView)
     500             :             {
     501             :                 // if text then not WebView and vice versa
     502           0 :                 sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pCurrView);
     503           0 :                 if( (bWebView &&  RID_SW_TP_HTML_OPTTABLE_PAGE == nId) ||
     504             :                     (!bWebView &&  RID_SW_TP_HTML_OPTTABLE_PAGE != nId) )
     505             :                 {
     506           0 :                     aSet.Put (SwWrtShellItem(SID_WRT_SHELL,pCurrView->GetWrtShellPtr()));
     507           0 :                     pRet->PageCreated(aSet);
     508             :                 }
     509             :             }
     510             :         }
     511           0 :         break;
     512             :         case RID_SW_TP_OPTSHDWCRSR:
     513             :         case RID_SW_TP_HTML_OPTSHDWCRSR:
     514             :         case RID_SW_TP_REDLINE_OPT:
     515             :         case RID_SW_TP_COMPARISON_OPT:
     516             :         case RID_SW_TP_OPTLOAD_PAGE:
     517             :         case RID_SW_TP_OPTCOMPATIBILITY_PAGE:
     518             :         case RID_SW_TP_MAILCONFIG:
     519             :         {
     520           0 :             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     521           0 :             if ( pFact )
     522             :             {
     523           0 :                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
     524           0 :                 if ( fnCreatePage )
     525           0 :                     pRet = (*fnCreatePage)( pParent, rSet );
     526             :             }
     527           0 :             if (pRet && (nId == RID_SW_TP_OPTSHDWCRSR || nId == RID_SW_TP_HTML_OPTSHDWCRSR))
     528             :             {
     529           0 :                 SwView* pCurrView = GetView();
     530           0 :                 if(pCurrView)
     531             :                 {
     532           0 :                     aSet.Put( SwWrtShellItem( SID_WRT_SHELL, pCurrView->GetWrtShellPtr() ) );
     533           0 :                     pRet->PageCreated(aSet);
     534             :                 }
     535             :             }
     536             :         }
     537           0 :         break;
     538             :         case  RID_SW_TP_OPTTEST_PAGE:
     539             :         {
     540           0 :             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     541           0 :             if ( pFact )
     542             :             {
     543           0 :                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
     544           0 :                 if ( fnCreatePage )
     545           0 :                     pRet = (*fnCreatePage)( pParent, rSet );
     546             :             }
     547           0 :             break;
     548             :         }
     549             :         case  RID_SW_TP_BACKGROUND:
     550             :         {
     551           0 :             SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
     552           0 :             if ( pFact )
     553             :             {
     554           0 :                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND );
     555           0 :                 if ( fnCreatePage )
     556           0 :                     pRet = (*fnCreatePage)( pParent, rSet );
     557             :             }
     558           0 :             break;
     559             :         }
     560             :         case TP_OPTCAPTION_PAGE:
     561             :         case RID_SW_TP_OPTCAPTION_PAGE:
     562             :         {
     563           0 :             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     564           0 :             if ( pFact )
     565             :             {
     566           0 :                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SW_TP_OPTCAPTION_PAGE );
     567           0 :                 if ( fnCreatePage )
     568           0 :                     pRet = (*fnCreatePage)( pParent, rSet );
     569             :             }
     570             :         }
     571           0 :         break;
     572             :     }
     573             : 
     574             :     if(!pRet)
     575             :         SAL_WARN( "sw", "SwModule::CreateTabPage(): Unknown tabpage id " << nId );
     576           0 :     return pRet;
     577          30 : }
     578             : 
     579             : 
     580             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10