LCOV - code coverage report
Current view: top level - sw/source/ui/app - appopt.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 256 0.0 %
Date: 2012-08-25 Functions: 0 3 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 654 0.0 %

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

Generated by: LCOV version 1.10