LCOV - code coverage report
Current view: top level - sw/source/core/uibase/config - viewopt.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 215 260 82.7 %
Date: 2014-04-11 Functions: 29 36 80.6 %
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 <sfx2/htmlmode.hxx>
      21             : #include <svtools/htmlcfg.hxx>
      22             : 
      23             : #include <svx/svxids.hrc>
      24             : #include <editeng/svxenum.hxx>
      25             : #include <editeng/svxacorr.hxx>
      26             : #include <unotools/localedatawrapper.hxx>
      27             : #include <vcl/region.hxx>
      28             : #include <vcl/outdev.hxx>
      29             : #include <vcl/window.hxx>
      30             : #include <swmodule.hxx>
      31             : #include <swtypes.hxx>
      32             : #include <viewopt.hxx>
      33             : #include <wdocsh.hxx>
      34             : #include <swrect.hxx>
      35             : #include <crstate.hxx>
      36             : #include <svtools/colorcfg.hxx>
      37             : #include <svtools/accessibilityoptions.hxx>
      38             : #include <unotools/syslocale.hxx>
      39             : 
      40             : #include <editeng/acorrcfg.hxx>
      41             : 
      42             : #ifdef DBG_UTIL
      43             : bool SwViewOption::s_bTest9 = false;        //DrawingLayerNotLoading
      44             : #endif
      45          37 : Color SwViewOption::aDocBoundColor(COL_LIGHTGRAY);
      46          37 : Color SwViewOption::aObjectBoundColor(COL_LIGHTGRAY);
      47          37 : Color SwViewOption::aDocColor(COL_LIGHTGRAY);
      48          37 : Color SwViewOption::aAppBackgroundColor(COL_LIGHTGRAY);
      49          37 : Color SwViewOption::aTableBoundColor(COL_LIGHTGRAY);
      50          37 : Color SwViewOption::aIndexShadingsColor(COL_LIGHTGRAY);
      51          37 : Color SwViewOption::aLinksColor(COL_BLUE);
      52          37 : Color SwViewOption::aVisitedLinksColor(COL_RED);
      53          37 : Color SwViewOption::aDirectCursorColor(COL_BLUE);
      54          37 : Color SwViewOption::aTextGridColor(COL_LIGHTGRAY);
      55          37 : Color SwViewOption::aSpellColor(COL_LIGHTRED);
      56          37 : Color SwViewOption::aSmarttagColor(COL_LIGHTMAGENTA);
      57          37 : Color SwViewOption::aFontColor(COL_BLACK);
      58          37 : Color SwViewOption::aFieldShadingsColor(COL_LIGHTGRAY);
      59          37 : Color SwViewOption::aSectionBoundColor(COL_LIGHTGRAY);
      60          37 : Color SwViewOption::aPageBreakColor(COL_BLUE);
      61          37 : Color SwViewOption::aScriptIndicatorColor(COL_GREEN);
      62          37 : Color SwViewOption::aShadowColor(COL_GRAY);
      63          37 : Color SwViewOption::aHeaderFooterMarkColor(COL_BLUE);
      64             : 
      65             : sal_Int32 SwViewOption::nAppearanceFlags = VIEWOPT_DOC_BOUNDARIES|VIEWOPT_OBJECT_BOUNDARIES;
      66             : sal_uInt16 SwViewOption::nPixelTwips = 0;   // one pixel on the screen
      67             : 
      68             : static const char aPostItStr[] = "  ";
      69             : 
      70         739 : bool SwViewOption::IsEqualFlags( const SwViewOption &rOpt ) const
      71             : {
      72         739 :     return  nCoreOptions == rOpt.nCoreOptions
      73         651 :             && nCore2Options == rOpt.nCore2Options
      74         639 :             && aSnapSize    == rOpt.aSnapSize
      75         631 :             && mnViewLayoutColumns == rOpt.mnViewLayoutColumns
      76         616 :             && nDivisionX   == rOpt.GetDivisionX()
      77         612 :             && nDivisionY   == rOpt.GetDivisionY()
      78         608 :             && nPagePrevRow == rOpt.GetPagePrevRow()
      79         608 :             && nPagePrevCol == rOpt.GetPagePrevCol()
      80         608 :             && aRetoucheColor == rOpt.GetRetoucheColor()
      81         608 :             && mbFormView == rOpt.IsFormView()
      82         608 :             && mbBrowseMode == rOpt.getBrowseMode()
      83         607 :             && mbViewLayoutBookMode == rOpt.mbViewLayoutBookMode
      84         607 :             && bShowPlaceHolderFields == rOpt.bShowPlaceHolderFields
      85        1346 :             && bIdle == rOpt.bIdle
      86             : #ifdef DBG_UTIL
      87             :             // correspond to the statements in ui/config/cfgvw.src
      88             :             && m_bTest1 == rOpt.IsTest1()
      89             :             && m_bTest2 == rOpt.IsTest2()
      90             :             && m_bTest3 == rOpt.IsTest3()
      91             :             && m_bTest4 == rOpt.IsTest4()
      92             :             && m_bTest5 == rOpt.IsTest5()
      93             :             && m_bTest6 == rOpt.IsTest6()
      94             :             && m_bTest7 == rOpt.IsTest7()
      95             :             && m_bTest8 == rOpt.IsTest8()
      96             :             && m_bTest10 == rOpt.IsTest10()
      97             : #endif
      98             :             ;
      99             : }
     100             : 
     101           0 : void SwViewOption::DrawRect( OutputDevice *pOut,
     102             :                              const SwRect &rRect, long nCol ) const
     103             : {
     104           0 :     if ( pOut->GetOutDevType() != OUTDEV_PRINTER )
     105             :     {
     106           0 :         const Color aCol( nCol );
     107           0 :         const Color aOldColor( pOut->GetFillColor() );
     108           0 :         pOut->SetFillColor( aCol );
     109           0 :         pOut->DrawRect( rRect.SVRect() );
     110           0 :         pOut->SetFillColor( aOldColor );
     111             :     }
     112             :     else
     113           0 :         DrawRectPrinter( pOut, rRect );
     114           0 : }
     115             : 
     116           0 : void SwViewOption::DrawRectPrinter( OutputDevice *pOut,
     117             :                                     const SwRect &rRect ) const
     118             : {
     119           0 :     Color aOldColor(pOut->GetLineColor());
     120           0 :     Color aOldFillColor( pOut->GetFillColor() );
     121           0 :     pOut->SetLineColor( Color(COL_BLACK) );
     122           0 :     pOut->SetFillColor( Color(COL_TRANSPARENT ));
     123           0 :     pOut->DrawRect( rRect.SVRect() );
     124           0 :     pOut->SetFillColor( aOldFillColor );
     125           0 :     pOut->SetLineColor( aOldColor );
     126           0 : }
     127             : 
     128          28 : sal_uInt16 SwViewOption::GetPostItsWidth( const OutputDevice *pOut ) const
     129             : {
     130             :     OSL_ENSURE( pOut, "no Outdev" );
     131          28 :     return sal_uInt16(pOut->GetTextWidth( OUString(aPostItStr )));
     132             : }
     133             : 
     134          14 : void SwViewOption::PaintPostIts( OutputDevice *pOut, const SwRect &rRect, sal_Bool bIsScript ) const
     135             : {
     136          14 :     if( pOut && bIsScript )
     137             :     {
     138           0 :             Color aOldLineColor( pOut->GetLineColor() );
     139           0 :         pOut->SetLineColor( Color(COL_GRAY ) );
     140             :         // to make it look nice, we subtract two pixels everywhere
     141           0 :         sal_uInt16 nPix = GetPixelTwips() * 2;
     142           0 :         if( rRect.Width() <= 2 * nPix || rRect.Height() <= 2 * nPix )
     143           0 :             nPix = 0;
     144           0 :         const Point aTopLeft(  rRect.Left()  + nPix, rRect.Top()    + nPix );
     145           0 :         const Point aBotRight( rRect.Right() - nPix, rRect.Bottom() - nPix );
     146           0 :         const SwRect aRect( aTopLeft, aBotRight );
     147           0 :         DrawRect( pOut, aRect, aScriptIndicatorColor.GetColor() );
     148           0 :     pOut->SetLineColor( aOldLineColor );
     149             :     }
     150          14 : }
     151             : 
     152        1789 : SwViewOption::SwViewOption() :
     153             :     sSymbolFont( "symbol" ),
     154             :     aRetoucheColor( COL_TRANSPARENT ),
     155             :     mnViewLayoutColumns( 0 ),
     156             :     nPagePrevRow( 1 ),
     157             :     nPagePrevCol( 2 ),
     158             :     nShdwCrsrFillMode( FILL_TAB ),
     159             :     bReadonly(sal_False),
     160             :     bStarOneSetting(sal_False),
     161             :     bIsPagePreview(sal_False),
     162             :     bSelectionInReadonly(sal_False),
     163             :     mbFormView(sal_False),
     164             :     mbBrowseMode(sal_False),
     165             :     mbBookView(sal_False),
     166             :     mbViewLayoutBookMode(sal_False),
     167             :     bShowPlaceHolderFields( sal_True ),
     168             :     nZoom( 100 ),
     169             :     eZoom( SVX_ZOOM_PERCENT ),
     170        1789 :     nTblDest(TBL_DEST_CELL)
     171             : {
     172             :     // Initialisation is a little simpler now
     173             :     // all Bits to 0
     174             :     nCoreOptions =
     175             :         VIEWOPT_1_HARDBLANK |
     176             :         VIEWOPT_1_SOFTHYPH |
     177             :         VIEWOPT_1_REF |
     178             :         VIEWOPT_1_GRAPHIC |
     179             :         VIEWOPT_1_TABLE |
     180             :         VIEWOPT_1_DRAW |
     181             :         VIEWOPT_1_CONTROL |
     182             :         VIEWOPT_1_PAGEBACK |
     183        1789 :         VIEWOPT_1_POSTITS;
     184             : 
     185             :     nCore2Options =
     186             :         VIEWOPT_CORE2_BLACKFONT |
     187        1789 :         VIEWOPT_CORE2_HIDDENPARA;
     188             : 
     189             :     nUIOptions =
     190             :         VIEWOPT_2_MODIFIED |
     191             :         VIEWOPT_2_GRFKEEPZOOM |
     192        1789 :         VIEWOPT_2_ANY_RULER;
     193             : 
     194        1789 :     if(MEASURE_METRIC != SvtSysLocale().GetLocaleData().getMeasurementSystemEnum())
     195        1789 :         aSnapSize.Width() = aSnapSize.Height() = 720;   // 1/2"
     196             :     else
     197           0 :         aSnapSize.Width() = aSnapSize.Height() = 567;   // 1 cm
     198        1789 :     nDivisionX = nDivisionY = 1;
     199             : 
     200        1789 :     bSelectionInReadonly = SW_MOD()->GetAccessibilityOptions().IsSelectionInReadonly();
     201             : 
     202        1789 :     bIdle = true;
     203             : 
     204             : #ifdef DBG_UTIL
     205             :     // correspond to the statements in ui/config/cfgvw.src
     206             :     m_bTest1 = m_bTest2 = m_bTest3 = m_bTest4 =
     207             :              m_bTest5 = m_bTest6 = m_bTest7 = m_bTest8 = m_bTest10 = false;
     208             : #endif
     209        1789 : }
     210             : 
     211        2522 : SwViewOption::SwViewOption(const SwViewOption& rVOpt)
     212             : {
     213        2522 :     bReadonly = sal_False;
     214        2522 :     bSelectionInReadonly = sal_False;
     215             :     // #114856# Formular view
     216        2522 :     mbFormView       = rVOpt.mbFormView;
     217        2522 :     nZoom           = rVOpt.nZoom       ;
     218        2522 :     aSnapSize       = rVOpt.aSnapSize   ;
     219        2522 :     mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ;
     220        2522 :     nDivisionX      = rVOpt.nDivisionX  ;
     221        2522 :     nDivisionY      = rVOpt.nDivisionY  ;
     222        2522 :     nPagePrevRow    = rVOpt.nPagePrevRow;
     223        2522 :     nPagePrevCol    = rVOpt.nPagePrevCol;
     224        2522 :     bIsPagePreview  = rVOpt.bIsPagePreview;
     225        2522 :     eZoom           = rVOpt.eZoom       ;
     226        2522 :     nTblDest        = rVOpt.nTblDest    ;
     227        2522 :     nUIOptions      = rVOpt.nUIOptions  ;
     228        2522 :     nCoreOptions    = rVOpt.nCoreOptions  ;
     229        2522 :     nCore2Options   = rVOpt.nCore2Options  ;
     230        2522 :     aRetoucheColor  = rVOpt.GetRetoucheColor();
     231        2522 :     sSymbolFont     = rVOpt.sSymbolFont;
     232        2522 :     nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
     233        2522 :     bStarOneSetting = rVOpt.bStarOneSetting;
     234        2522 :     mbBookView      = rVOpt.mbBookView;
     235        2522 :     mbBrowseMode    = rVOpt.mbBrowseMode;
     236        2522 :     mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode;
     237        2522 :     bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields;
     238        2522 :     bIdle           = rVOpt.bIdle;
     239             : 
     240             : #ifdef DBG_UTIL
     241             :     m_bTest1  = rVOpt.m_bTest1;
     242             :     m_bTest2  = rVOpt.m_bTest2;
     243             :     m_bTest3  = rVOpt.m_bTest3;
     244             :     m_bTest4  = rVOpt.m_bTest4;
     245             :     m_bTest5  = rVOpt.m_bTest5;
     246             :     m_bTest6  = rVOpt.m_bTest6;
     247             :     m_bTest7  = rVOpt.m_bTest7;
     248             :     m_bTest8  = rVOpt.m_bTest8;
     249             :     m_bTest10 = rVOpt.m_bTest10;
     250             : #endif
     251        2522 : }
     252             : 
     253        2380 : SwViewOption& SwViewOption::operator=( const SwViewOption &rVOpt )
     254             : {
     255             :     // #114856# Formular view
     256        2380 :     mbFormView       = rVOpt.mbFormView   ;
     257        2380 :     nZoom           = rVOpt.nZoom       ;
     258        2380 :     aSnapSize       = rVOpt.aSnapSize   ;
     259        2380 :     mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ;
     260        2380 :     nDivisionX      = rVOpt.nDivisionX  ;
     261        2380 :     nDivisionY      = rVOpt.nDivisionY  ;
     262        2380 :     nPagePrevRow    = rVOpt.nPagePrevRow;
     263        2380 :     nPagePrevCol    = rVOpt.nPagePrevCol;
     264        2380 :     bIsPagePreview  = rVOpt.bIsPagePreview;
     265        2380 :     eZoom           = rVOpt.eZoom       ;
     266        2380 :     nTblDest        = rVOpt.nTblDest    ;
     267        2380 :     nUIOptions      = rVOpt.nUIOptions  ;
     268        2380 :     nCoreOptions    = rVOpt.nCoreOptions;
     269        2380 :     nCore2Options   = rVOpt.nCore2Options;
     270        2380 :     aRetoucheColor  = rVOpt.GetRetoucheColor();
     271        2380 :     sSymbolFont     = rVOpt.sSymbolFont;
     272        2380 :     nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
     273        2380 :     bStarOneSetting = rVOpt.bStarOneSetting;
     274        2380 :     mbBookView      = rVOpt.mbBookView;
     275        2380 :     mbBrowseMode    = rVOpt.mbBrowseMode;
     276        2380 :     mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode;
     277        2380 :     bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields;
     278        2380 :     bIdle           = rVOpt.bIdle;
     279             : 
     280             : #ifdef DBG_UTIL
     281             :     m_bTest1  = rVOpt.m_bTest1;
     282             :     m_bTest2  = rVOpt.m_bTest2;
     283             :     m_bTest3  = rVOpt.m_bTest3;
     284             :     m_bTest4  = rVOpt.m_bTest4;
     285             :     m_bTest5  = rVOpt.m_bTest5;
     286             :     m_bTest6  = rVOpt.m_bTest6;
     287             :     m_bTest7  = rVOpt.m_bTest7;
     288             :     m_bTest8  = rVOpt.m_bTest8;
     289             :     m_bTest10 = rVOpt.m_bTest10;
     290             : #endif
     291        2380 :     return *this;
     292             : }
     293             : 
     294        4289 : SwViewOption::~SwViewOption()
     295             : {
     296        4289 : }
     297             : 
     298        1732 : void SwViewOption::Init( Window *pWin )
     299             : {
     300        1732 :     if( !nPixelTwips && pWin )
     301             :     {
     302          35 :         nPixelTwips = (sal_uInt16)pWin->PixelToLogic( Size(1,1) ).Height();
     303             :     }
     304        1732 : }
     305             : 
     306        3904 : sal_Bool SwViewOption::IsAutoCompleteWords() const
     307             : {
     308        3904 :     const SvxSwAutoFmtFlags& rFlags = SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags();
     309        3904 :     return rFlags.bAutoCmpltCollectWords;
     310             : }
     311             : 
     312         111 : AuthorCharAttr::AuthorCharAttr() :
     313             :     nItemId (SID_ATTR_CHAR_UNDERLINE),
     314             :     nAttr   (UNDERLINE_SINGLE),
     315         111 :     nColor  (COL_TRANSPARENT)
     316             : {
     317         111 : }
     318             : 
     319        6578 : sal_uInt16      GetHtmlMode(const SwDocShell* pShell)
     320             : {
     321        6578 :     sal_uInt16 nRet = 0;
     322        6578 :     if(!pShell || PTR_CAST(SwWebDocShell, pShell))
     323             :     {
     324          18 :         nRet = HTMLMODE_ON | HTMLMODE_SOME_STYLES;
     325          18 :         SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
     326          18 :         switch ( rHtmlOpt.GetExportMode() )
     327             :         {
     328             :             case HTML_CFG_MSIE:
     329           0 :                 nRet |= HTMLMODE_FULL_STYLES;
     330           0 :             break;
     331             :             case HTML_CFG_NS40:
     332             :                 // no special features for this browser
     333          18 :             break;
     334             :             case HTML_CFG_WRITER:
     335           0 :                 nRet |= HTMLMODE_FULL_STYLES;
     336           0 :             break;
     337             :         }
     338             :     }
     339        6578 :     return nRet;
     340             : }
     341             : 
     342        6815 : Color&   SwViewOption::GetDocColor()
     343             : {
     344        6815 :     return aDocColor;
     345             : }
     346             : 
     347        6803 : Color&   SwViewOption::GetDocBoundariesColor()
     348             : {
     349        6803 :     return aDocBoundColor;
     350             : }
     351             : 
     352        1316 : Color&   SwViewOption::GetObjectBoundariesColor()
     353             : {
     354        1316 :     return aObjectBoundColor;
     355             : }
     356             : 
     357       29546 : Color& SwViewOption::GetAppBackgroundColor()
     358             : {
     359       29546 :     return aAppBackgroundColor;
     360             : }
     361             : 
     362         375 : Color&   SwViewOption::GetTableBoundariesColor()
     363             : {
     364         375 :     return aTableBoundColor;
     365             : }
     366             : 
     367          28 : Color&   SwViewOption::GetIndexShadingsColor()
     368             : {
     369          28 :     return aIndexShadingsColor;
     370             : }
     371             : 
     372           0 : Color&   SwViewOption::GetLinksColor()
     373             : {
     374           0 :     return aLinksColor;
     375             : }
     376             : 
     377           0 : Color&   SwViewOption::GetVisitedLinksColor()
     378             : {
     379           0 :     return aVisitedLinksColor;
     380             : }
     381             : 
     382           0 : Color&   SwViewOption::GetDirectCursorColor()
     383             : {
     384           0 :     return aDirectCursorColor;
     385             : }
     386             : 
     387          13 : Color&   SwViewOption::GetTextGridColor()
     388             : {
     389          13 :     return aTextGridColor;
     390             : }
     391             : 
     392         305 : Color&   SwViewOption::GetSpellColor()
     393             : {
     394         305 :     return aSpellColor;
     395             : }
     396             : 
     397           0 : Color&   SwViewOption::GetSmarttagColor()
     398             : {
     399           0 :     return aSmarttagColor;
     400             : }
     401             : 
     402        6765 : Color&   SwViewOption::GetShadowColor()
     403             : {
     404        6765 :     return aShadowColor;
     405             : }
     406             : 
     407       11662 : Color&   SwViewOption::GetFontColor()
     408             : {
     409       11662 :     return aFontColor;
     410             : }
     411             : 
     412        1320 : Color&   SwViewOption::GetFieldShadingsColor()
     413             : {
     414        1320 :     return aFieldShadingsColor;
     415             : }
     416             : 
     417         321 : Color&   SwViewOption::GetSectionBoundColor()
     418             : {
     419         321 :     return aSectionBoundColor;
     420             : }
     421             : 
     422          68 : Color& SwViewOption::GetPageBreakColor()
     423             : {
     424          68 :     return aPageBreakColor;
     425             : }
     426             : 
     427           0 : Color& SwViewOption::GetHeaderFooterMarkColor()
     428             : {
     429           0 :     return aHeaderFooterMarkColor;
     430             : }
     431             : 
     432          77 : void SwViewOption::ApplyColorConfigValues(const svtools::ColorConfig& rConfig )
     433             : {
     434          77 :     aDocColor.SetColor(rConfig.GetColorValue(svtools::DOCCOLOR).nColor);
     435             : 
     436          77 :     svtools::ColorConfigValue aValue = rConfig.GetColorValue(svtools::DOCBOUNDARIES);
     437          77 :     aDocBoundColor.SetColor(aValue.nColor);
     438          77 :     nAppearanceFlags = 0;
     439          77 :     if(aValue.bIsVisible)
     440          77 :         nAppearanceFlags |= VIEWOPT_DOC_BOUNDARIES;
     441             : 
     442          77 :     aAppBackgroundColor.SetColor(rConfig.GetColorValue(svtools::APPBACKGROUND).nColor);
     443             : 
     444          77 :     aValue = rConfig.GetColorValue(svtools::OBJECTBOUNDARIES);
     445          77 :     aObjectBoundColor.SetColor(aValue.nColor);
     446          77 :     if(aValue.bIsVisible)
     447          77 :         nAppearanceFlags |= VIEWOPT_OBJECT_BOUNDARIES;
     448             : 
     449          77 :     aValue = rConfig.GetColorValue(svtools::TABLEBOUNDARIES);
     450          77 :     aTableBoundColor.SetColor(aValue.nColor);
     451          77 :     if(aValue.bIsVisible)
     452          65 :         nAppearanceFlags |= VIEWOPT_TABLE_BOUNDARIES;
     453             : 
     454          77 :     aValue = rConfig.GetColorValue(svtools::WRITERIDXSHADINGS);
     455          77 :     aIndexShadingsColor.SetColor(aValue.nColor);
     456          77 :     if(aValue.bIsVisible)
     457          77 :         nAppearanceFlags |= VIEWOPT_INDEX_SHADINGS;
     458             : 
     459          77 :     aValue = rConfig.GetColorValue(svtools::LINKS);
     460          77 :     aLinksColor.SetColor(aValue.nColor);
     461          77 :     if(aValue.bIsVisible)
     462           0 :         nAppearanceFlags |= VIEWOPT_LINKS;
     463             : 
     464          77 :     aValue = rConfig.GetColorValue(svtools::LINKSVISITED);
     465          77 :     aVisitedLinksColor.SetColor(aValue.nColor);
     466          77 :     if(aValue.bIsVisible)
     467           0 :         nAppearanceFlags |= VIEWOPT_VISITED_LINKS;
     468             : 
     469          77 :     aValue = rConfig.GetColorValue(svtools::SHADOWCOLOR);
     470          77 :     aShadowColor.SetColor(aValue.nColor);
     471          77 :     if(aValue.bIsVisible)
     472          77 :         nAppearanceFlags |= VIEWOPT_SHADOW;
     473             : 
     474          77 :     aDirectCursorColor.SetColor(rConfig.GetColorValue(svtools::WRITERDIRECTCURSOR).nColor);
     475             : 
     476          77 :     aTextGridColor.SetColor(rConfig.GetColorValue(svtools::WRITERTEXTGRID).nColor);
     477             : 
     478          77 :     aSpellColor.SetColor(rConfig.GetColorValue(svtools::SPELL).nColor);
     479             : 
     480          77 :     aSmarttagColor.SetColor(rConfig.GetColorValue(svtools::SMARTTAGS).nColor);
     481             : 
     482          77 :     aFontColor.SetColor(rConfig.GetColorValue(svtools::FONTCOLOR).nColor);
     483             : 
     484          77 :     aValue = rConfig.GetColorValue(svtools::WRITERFIELDSHADINGS);
     485          77 :     aFieldShadingsColor.SetColor(aValue.nColor);
     486          77 :     if(aValue.bIsVisible)
     487          65 :         nAppearanceFlags |= VIEWOPT_FIELD_SHADINGS;
     488             : 
     489          77 :     aValue = rConfig.GetColorValue(svtools::WRITERSECTIONBOUNDARIES);
     490          77 :     aSectionBoundColor.SetColor(aValue.nColor);
     491          77 :     if(aValue.bIsVisible)
     492          77 :         nAppearanceFlags |= VIEWOPT_SECTION_BOUNDARIES;
     493             : 
     494          77 :     aValue = rConfig.GetColorValue(svtools::WRITERPAGEBREAKS);
     495          77 :     aPageBreakColor.SetColor(aValue.nColor);
     496             : 
     497          77 :     aValue = rConfig.GetColorValue(svtools::WRITERHEADERFOOTERMARK);
     498          77 :     aHeaderFooterMarkColor.SetColor(aValue.nColor);
     499             : 
     500          77 :     aScriptIndicatorColor.SetColor(rConfig.GetColorValue(svtools::WRITERSCRIPTINDICATOR).nColor);
     501          77 : }
     502             : 
     503          15 : void SwViewOption::SetAppearanceFlag(sal_Int32 nFlag, sal_Bool bSet, sal_Bool bSaveInConfig )
     504             : {
     505          15 :     if(bSet)
     506           5 :         nAppearanceFlags |= nFlag;
     507             :     else
     508          10 :         nAppearanceFlags &= ~nFlag;
     509          15 :     if(bSaveInConfig)
     510             :     {
     511             :         //create an editable svtools::ColorConfig and store the change
     512          12 :         svtools::EditableColorConfig aEditableConfig;
     513             :         struct FlagToConfig_Impl
     514             :         {
     515             :             sal_Int32               nFlag;
     516             :             svtools::ColorConfigEntry   eEntry;
     517             :         };
     518             :         static const FlagToConfig_Impl aFlags[] =
     519             :         {
     520             :             { VIEWOPT_DOC_BOUNDARIES     ,   svtools::DOCBOUNDARIES },
     521             :             { VIEWOPT_OBJECT_BOUNDARIES  ,   svtools::OBJECTBOUNDARIES },
     522             :             { VIEWOPT_TABLE_BOUNDARIES   ,   svtools::TABLEBOUNDARIES },
     523             :             { VIEWOPT_INDEX_SHADINGS     ,   svtools::WRITERIDXSHADINGS },
     524             :             { VIEWOPT_LINKS              ,   svtools::LINKS },
     525             :             { VIEWOPT_VISITED_LINKS      ,   svtools::LINKSVISITED },
     526             :             { VIEWOPT_FIELD_SHADINGS     ,   svtools::WRITERFIELDSHADINGS },
     527             :             { VIEWOPT_SECTION_BOUNDARIES ,   svtools::WRITERSECTIONBOUNDARIES },
     528             :             { VIEWOPT_SHADOW             ,   svtools::SHADOWCOLOR },
     529             :             { 0                          ,   svtools::ColorConfigEntryCount }
     530             :         };
     531          12 :         sal_uInt16 nPos = 0;
     532         132 :         while(aFlags[nPos].nFlag)
     533             :         {
     534         108 :             if(0 != (nFlag&aFlags[nPos].nFlag))
     535             :             {
     536          12 :                 svtools::ColorConfigValue aValue = aEditableConfig.GetColorValue(aFlags[nPos].eEntry);
     537          12 :                 aValue.bIsVisible = bSet;
     538          12 :                 aEditableConfig.SetColorValue(aFlags[nPos].eEntry, aValue);
     539             :             }
     540         108 :             nPos++;
     541          12 :         }
     542             :     }
     543          15 : }
     544             : 
     545       37677 : sal_Bool SwViewOption::IsAppearanceFlag(sal_Int32 nFlag)
     546             : {
     547       37677 :     return 0 != (nAppearanceFlags & nFlag);
     548         111 : }
     549             : 
     550             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10