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

Generated by: LCOV version 1.10