LCOV - code coverage report
Current view: top level - sw/source/core/uibase/app - swmodul1.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 167 314 53.2 %
Date: 2014-04-11 Functions: 23 39 59.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 <boost/scoped_ptr.hpp>
      21             : 
      22             : #include <hintids.hxx>
      23             : #include <sfx2/request.hxx>
      24             : #include <sfx2/dispatch.hxx>
      25             : #include <sfx2/childwin.hxx>
      26             : #include <unotools/useroptions.hxx>
      27             : #include <cppuhelper/weak.hxx>
      28             : #include <com/sun/star/frame/FrameSearchFlag.hpp>
      29             : #include <com/sun/star/view/XSelectionSupplier.hpp>
      30             : #include <cppuhelper/implbase1.hxx>
      31             : #include <svx/dataaccessdescriptor.hxx>
      32             : #include <editeng/wghtitem.hxx>
      33             : #include <editeng/postitem.hxx>
      34             : #include <editeng/udlnitem.hxx>
      35             : #include <editeng/crossedoutitem.hxx>
      36             : #include <editeng/cmapitem.hxx>
      37             : #include <editeng/colritem.hxx>
      38             : #include <editeng/brushitem.hxx>
      39             : #include <vcl/msgbox.hxx>
      40             : #include <svl/cjkoptions.hxx>
      41             : #include <swmodule.hxx>
      42             : #include <swtypes.hxx>
      43             : #include <usrpref.hxx>
      44             : #include <modcfg.hxx>
      45             : #include <view.hxx>
      46             : #include <pview.hxx>
      47             : #include <wview.hxx>
      48             : #include <wrtsh.hxx>
      49             : #include <docsh.hxx>
      50             : #include <dbmgr.hxx>
      51             : #include <uinums.hxx>
      52             : #include <prtopt.hxx>
      53             : #include <navicfg.hxx>
      54             : #include <doc.hxx>
      55             : #include <cmdid.h>
      56             : #include <app.hrc>
      57             : #include "helpid.h"
      58             : 
      59             : #include <unomid.h>
      60             : #include <tools/color.hxx>
      61             : #include "PostItMgr.hxx"
      62             : 
      63             : using namespace ::svx;
      64             : using namespace ::com::sun::star;
      65             : using namespace ::com::sun::star::uno;
      66             : using namespace ::com::sun::star::beans;
      67             : using namespace ::com::sun::star::frame;
      68             : using namespace ::com::sun::star::view;
      69             : using namespace ::com::sun::star::lang;
      70             : 
      71         111 : static void lcl_SetUIPrefs(const SwViewOption &rPref, SwView* pView, SwViewShell* pSh )
      72             : {
      73             :     // in FrameSets the actual visibility can differ from the ViewOption's setting
      74         111 :     bool bVScrollChanged = rPref.IsViewVScrollBar() != pSh->GetViewOptions()->IsViewVScrollBar();
      75         111 :     bool bHScrollChanged = rPref.IsViewHScrollBar() != pSh->GetViewOptions()->IsViewHScrollBar();
      76         111 :     bool bVAlignChanged = rPref.IsVRulerRight() != pSh->GetViewOptions()->IsVRulerRight();
      77             : 
      78         111 :     pSh->SetUIOptions(rPref);
      79         111 :     const SwViewOption* pNewPref = pSh->GetViewOptions();
      80             : 
      81             :     // Scrollbars on / off
      82         111 :     if(bVScrollChanged)
      83             :     {
      84           3 :         pView->EnableVScrollbar(pNewPref->IsViewVScrollBar());
      85             :     }
      86         111 :     if(bHScrollChanged)
      87             :     {
      88           3 :         pView->EnableHScrollbar( pNewPref->IsViewHScrollBar() || pNewPref->getBrowseMode() );
      89             :     }
      90             :     //if only the position of the vertical ruler has been changed initiate an update
      91         111 :     if(bVAlignChanged && !bHScrollChanged && !bVScrollChanged)
      92           3 :         pView->InvalidateBorder();
      93             : 
      94             :     // Rulers on / off
      95         111 :     if(pNewPref->IsViewVRuler())
      96          50 :         pView->CreateVRuler();
      97             :     else
      98          61 :         pView->KillVRuler();
      99             : 
     100             :     // TabWindow on / off
     101         111 :     if(pNewPref->IsViewHRuler())
     102          53 :         pView->CreateTab();
     103             :     else
     104          58 :         pView->KillTab();
     105             : 
     106         111 :     pView->GetPostItMgr()->PrepareView(true);
     107         111 : }
     108             : 
     109           0 : SwWrtShell* GetActiveWrtShell()
     110             : {
     111           0 :     SwView *pActive = ::GetActiveView();
     112           0 :     if( pActive )
     113           0 :         return &pActive->GetWrtShell();
     114           0 :     return 0;
     115             : }
     116             : 
     117           0 : SwView* GetActiveView()
     118             : {
     119           0 :     SfxViewShell* pView = SfxViewShell::Current();
     120           0 :     return PTR_CAST( SwView, pView );
     121             : }
     122             : 
     123           1 : SwView* SwModule::GetFirstView()
     124             : {
     125             :     // returns only sivible SwView
     126           1 :     const TypeId aTypeId = TYPE(SwView);
     127           1 :     SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId);
     128           1 :     return pView;
     129             : }
     130             : 
     131           1 : SwView* SwModule::GetNextView(SwView* pView)
     132             : {
     133             :     OSL_ENSURE(PTR_CAST(SwView, pView),"return no SwView");
     134           1 :     const TypeId aTypeId = TYPE(SwView);
     135           1 :     SwView* pNView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId, true);
     136           1 :     return pNView;
     137             : }
     138             : 
     139             : // New Master for the settings is set; this affects the current view and all following.
     140         111 : void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView,
     141             :                             sal_uInt16 nDest )
     142             : {
     143         111 :     SwView* pCurrView = pActView;
     144         111 :     SwViewShell* pSh = pCurrView ? &pCurrView->GetWrtShell() : 0;
     145             : 
     146             :     SwMasterUsrPref* pPref = (SwMasterUsrPref*)GetUsrPref( static_cast< sal_Bool >(
     147             :                                          VIEWOPT_DEST_WEB == nDest ? sal_True  :
     148             :                                          VIEWOPT_DEST_TEXT== nDest ? sal_False :
     149         111 :                                          pCurrView && pCurrView->ISA(SwWebView) ));
     150             : 
     151             :     // with Uno, only sdbcx::View, but not the Module should be changed
     152         111 :     bool bViewOnly = VIEWOPT_DEST_VIEW_ONLY == nDest;
     153             :     // fob Preview off
     154             :     SwPagePreview* pPPView;
     155         111 :     if( !pCurrView && 0 != (pPPView = PTR_CAST( SwPagePreview, SfxViewShell::Current())) )
     156             :     {
     157           0 :         if(!bViewOnly)
     158           0 :             pPref->SetUIOptions( rUsrPref );
     159           0 :         pPPView->EnableVScrollbar(pPref->IsViewVScrollBar());
     160           0 :         pPPView->EnableHScrollbar(pPref->IsViewHScrollBar());
     161           0 :         if(!bViewOnly)
     162             :         {
     163           0 :             pPref->SetPagePrevRow(rUsrPref.GetPagePrevRow());
     164           0 :             pPref->SetPagePrevCol(rUsrPref.GetPagePrevCol());
     165             :         }
     166           0 :         return;
     167             :     }
     168             : 
     169         111 :     if(!bViewOnly)
     170             :     {
     171           0 :         pPref->SetUsrPref( rUsrPref );
     172           0 :         pPref->SetModified();
     173             :     }
     174             : 
     175         111 :     if( !pCurrView )
     176           0 :         return;
     177             : 
     178             :     // Passing on to CORE
     179             :     sal_Bool bReadonly;
     180         111 :     const SwDocShell* pDocSh = pCurrView->GetDocShell();
     181         111 :     if (pDocSh)
     182         111 :         bReadonly = pDocSh->IsReadOnly();
     183             :     else //Use existing option if DocShell missing
     184           0 :         bReadonly = pSh->GetViewOptions()->IsReadonly();
     185         111 :     boost::scoped_ptr<SwViewOption> xViewOpt;
     186         111 :     if (!bViewOnly)
     187           0 :         xViewOpt.reset(new SwViewOption(*pPref));
     188             :     else
     189         111 :         xViewOpt.reset(new SwViewOption(rUsrPref));
     190         111 :     xViewOpt->SetReadonly( bReadonly );
     191         111 :     if( !(*pSh->GetViewOptions() == *xViewOpt) )
     192             :     {
     193             :         //is maybe only a SwViewShell
     194          68 :         pSh->StartAction();
     195          68 :         pSh->ApplyViewOptions( *xViewOpt );
     196          68 :         ((SwWrtShell*)pSh)->SetReadOnlyAvailable(xViewOpt->IsCursorInProtectedArea());
     197          68 :         pSh->EndAction();
     198             :     }
     199         111 :     if ( pSh->GetViewOptions()->IsReadonly() != bReadonly )
     200           0 :         pSh->SetReadonlyOption(bReadonly);
     201             : 
     202         111 :     lcl_SetUIPrefs(*xViewOpt, pCurrView, pSh);
     203             : 
     204             :     // in the end the Idle-Flag is set again
     205         111 :     pPref->SetIdle(sal_True);
     206             : }
     207             : 
     208           0 : void SwModule::ApplyUserMetric( FieldUnit eMetric, bool bWeb )
     209             : {
     210             :         SwMasterUsrPref* pPref;
     211           0 :         if(bWeb)
     212             :         {
     213           0 :             if(!pWebUsrPref)
     214           0 :                 GetUsrPref(sal_True);
     215           0 :             pPref = pWebUsrPref;
     216             :         }
     217             :         else
     218             :         {
     219           0 :             if(!pUsrPref)
     220           0 :                 GetUsrPref(sal_False);
     221           0 :             pPref = pUsrPref;
     222             :         }
     223           0 :         FieldUnit eOldMetric = pPref->GetMetric();
     224           0 :         if(eOldMetric != eMetric)
     225           0 :             pPref->SetMetric(eMetric);
     226             : 
     227           0 :         FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : eMetric;
     228           0 :         FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : eMetric;
     229             : 
     230           0 :         SwView* pTmpView = SwModule::GetFirstView();
     231             :         // switch the ruler for all MDI-Windows
     232           0 :         while(pTmpView)
     233             :         {
     234           0 :             if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView)))
     235             :             {
     236           0 :                 pTmpView->ChangeVRulerMetric(eVScrollMetric);
     237           0 :                 pTmpView->ChangeTabMetric(eHScrollMetric);
     238             :             }
     239             : 
     240           0 :             pTmpView = SwModule::GetNextView(pTmpView);
     241             :         }
     242           0 : }
     243             : 
     244           0 : void SwModule::ApplyRulerMetric( FieldUnit eMetric, sal_Bool bHorizontal, bool bWeb )
     245             : {
     246             :     SwMasterUsrPref* pPref;
     247           0 :     if(bWeb)
     248             :     {
     249           0 :         if(!pWebUsrPref)
     250           0 :             GetUsrPref(sal_True);
     251           0 :         pPref = pWebUsrPref;
     252             :     }
     253             :     else
     254             :     {
     255           0 :         if(!pUsrPref)
     256           0 :             GetUsrPref(sal_False);
     257           0 :         pPref = pUsrPref;
     258             :     }
     259           0 :     if( bHorizontal )
     260           0 :         pPref->SetHScrollMetric(eMetric);
     261             :     else
     262           0 :         pPref->SetVScrollMetric(eMetric);
     263             : 
     264           0 :     SwView* pTmpView = SwModule::GetFirstView();
     265             :     // switch metric at the appropriate rulers
     266           0 :     while(pTmpView)
     267             :     {
     268           0 :         if(bWeb == (0 != dynamic_cast<SwWebView *>( pTmpView )))
     269             :         {
     270           0 :             if( bHorizontal )
     271           0 :                 pTmpView->ChangeTabMetric(eMetric);
     272             :             else
     273           0 :                 pTmpView->ChangeVRulerMetric(eMetric);
     274             :         }
     275           0 :         pTmpView = SwModule::GetNextView(pTmpView);
     276             :     }
     277           0 : }
     278             : 
     279             : //set the usrpref 's char unit attribute and set rulers unit as char if the "apply char unit" is checked
     280           0 : void SwModule::ApplyUserCharUnit(sal_Bool bApplyChar, bool bWeb)
     281             : {
     282             :     SwMasterUsrPref* pPref;
     283           0 :     if(bWeb)
     284             :     {
     285           0 :         if(!pWebUsrPref)
     286           0 :             GetUsrPref(sal_True);
     287           0 :         pPref = pWebUsrPref;
     288             :     }
     289             :     else
     290             :     {
     291           0 :         if(!pUsrPref)
     292           0 :             GetUsrPref(sal_False);
     293           0 :         pPref = pUsrPref;
     294             :     }
     295           0 :     sal_Bool bOldApplyCharUnit = pPref->IsApplyCharUnit();
     296           0 :     bool bHasChanged = false;
     297           0 :     if(bOldApplyCharUnit != bApplyChar)
     298             :     {
     299           0 :         pPref->SetApplyCharUnit(bApplyChar);
     300           0 :         bHasChanged = true;
     301             :     }
     302             : 
     303           0 :     if( !bHasChanged )
     304           0 :         return;
     305             : 
     306           0 :     FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : pPref->GetMetric();
     307           0 :     FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : pPref->GetMetric();
     308           0 :     if(bApplyChar)
     309             :     {
     310           0 :         eHScrollMetric = FUNIT_CHAR;
     311           0 :         eVScrollMetric = FUNIT_LINE;
     312             :     }
     313             :     else
     314             :     {
     315           0 :         SvtCJKOptions aCJKOptions;
     316           0 :         if ( !aCJKOptions.IsAsianTypographyEnabled() && ( eHScrollMetric == FUNIT_CHAR ))
     317           0 :             eHScrollMetric = FUNIT_INCH;
     318           0 :         else if ( eHScrollMetric == FUNIT_CHAR )
     319           0 :             eHScrollMetric = FUNIT_CM;
     320           0 :         if ( !aCJKOptions.IsAsianTypographyEnabled() && ( eVScrollMetric == FUNIT_LINE ))
     321           0 :             eVScrollMetric = FUNIT_INCH;
     322           0 :         else if ( eVScrollMetric == FUNIT_LINE )
     323           0 :             eVScrollMetric = FUNIT_CM;
     324             :     }
     325           0 :     SwView* pTmpView = SwModule::GetFirstView();
     326             :     // switch rulers for all MDI-Windows
     327           0 :     while(pTmpView)
     328             :     {
     329           0 :         if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView)))
     330             :         {
     331           0 :             pTmpView->ChangeVRulerMetric(eVScrollMetric);
     332           0 :             pTmpView->ChangeTabMetric(eHScrollMetric);
     333             :         }
     334             : 
     335           0 :         pTmpView = SwModule::GetNextView(pTmpView);
     336             :     }
     337             : }
     338             : 
     339           0 : SwNavigationConfig*  SwModule::GetNavigationConfig()
     340             : {
     341           0 :     if(!pNavigationConfig)
     342             :     {
     343           0 :         pNavigationConfig = new SwNavigationConfig;
     344             :     }
     345           0 :     return pNavigationConfig;
     346             : }
     347             : 
     348        1775 : SwPrintOptions*     SwModule::GetPrtOptions(sal_Bool bWeb)
     349             : {
     350        1775 :     if(bWeb && !pWebPrtOpt)
     351             :     {
     352           1 :         pWebPrtOpt = new SwPrintOptions(sal_True);
     353             :     }
     354        1774 :     else if(!bWeb && !pPrtOpt)
     355             :     {
     356          32 :         pPrtOpt = new SwPrintOptions(sal_False);
     357             :     }
     358             : 
     359        1775 :     return bWeb ? pWebPrtOpt : pPrtOpt;
     360             : }
     361             : 
     362           0 : SwChapterNumRules*  SwModule::GetChapterNumRules()
     363             : {
     364           0 :     if(!pChapterNumRules)
     365           0 :         pChapterNumRules = new SwChapterNumRules;
     366           0 :     return pChapterNumRules;
     367             : }
     368             : 
     369           1 : void SwModule::ShowDBObj(SwView& rView, const SwDBData& rData, sal_Bool /*bOnlyIfAvailable*/)
     370             : {
     371           1 :     Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface();
     372           2 :     Reference<XDispatchProvider> xDP(xFrame, uno::UNO_QUERY);
     373             : 
     374           2 :     uno::Reference<XFrame> xBeamerFrame = xFrame->findFrame("_beamer", FrameSearchFlag::CHILDREN);
     375           1 :     if (xBeamerFrame.is())
     376             :     {   // the beamer has been opened by the SfxViewFrame
     377           1 :         Reference<XController> xController = xBeamerFrame->getController();
     378           2 :         Reference<XSelectionSupplier> xControllerSelection(xController, UNO_QUERY);
     379           1 :         if (xControllerSelection.is())
     380             :         {
     381             : 
     382           1 :             ODataAccessDescriptor aSelection;
     383           1 :             aSelection.setDataSource(rData.sDataSource);
     384           1 :             aSelection[daCommand]       <<= rData.sCommand;
     385           1 :             aSelection[daCommandType]   <<= rData.nCommandType;
     386           1 :             xControllerSelection->select(makeAny(aSelection.createPropertyValueSequence()));
     387             :         }
     388             :         else {
     389             :             OSL_FAIL("no selection supplier in the beamer!");
     390           1 :         }
     391           1 :     }
     392           1 : }
     393             : 
     394        2513 : sal_uInt16 SwModule::GetRedlineAuthor()
     395             : {
     396        2513 :     if (!bAuthorInitialised)
     397             :     {
     398          35 :         const SvtUserOptions& rOpt = GetUserOptions();
     399          35 :         sActAuthor = rOpt.GetFullName();
     400          35 :         if (sActAuthor.isEmpty())
     401             :         {
     402          35 :             sActAuthor = rOpt.GetID();
     403          35 :             if (sActAuthor.isEmpty())
     404          35 :                 sActAuthor = SW_RESSTR( STR_REDLINE_UNKNOWN_AUTHOR );
     405             :         }
     406          35 :         bAuthorInitialised = sal_True;
     407             :     }
     408        2513 :     return InsertRedlineAuthor( sActAuthor );
     409             : }
     410             : 
     411        2698 : void SwModule::SetRedlineAuthor(const OUString &rAuthor)
     412             : {
     413        2698 :     bAuthorInitialised = sal_True;
     414        2698 :     sActAuthor = rAuthor;
     415        2698 :     InsertRedlineAuthor( sActAuthor );
     416        2698 : }
     417             : 
     418          27 : OUString SwModule::GetRedlineAuthor(sal_uInt16 nPos)
     419             : {
     420             :     OSL_ENSURE(nPos < pAuthorNames->size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
     421          54 :     while(!(nPos < pAuthorNames->size()))
     422             :     {
     423           0 :         InsertRedlineAuthor("nn");
     424             :     };
     425          27 :     return (*pAuthorNames)[nPos];
     426             : }
     427             : 
     428       22748 : sal_uInt16 SwModule::InsertRedlineAuthor(const OUString& rAuthor)
     429             : {
     430       22748 :     sal_uInt16 nPos = 0;
     431             : 
     432       74465 :     while(nPos < pAuthorNames->size() && (*pAuthorNames)[nPos] != rAuthor)
     433       28969 :         ++nPos;
     434             : 
     435       22748 :     if (nPos == pAuthorNames->size())
     436          87 :         pAuthorNames->push_back(rAuthor);
     437             : 
     438       22748 :     return nPos;
     439             : }
     440             : 
     441        1405 : static void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet,
     442             :                         const AuthorCharAttr &rAttr )
     443             : {
     444        1405 :     Color aCol( rAttr.nColor );
     445             : 
     446        1405 :     if( COL_TRANSPARENT == rAttr.nColor )
     447             :     {
     448             :         static const ColorData aColArr[] = {
     449             :          COL_AUTHOR1_DARK,      COL_AUTHOR2_DARK,   COL_AUTHOR3_DARK,
     450             :          COL_AUTHOR4_DARK,      COL_AUTHOR5_DARK,   COL_AUTHOR6_DARK,
     451             :          COL_AUTHOR7_DARK,      COL_AUTHOR8_DARK,   COL_AUTHOR9_DARK };
     452             : 
     453        1405 :         aCol.SetColor( aColArr[ nAuthor % (sizeof( aColArr ) /
     454        1405 :                                            sizeof( aColArr[0] )) ] );
     455             :     }
     456             : 
     457        1405 :     bool bBackGr = COL_NONE == rAttr.nColor;
     458             : 
     459        1405 :     switch (rAttr.nItemId)
     460             :     {
     461             :     case SID_ATTR_CHAR_WEIGHT:
     462             :         {
     463         506 :             SvxWeightItem aW( (FontWeight)rAttr.nAttr, RES_CHRATR_WEIGHT );
     464         506 :             rSet.Put( aW );
     465         506 :             aW.SetWhich( RES_CHRATR_CJK_WEIGHT );
     466         506 :             rSet.Put( aW );
     467         506 :             aW.SetWhich( RES_CHRATR_CTL_WEIGHT );
     468         506 :             rSet.Put( aW );
     469             :         }
     470         506 :         break;
     471             : 
     472             :     case SID_ATTR_CHAR_POSTURE:
     473             :         {
     474           0 :             SvxPostureItem aP( (FontItalic)rAttr.nAttr, RES_CHRATR_POSTURE );
     475           0 :             rSet.Put( aP );
     476           0 :             aP.SetWhich( RES_CHRATR_CJK_POSTURE );
     477           0 :             rSet.Put( aP );
     478           0 :             aP.SetWhich( RES_CHRATR_CTL_POSTURE );
     479           0 :             rSet.Put( aP );
     480             :         }
     481           0 :         break;
     482             : 
     483             :     case SID_ATTR_CHAR_UNDERLINE:
     484             :         rSet.Put( SvxUnderlineItem( (FontUnderline)rAttr.nAttr,
     485         186 :                                     RES_CHRATR_UNDERLINE));
     486         186 :         break;
     487             : 
     488             :     case SID_ATTR_CHAR_STRIKEOUT:
     489             :         rSet.Put(SvxCrossedOutItem( (FontStrikeout)rAttr.nAttr,
     490         713 :                                     RES_CHRATR_CROSSEDOUT));
     491         713 :         break;
     492             : 
     493             :     case SID_ATTR_CHAR_CASEMAP:
     494             :         rSet.Put( SvxCaseMapItem( (SvxCaseMap)rAttr.nAttr,
     495           0 :                                     RES_CHRATR_CASEMAP));
     496           0 :         break;
     497             : 
     498             :     case SID_ATTR_BRUSH:
     499           0 :         rSet.Put( SvxBrushItem( aCol, RES_CHRATR_BACKGROUND ));
     500           0 :         bBackGr = true;
     501           0 :         break;
     502             :     }
     503             : 
     504        1405 :     if( !bBackGr )
     505        1405 :         rSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
     506        1405 : }
     507             : 
     508         186 : void SwModule::GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
     509             : {
     510         186 :     lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetInsertAuthorAttr());
     511         186 : }
     512             : 
     513         713 : void SwModule::GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
     514             : {
     515         713 :     lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetDeletedAuthorAttr());
     516         713 : }
     517             : 
     518             : // For future extension:
     519         506 : void SwModule::GetFormatAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet )
     520             : {
     521         506 :     lcl_FillAuthorAttr( nAuthor, rSet, pModuleConfig->GetFormatAuthorAttr() );
     522         506 : }
     523             : 
     524       60925 : sal_uInt16 SwModule::GetRedlineMarkPos()
     525             : {
     526       60925 :     return pModuleConfig->GetMarkAlignMode();
     527             : }
     528             : 
     529           0 : sal_Bool SwModule::IsInsTblFormatNum(sal_Bool bHTML) const
     530             : {
     531           0 :     return pModuleConfig->IsInsTblFormatNum(bHTML);
     532             : }
     533             : 
     534           0 : sal_Bool SwModule::IsInsTblChangeNumFormat(sal_Bool bHTML) const
     535             : {
     536           0 :     return pModuleConfig->IsInsTblChangeNumFormat(bHTML);
     537             : }
     538             : 
     539          77 : sal_Bool SwModule::IsInsTblAlignNum(sal_Bool bHTML) const
     540             : {
     541          77 :     return pModuleConfig->IsInsTblAlignNum(bHTML);
     542             : }
     543             : 
     544         177 : const Color &SwModule::GetRedlineMarkColor()
     545             : {
     546         177 :     return pModuleConfig->GetMarkAlignColor();
     547             : }
     548             : 
     549        1808 : const SwViewOption* SwModule::GetViewOption(sal_Bool bWeb)
     550             : {
     551        1808 :     return GetUsrPref( bWeb );
     552             : }
     553             : 
     554          12 : OUString SwModule::GetDocStatWordDelim() const
     555             : {
     556          12 :     return pModuleConfig->GetWordDelimiter();
     557             : }
     558             : 
     559             : // Passing-through of the ModuleConfig's Metric (for HTML-Export)
     560          87 : sal_uInt16 SwModule::GetMetric( sal_Bool bWeb ) const
     561             : {
     562             :     SwMasterUsrPref* pPref;
     563          87 :     if(bWeb)
     564             :     {
     565           1 :         if(!pWebUsrPref)
     566           0 :             GetUsrPref(sal_True);
     567           1 :         pPref = pWebUsrPref;
     568             :     }
     569             :     else
     570             :     {
     571          86 :         if(!pUsrPref)
     572           0 :             GetUsrPref(sal_False);
     573          86 :         pPref = pUsrPref;
     574             :     }
     575          87 :     return static_cast< sal_uInt16 >(pPref->GetMetric());
     576             : }
     577             : 
     578             : // Pass-through Update-Status
     579        1268 : sal_uInt16 SwModule::GetLinkUpdMode( sal_Bool ) const
     580             : {
     581        1268 :     if(!pUsrPref)
     582           0 :         GetUsrPref(sal_False);
     583        1268 :     return (sal_uInt16)pUsrPref->GetUpdateLinkMode();
     584             : }
     585             : 
     586         301 : SwFldUpdateFlags SwModule::GetFldUpdateFlags( sal_Bool ) const
     587             : {
     588         301 :     if(!pUsrPref)
     589           8 :         GetUsrPref(sal_False);
     590         301 :     return pUsrPref->GetFldUpdateFlags();
     591             : }
     592             : 
     593           0 : void SwModule::ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags)
     594             : {
     595           0 :     if(!pUsrPref)
     596           0 :         GetUsrPref(sal_False);
     597           0 :     pUsrPref->SetFldUpdateFlags(eFldFlags);
     598           0 : }
     599             : 
     600           0 : void SwModule::ApplyLinkMode(sal_Int32 nNewLinkMode)
     601             : {
     602           0 :     if(!pUsrPref)
     603           0 :         GetUsrPref(sal_False);
     604           0 :     pUsrPref->SetUpdateLinkMode(nNewLinkMode);
     605           0 : }
     606             : 
     607           5 : void SwModule::CheckSpellChanges( bool bOnlineSpelling,
     608             :         bool bIsSpellWrongAgain, bool bIsSpellAllAgain, bool bSmartTags )
     609             : {
     610           5 :     bool bOnlyWrong = bIsSpellWrongAgain && !bIsSpellAllAgain;
     611           5 :     bool bInvalid = bOnlyWrong || bIsSpellAllAgain;
     612           5 :     if( bOnlineSpelling || bInvalid )
     613             :     {
     614           5 :         TypeId aType = TYPE(SwDocShell);
     615          10 :         for( SwDocShell *pDocSh = (SwDocShell*)SfxObjectShell::GetFirst(&aType);
     616             :              pDocSh;
     617           5 :              pDocSh = (SwDocShell*)SfxObjectShell::GetNext( *pDocSh, &aType ) )
     618             :         {
     619           5 :             SwDoc* pTmp = pDocSh->GetDoc();
     620           5 :             if ( pTmp->GetCurrentViewShell() )
     621             :             {
     622           5 :                 pTmp->SpellItAgainSam( bInvalid, bOnlyWrong, bSmartTags );
     623           5 :                 SwViewShell* pViewShell = 0;
     624           5 :                 pTmp->GetEditShell( &pViewShell );
     625           5 :                 if ( bSmartTags && pViewShell && pViewShell->GetWin() )
     626           4 :                     pViewShell->GetWin()->Invalidate();
     627             :             }
     628             :         }
     629             :     }
     630           5 : }
     631             : 
     632           0 : void SwModule::ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode)
     633             : {
     634           0 :     if(!pUsrPref)
     635           0 :         GetUsrPref(sal_False);
     636           0 :     pUsrPref->SetDefaultPageMode(bIsSquaredPageMode);
     637           0 : }
     638             : 
     639           0 : SvxCompareMode SwModule::GetCompareMode() const
     640             : {
     641           0 :     return pModuleConfig->GetCompareMode();
     642             : }
     643             : 
     644           0 : sal_Bool SwModule::IsUseRsid() const
     645             : {
     646           0 :     return pModuleConfig->IsUseRsid();
     647             : }
     648             : 
     649           0 : sal_Bool SwModule::IsIgnorePieces() const
     650             : {
     651           0 :     return pModuleConfig->IsIgnorePieces();
     652             : }
     653             : 
     654           0 : sal_uInt16 SwModule::GetPieceLen() const
     655             : {
     656           0 :     return pModuleConfig->GetPieceLen();
     657             : }
     658             : 
     659             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10