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

Generated by: LCOV version 1.10