LCOV - code coverage report
Current view: top level - sw/source/ui/config - usrpref.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 214 303 70.6 %
Date: 2012-08-25 Functions: 23 37 62.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 220 458 48.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <tools/stream.hxx>
      30                 :            : #include <unotools/syslocale.hxx>
      31                 :            : 
      32                 :            : #include "swtypes.hxx"
      33                 :            : #include "hintids.hxx"
      34                 :            : #include "uitool.hxx"
      35                 :            : #include "usrpref.hxx"
      36                 :            : #include "crstate.hxx"
      37                 :            : #include <linguistic/lngprops.hxx>
      38                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      39                 :            : #include <com/sun/star/uno/Any.hxx>
      40                 :            : #include <com/sun/star/uno/Sequence.hxx>
      41                 :            : #include <unotools/localedatawrapper.hxx>
      42                 :            : 
      43                 :            : #include <unomid.h>
      44                 :            : 
      45                 :            : using namespace utl;
      46                 :            : using namespace ::com::sun::star;
      47                 :            : using namespace ::com::sun::star::uno;
      48                 :            : 
      49                 :            : using ::rtl::OUString;
      50                 :            : 
      51                 :            : 
      52                 :          0 : void SwMasterUsrPref::SetUsrPref(const SwViewOption &rCopy)
      53                 :            : {
      54                 :          0 :     *((SwViewOption*)this) = rCopy;
      55                 :          0 : }
      56                 :            : 
      57                 :         75 : SwMasterUsrPref::SwMasterUsrPref(sal_Bool bWeb) :
      58                 :            :     eFldUpdateFlags(AUTOUPD_OFF),
      59                 :            :     nLinkUpdateMode(0),
      60                 :            :     bIsHScrollMetricSet(sal_False),
      61                 :            :     bIsVScrollMetricSet(sal_False),
      62                 :            :     nDefTab( MM50 * 4 ),
      63                 :            :     bIsSquaredPageMode(sal_False),
      64                 :            :     aContentConfig(bWeb, *this),
      65                 :            :     aLayoutConfig(bWeb, *this),
      66                 :            :     aGridConfig(bWeb, *this),
      67                 :            :     aCursorConfig(*this),
      68         [ +  - ]:          2 :     pWebColorConfig(bWeb ? new SwWebColorConfig(*this) : 0),
      69 [ +  - ][ +  - ]:         77 :     bApplyCharUnit(sal_False)
         [ +  - ][ +  - ]
         [ +  + ][ +  - ]
      70                 :            : {
      71 [ +  - ][ +  - ]:         75 :     MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
         [ +  - ][ +  - ]
      72         [ -  + ]:         75 :     eUserMetric = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH;
      73                 :            : 
      74         [ +  - ]:         75 :     aContentConfig.Load();
      75         [ +  - ]:         75 :     aLayoutConfig.Load();
      76         [ +  - ]:         75 :     aGridConfig.Load();
      77         [ +  - ]:         75 :     aCursorConfig.Load();
      78         [ +  + ]:         75 :     if(pWebColorConfig)
      79         [ +  - ]:          2 :         pWebColorConfig->Load();
      80                 :         75 : }
      81                 :            : 
      82 [ +  - ][ +  - ]:         42 : SwMasterUsrPref::~SwMasterUsrPref()
         [ +  - ][ +  - ]
      83                 :            : {
      84 [ +  + ][ +  - ]:         42 :     delete pWebColorConfig;
      85                 :         42 : }
      86                 :            : 
      87                 :        225 : Sequence<OUString> SwContentViewConfig::GetPropertyNames()
      88                 :            : {
      89                 :            :     static const char* aPropNames[] =
      90                 :            :     {
      91                 :            :         "Display/GraphicObject",                    //  0
      92                 :            :         "Display/Table",                            //  1
      93                 :            :         "Display/DrawingControl",                   //  2
      94                 :            :         "Display/FieldCode",                        //  3
      95                 :            :         "Display/Note",                             //  4
      96                 :            :         "Display/PreventTips",                      //  5
      97                 :            :         "NonprintingCharacter/MetaCharacters",     //   6
      98                 :            :         "NonprintingCharacter/ParagraphEnd",        //  7
      99                 :            :         "NonprintingCharacter/OptionalHyphen",      //  8
     100                 :            :         "NonprintingCharacter/Space",               //  9
     101                 :            :         "NonprintingCharacter/Break",               // 10
     102                 :            :         "NonprintingCharacter/ProtectedSpace",      // 11
     103                 :            :         "NonprintingCharacter/Tab",             // 12 //not in Writer/Web
     104                 :            :         "NonprintingCharacter/HiddenText",      // 13
     105                 :            :         "NonprintingCharacter/HiddenParagraph", // 14
     106                 :            :         "NonprintingCharacter/HiddenCharacter",      // 15
     107                 :            :         "Update/Link",                          // 16
     108                 :            :         "Update/Field",                         // 17
     109                 :            :         "Update/Chart"                          // 18
     110                 :            : 
     111                 :            : 
     112                 :            :     };
     113         [ +  + ]:        225 :     const int nCount = bWeb ? 12 : 19;
     114                 :        225 :     Sequence<OUString> aNames(nCount);
     115         [ +  - ]:        225 :     OUString* pNames = aNames.getArray();
     116         [ +  + ]:       4458 :     for(int i = 0; i < nCount; i++)
     117                 :            :     {
     118                 :       4233 :         pNames[i] = OUString::createFromAscii(aPropNames[i]);
     119                 :            :     }
     120                 :        225 :     return aNames;
     121                 :            : }
     122                 :            : 
     123                 :         75 : SwContentViewConfig::SwContentViewConfig(sal_Bool bIsWeb, SwMasterUsrPref& rPar) :
     124                 :            :     ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Content") :  C2U("Office.Writer/Content")),
     125                 :            :     rParent(rPar),
     126 [ +  + ][ +  - ]:         75 :     bWeb(bIsWeb)
     127                 :            : {
     128         [ +  - ]:         75 :     Load();
     129 [ +  - ][ +  - ]:         75 :     EnableNotification( GetPropertyNames() );
                 [ +  - ]
     130                 :         75 : }
     131                 :            : 
     132                 :         42 : SwContentViewConfig::~SwContentViewConfig()
     133                 :            : {
     134         [ -  + ]:         42 : }
     135                 :            : 
     136                 :          0 : void SwContentViewConfig::Notify( const Sequence< OUString > & /*rPropertyNames*/ )
     137                 :            : {
     138                 :          0 :     Load();
     139                 :          0 : }
     140                 :            : 
     141                 :          0 : void SwContentViewConfig::Commit()
     142                 :            : {
     143         [ #  # ]:          0 :     Sequence<OUString> aNames = GetPropertyNames();
     144                 :            : 
     145         [ #  # ]:          0 :     Sequence<Any> aValues(aNames.getLength());
     146         [ #  # ]:          0 :     Any* pValues = aValues.getArray();
     147                 :            : 
     148         [ #  # ]:          0 :     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     149                 :            :     {
     150                 :          0 :         sal_Bool bVal = sal_False;
     151   [ #  #  #  #  :          0 :         switch(nProp)
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                      # ]
     152                 :            :         {
     153                 :          0 :             case  0: bVal = rParent.IsGraphic();    break;// "Display/GraphicObject",
     154                 :          0 :             case  1: bVal = rParent.IsTable();  break;// "Display/Table",
     155                 :          0 :             case  2: bVal = rParent.IsDraw();       break;// "Display/DrawingControl",
     156                 :          0 :             case  3: bVal = rParent.IsFldName();    break;// "Display/FieldCode",
     157                 :          0 :             case  4: bVal = rParent.IsPostIts();    break;// "Display/Note",
     158                 :          0 :             case  5: bVal = rParent.IsPreventTips(); break; // "Display/PreventTips"
     159                 :          0 :             case  6: bVal = rParent.IsViewMetaChars(); break; //"NonprintingCharacter/MetaCharacters"
     160                 :          0 :             case  7: bVal = rParent.IsParagraph(sal_True); break;// "NonprintingCharacter/ParagraphEnd",
     161                 :          0 :             case  8: bVal = rParent.IsSoftHyph(); break;// "NonprintingCharacter/OptionalHyphen",
     162                 :          0 :             case  9: bVal = rParent.IsBlank(sal_True);  break;// "NonprintingCharacter/Space",
     163                 :          0 :             case 10: bVal = rParent.IsLineBreak(sal_True);break;// "NonprintingCharacter/Break",
     164                 :          0 :             case 11: bVal = rParent.IsHardBlank(); break;// "NonprintingCharacter/ProtectedSpace",
     165                 :          0 :             case 12: bVal = rParent.IsTab(sal_True);        break;// "NonprintingCharacter/Tab",
     166                 :          0 :             case 13: bVal = rParent.IsShowHiddenField(); break;// "NonprintingCharacter/Fields: HiddenText",
     167                 :          0 :             case 14: bVal = rParent.IsShowHiddenPara(); break;// "NonprintingCharacter/Fields: HiddenParagraph",
     168                 :          0 :             case 15: bVal = rParent.IsShowHiddenChar(sal_True);    break;// "NonprintingCharacter/HiddenCharacter",
     169         [ #  # ]:          0 :             case 16: pValues[nProp] <<= rParent.GetUpdateLinkMode();    break;// "Update/Link",
     170                 :          0 :             case 17: bVal = rParent.IsUpdateFields(); break;// "Update/Field",
     171                 :          0 :             case 18: bVal = rParent.IsUpdateCharts(); break;// "Update/Chart"
     172                 :            :         }
     173         [ #  # ]:          0 :         if(nProp != 16)
     174         [ #  # ]:          0 :             pValues[nProp].setValue(&bVal, ::getBooleanCppuType());
     175                 :            :     }
     176 [ #  # ][ #  # ]:          0 :     PutProperties(aNames, aValues);
                 [ #  # ]
     177                 :          0 : }
     178                 :            : 
     179                 :        150 : void SwContentViewConfig::Load()
     180                 :            : {
     181         [ +  - ]:        150 :     Sequence<OUString> aNames = GetPropertyNames();
     182         [ +  - ]:        150 :     Sequence<Any> aValues = GetProperties(aNames);
     183                 :        150 :     const Any* pValues = aValues.getConstArray();
     184                 :            :     OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
     185         [ +  - ]:        150 :     if(aValues.getLength() == aNames.getLength())
     186                 :            :     {
     187         [ +  + ]:       2972 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     188                 :            :         {
     189         [ +  - ]:       2822 :             if(pValues[nProp].hasValue())
     190                 :            :             {
     191         [ +  + ]:       2822 :                 sal_Bool bSet = nProp != 16 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False;
     192   [ +  +  +  +  :       2822 :                 switch(nProp)
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
                      - ]
     193                 :            :                 {
     194                 :        150 :                     case  0: rParent.SetGraphic(bSet);  break;// "Display/GraphicObject",
     195                 :        150 :                     case  1: rParent.SetTable(bSet);    break;// "Display/Table",
     196                 :        150 :                     case  2: rParent.SetDraw(bSet);     break;// "Display/DrawingControl",
     197                 :        150 :                     case  3: rParent.SetFldName(bSet);  break;// "Display/FieldCode",
     198                 :        150 :                     case  4: rParent.SetPostIts(bSet);  break;// "Display/Note",
     199                 :        150 :                     case  5: rParent.SetPreventTips(bSet);  break;// "Display/PreventTips",
     200                 :        150 :                     case  6: rParent.SetViewMetaChars(bSet); break; //"NonprintingCharacter/MetaCharacters"
     201                 :        150 :                     case  7: rParent.SetParagraph(bSet); break;// "NonprintingCharacter/ParagraphEnd",
     202                 :        150 :                     case  8: rParent.SetSoftHyph(bSet); break;// "NonprintingCharacter/OptionalHyphen",
     203                 :        150 :                     case  9: rParent.SetBlank(bSet);    break;// "NonprintingCharacter/Space",
     204                 :        150 :                     case 10: rParent.SetLineBreak(bSet);break;// "NonprintingCharacter/Break",
     205                 :        150 :                     case 11: rParent.SetHardBlank(bSet); break;// "NonprintingCharacter/ProtectedSpace",
     206                 :        146 :                     case 12: rParent.SetTab(bSet);      break;// "NonprintingCharacter/Tab",
     207                 :        146 :                     case 13: rParent.SetShowHiddenField(bSet);   break;// "NonprintingCharacter/Fields: HiddenText",
     208                 :        146 :                     case 14: rParent.SetShowHiddenPara(bSet); break;// "NonprintingCharacter/Fields: HiddenParagraph",
     209                 :        146 :                     case 15: rParent.SetShowHiddenChar(bSet); break;// "NonprintingCharacter/HiddenCharacter",
     210                 :            :                     case 16:
     211                 :            :                     {
     212                 :        146 :                         sal_Int32 nSet = 0;
     213                 :        146 :                         pValues[nProp] >>= nSet;
     214         [ +  - ]:        146 :                         rParent.SetUpdateLinkMode(nSet, sal_True);
     215                 :            :                     }
     216                 :        146 :                     break;// "Update/Link",
     217         [ +  - ]:        146 :                     case 17: rParent.SetUpdateFields(bSet, sal_True); break;// "Update/Field",
     218         [ +  - ]:       2822 :                     case 18: rParent.SetUpdateCharts(bSet, sal_True); break;// "Update/Chart"
     219                 :            :                 }
     220                 :            :             }
     221                 :            :         }
     222 [ +  - ][ +  - ]:        150 :     }
     223                 :        150 : }
     224                 :            : 
     225                 :        117 : Sequence<OUString> SwLayoutViewConfig::GetPropertyNames()
     226                 :            : {
     227                 :            :     static const char* aPropNames[] =
     228                 :            :     {
     229                 :            :         "Line/Guide",                           // 0
     230                 :            :         "Window/HorizontalScroll",              // 1
     231                 :            :         "Window/VerticalScroll",                // 2
     232                 :            :         "Window/ShowRulers",                    // 3
     233                 :            :         "Window/HorizontalRuler",               // 4
     234                 :            :         "Window/VerticalRuler",                 // 5
     235                 :            :         "Window/HorizontalRulerUnit",           // 6
     236                 :            :         "Window/VerticalRulerUnit",             // 7
     237                 :            :         "Window/SmoothScroll",                  // 8
     238                 :            :         "Zoom/Value",                           // 9
     239                 :            :         "Zoom/Type",                            //10
     240                 :            :         "Other/IsAlignMathObjectsToBaseline",   //11
     241                 :            :         "Other/MeasureUnit",                    //12
     242                 :            :         // below properties are not available in WriterWeb
     243                 :            :         "Other/TabStop",                        //13
     244                 :            :         "Window/IsVerticalRulerRight",          //14
     245                 :            :         "ViewLayout/Columns",                   //15
     246                 :            :         "ViewLayout/BookMode",                  //16
     247                 :            :         "Other/IsSquaredPageMode",              //17
     248                 :            :         "Other/ApplyCharUnit"                   //18
     249                 :            :     };
     250         [ +  + ]:        117 :     const int nCount = bWeb ? 13 : 19;
     251                 :        117 :     Sequence<OUString> aNames(nCount);
     252         [ +  - ]:        117 :     OUString* pNames = aNames.getArray();
     253         [ +  + ]:       2316 :     for(int i = 0; i < nCount; i++)
     254                 :            :     {
     255                 :       2199 :         pNames[i] = OUString::createFromAscii(aPropNames[i]);
     256                 :            :     }
     257                 :        117 :     return aNames;
     258                 :            : }
     259                 :            : 
     260                 :         75 : SwLayoutViewConfig::SwLayoutViewConfig(sal_Bool bIsWeb, SwMasterUsrPref& rPar) :
     261                 :            :     ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Layout") :  C2U("Office.Writer/Layout"),
     262                 :            :         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
     263                 :            :     rParent(rPar),
     264 [ +  + ][ +  - ]:         75 :     bWeb(bIsWeb)
     265                 :            : {
     266                 :         75 : }
     267                 :            : 
     268                 :         42 : SwLayoutViewConfig::~SwLayoutViewConfig()
     269                 :            : {
     270         [ -  + ]:         42 : }
     271                 :            : 
     272                 :         42 : void SwLayoutViewConfig::Commit()
     273                 :            : {
     274         [ +  - ]:         42 :     Sequence<OUString> aNames = GetPropertyNames();
     275                 :            : 
     276         [ +  - ]:         42 :     Sequence<Any> aValues(aNames.getLength());
     277         [ +  - ]:         42 :     Any* pValues = aValues.getArray();
     278                 :            : 
     279         [ +  + ]:        828 :     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     280                 :            :     {
     281                 :        786 :         Any &rVal = pValues[nProp];
     282   [ +  +  +  +  :        786 :         switch(nProp)
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
                      - ]
     283                 :            :         {
     284         [ +  - ]:         42 :             case  0: rVal <<= (sal_Bool) rParent.IsCrossHair(); break;              // "Line/Guide",
     285         [ +  - ]:         42 :             case  1: rVal <<= (sal_Bool) rParent.IsViewHScrollBar(); break;         // "Window/HorizontalScroll",
     286         [ +  - ]:         42 :             case  2: rVal <<= (sal_Bool) rParent.IsViewVScrollBar(); break;         // "Window/VerticalScroll",
     287         [ +  - ]:         42 :             case  3: rVal <<= (sal_Bool) rParent.IsViewAnyRuler(); break;           // "Window/ShowRulers"
     288                 :            :             // #i14593# use IsView*Ruler(sal_True) instead of IsView*Ruler()
     289                 :            :             // this preserves the single ruler states even if "Window/ShowRulers" is off
     290 [ +  - ][ +  - ]:         42 :             case  4: rVal <<= (sal_Bool) rParent.IsViewHRuler(sal_True); break;         // "Window/HorizontalRuler",
     291 [ +  - ][ +  - ]:         42 :             case  5: rVal <<= (sal_Bool) rParent.IsViewVRuler(sal_True); break;         // "Window/VerticalRuler",
     292                 :            :             case  6:
     293         [ -  + ]:         42 :                 if(rParent.bIsHScrollMetricSet)
     294         [ #  # ]:          0 :                     rVal <<= (sal_Int32)rParent.eHScrollMetric;                     // "Window/HorizontalRulerUnit"
     295                 :         42 :             break;
     296                 :            :             case  7:
     297         [ -  + ]:         42 :                 if(rParent.bIsVScrollMetricSet)
     298         [ #  # ]:          0 :                     rVal <<= (sal_Int32)rParent.eVScrollMetric;                     // "Window/VerticalRulerUnit"
     299                 :         42 :             break;
     300         [ +  - ]:         42 :             case  8: rVal <<= (sal_Bool) rParent.IsSmoothScroll(); break;           // "Window/SmoothScroll",
     301         [ +  - ]:         42 :             case  9: rVal <<= (sal_Int32)rParent.GetZoom(); break;                  // "Zoom/Value",
     302         [ +  - ]:         42 :             case 10: rVal <<= (sal_Int32)rParent.GetZoomType(); break;              // "Zoom/Type",
     303         [ +  - ]:         42 :             case 11: rVal <<= (sal_Bool) rParent.IsAlignMathObjectsToBaseline(); break;      // "Other/IsAlignMathObjectsToBaseline"
     304         [ +  - ]:         42 :             case 12: rVal <<= (sal_Int32)rParent.GetMetric(); break;                // "Other/MeasureUnit",
     305 [ +  - ][ +  - ]:         40 :             case 13: rVal <<= static_cast<sal_Int32>(TWIP_TO_MM100(rParent.GetDefTab())); break;// "Other/TabStop",
     306         [ +  - ]:         40 :             case 14: rVal <<= (sal_Bool) rParent.IsVRulerRight(); break;            // "Window/IsVerticalRulerRight",
     307         [ +  - ]:         40 :             case 15: rVal <<= (sal_Int32)rParent.GetViewLayoutColumns(); break;     // "ViewLayout/Columns",
     308         [ +  - ]:         40 :             case 16: rVal <<= (sal_Bool) rParent.IsViewLayoutBookMode(); break;     // "ViewLayout/BookMode",
     309         [ +  - ]:         40 :             case 17: rVal <<= (sal_Bool) rParent.IsSquaredPageMode(); break;        // "Other/IsSquaredPageMode",
     310         [ +  - ]:         40 :             case 18: rVal <<= (sal_Bool) rParent.IsApplyCharUnit(); break;        // "Other/ApplyCharUnit",
     311                 :            :         }
     312                 :            :     }
     313 [ +  - ][ +  - ]:         42 :     PutProperties(aNames, aValues);
                 [ +  - ]
     314                 :         42 : }
     315                 :            : 
     316                 :         75 : void SwLayoutViewConfig::Load()
     317                 :            : {
     318         [ +  - ]:         75 :     Sequence<OUString> aNames = GetPropertyNames();
     319         [ +  - ]:         75 :     Sequence<Any> aValues = GetProperties(aNames);
     320                 :         75 :     const Any* pValues = aValues.getConstArray();
     321                 :            :     OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
     322         [ +  - ]:         75 :     if(aValues.getLength() == aNames.getLength())
     323                 :            :     {
     324         [ +  + ]:       1488 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     325                 :            :         {
     326         [ +  + ]:       1413 :             if(pValues[nProp].hasValue())
     327                 :            :             {
     328                 :       1208 :                 sal_Int32   nInt32Val   = 0;
     329                 :       1208 :                 sal_Bool    bSet        = sal_False;
     330                 :       1208 :                 pValues[nProp] >>= nInt32Val;
     331                 :       1208 :                 pValues[nProp] >>= bSet;
     332                 :            : 
     333   [ +  +  +  +  :       1208 :                 switch(nProp)
          +  +  -  -  +  
          +  +  +  +  +  
          +  +  +  +  +  
                      - ]
     334                 :            :                 {
     335                 :         75 :                     case  0: rParent.SetCrossHair(bSet); break;// "Line/Guide",
     336                 :         75 :                     case  1: rParent.SetViewHScrollBar(bSet); break;// "Window/HorizontalScroll",
     337                 :         75 :                     case  2: rParent.SetViewVScrollBar(bSet); break;// "Window/VerticalScroll",
     338                 :         75 :                     case  3: rParent.SetViewAnyRuler(bSet);break; // "Window/ShowRulers"
     339                 :         75 :                     case  4: rParent.SetViewHRuler(bSet); break;// "Window/HorizontalRuler",
     340                 :         75 :                     case  5: rParent.SetViewVRuler(bSet); break;// "Window/VerticalRuler",
     341                 :            :                     case  6:
     342                 :            :                     {
     343                 :          0 :                         rParent.bIsHScrollMetricSet = sal_True;
     344                 :          0 :                         rParent.eHScrollMetric = ((FieldUnit)nInt32Val);  // "Window/HorizontalRulerUnit"
     345                 :            :                     }
     346                 :          0 :                     break;
     347                 :            :                     case  7:
     348                 :            :                     {
     349                 :          0 :                         rParent.bIsVScrollMetricSet = sal_True;
     350                 :          0 :                         rParent.eVScrollMetric = ((FieldUnit)nInt32Val); // "Window/VerticalRulerUnit"
     351                 :            :                     }
     352                 :          0 :                     break;
     353                 :         75 :                     case  8: rParent.SetSmoothScroll(bSet); break;// "Window/SmoothScroll",
     354                 :         75 :                     case  9: rParent.SetZoom( static_cast< sal_uInt16 >(nInt32Val) ); break;// "Zoom/Value",
     355                 :         75 :                     case 10: rParent.SetZoomType( static_cast< SvxZoomType >(nInt32Val) ); break;// "Zoom/Type",
     356         [ +  - ]:         75 :                     case 11: rParent.SetAlignMathObjectsToBaseline(bSet); break;// "Other/IsAlignMathObjectsToBaseline"
     357         [ +  - ]:         20 :                     case 12: rParent.SetMetric((FieldUnit)nInt32Val, sal_True); break;// "Other/MeasureUnit",
     358 [ +  - ][ +  - ]:         73 :                     case 13: rParent.SetDefTab(MM100_TO_TWIP(nInt32Val), sal_True); break;// "Other/TabStop",
     359                 :         73 :                     case 14: rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight",
     360                 :         73 :                     case 15: rParent.SetViewLayoutColumns( static_cast<sal_uInt16>(nInt32Val) ); break;// "ViewLayout/Columns",
     361                 :         73 :                     case 16: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode",
     362         [ +  - ]:         73 :                     case 17: rParent.SetDefaultPageMode(bSet,sal_True); break;// "Other/IsSquaredPageMode",
     363         [ +  - ]:       1208 :                     case 18: rParent.SetApplyCharUnit(bSet); break;// "Other/ApplyUserChar"
     364                 :            :                 }
     365                 :            :             }
     366                 :            :         }
     367 [ +  - ][ +  - ]:         75 :     }
     368                 :         75 : }
     369                 :            : 
     370                 :          0 : void SwLayoutViewConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
     371                 :            : 
     372                 :         75 : Sequence<OUString> SwGridConfig::GetPropertyNames()
     373                 :            : {
     374                 :            :     static const char* aPropNames[] =
     375                 :            :     {
     376                 :            :         "Option/SnapToGrid",            // 0
     377                 :            :         "Option/VisibleGrid",           // 1
     378                 :            :         "Option/Synchronize",           // 2
     379                 :            :         "Resolution/XAxis",             // 3
     380                 :            :         "Resolution/YAxis",             // 4
     381                 :            :         "Subdivision/XAxis",            // 5
     382                 :            :         "Subdivision/YAxis"             // 6
     383                 :            :     };
     384                 :         75 :     const int nCount = 7;
     385                 :         75 :     Sequence<OUString> aNames(nCount);
     386         [ +  - ]:         75 :     OUString* pNames = aNames.getArray();
     387         [ +  + ]:        600 :     for(int i = 0; i < nCount; i++)
     388                 :            :     {
     389                 :        525 :         pNames[i] = OUString::createFromAscii(aPropNames[i]);
     390                 :            :     }
     391                 :         75 :     return aNames;
     392                 :            : }
     393                 :            : 
     394                 :         75 : SwGridConfig::SwGridConfig(sal_Bool bIsWeb, SwMasterUsrPref& rPar) :
     395                 :            :     ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Grid") :  C2U("Office.Writer/Grid"),
     396                 :            :         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
     397                 :            :     rParent(rPar),
     398 [ +  + ][ +  - ]:         75 :     bWeb(bIsWeb)
     399                 :            : {
     400                 :         75 : }
     401                 :            : 
     402                 :         42 : SwGridConfig::~SwGridConfig()
     403                 :            : {
     404         [ -  + ]:         42 : }
     405                 :            : 
     406                 :          0 : void SwGridConfig::Commit()
     407                 :            : {
     408         [ #  # ]:          0 :     Sequence<OUString> aNames = GetPropertyNames();
     409                 :            : 
     410         [ #  # ]:          0 :     Sequence<Any> aValues(aNames.getLength());
     411         [ #  # ]:          0 :     Any* pValues = aValues.getArray();
     412                 :            : 
     413         [ #  # ]:          0 :     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     414                 :            :     {
     415                 :            :         sal_Bool bSet;
     416   [ #  #  #  #  :          0 :         switch(nProp)
             #  #  #  # ]
     417                 :            :         {
     418                 :          0 :             case  0: bSet = rParent.IsSnap(); break;//      "Option/SnapToGrid",
     419                 :          0 :             case  1: bSet = rParent.IsGridVisible(); break;//"Option/VisibleGrid",
     420                 :          0 :             case  2: bSet = rParent.IsSynchronize(); break;//  "Option/Synchronize",
     421 [ #  # ][ #  # ]:          0 :             case  3: pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100(rParent.GetSnapSize().Width()); break;//      "Resolution/XAxis",
     422 [ #  # ][ #  # ]:          0 :             case  4: pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100(rParent.GetSnapSize().Height()); break;//      "Resolution/YAxis",
     423         [ #  # ]:          0 :             case  5: pValues[nProp] <<= (sal_Int16)rParent.GetDivisionX(); break;//   "Subdivision/XAxis",
     424         [ #  # ]:          0 :             case  6: pValues[nProp] <<= (sal_Int16)rParent.GetDivisionY(); break;//   "Subdivision/YAxis"
     425                 :            :         }
     426         [ #  # ]:          0 :         if(nProp < 3)
     427         [ #  # ]:          0 :               pValues[nProp].setValue(&bSet, ::getBooleanCppuType());
     428                 :            :     }
     429 [ #  # ][ #  # ]:          0 :     PutProperties(aNames, aValues);
                 [ #  # ]
     430                 :          0 : }
     431                 :            : 
     432                 :         75 : void SwGridConfig::Load()
     433                 :            : {
     434         [ +  - ]:         75 :     Sequence<OUString> aNames = GetPropertyNames();
     435         [ +  - ]:         75 :     Sequence<Any> aValues = GetProperties(aNames);
     436                 :         75 :     const Any* pValues = aValues.getConstArray();
     437                 :            :     OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
     438         [ +  - ]:         75 :     if(aValues.getLength() == aNames.getLength())
     439                 :            :     {
     440                 :         75 :         Size aSnap(rParent.GetSnapSize());
     441         [ +  + ]:        600 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     442                 :            :         {
     443         [ +  - ]:        525 :             if(pValues[nProp].hasValue())
     444                 :            :             {
     445         [ +  + ]:        525 :                 sal_Bool bSet = nProp < 3 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False;
     446                 :        525 :                 sal_Int32 nSet = 0;
     447         [ +  + ]:        525 :                 if(nProp >= 3)
     448                 :        300 :                     pValues[nProp] >>= nSet;
     449   [ +  +  +  +  :        525 :                 switch(nProp)
             +  +  +  - ]
     450                 :            :                 {
     451                 :         75 :                     case  0: rParent.SetSnap(bSet); break;//        "Option/SnapToGrid",
     452                 :         75 :                     case  1: rParent.SetGridVisible(bSet); break;//"Option/VisibleGrid",
     453                 :         75 :                     case  2: rParent.SetSynchronize(bSet); break;//  "Option/Synchronize",
     454         [ +  - ]:         75 :                     case  3: aSnap.Width() = MM100_TO_TWIP(nSet); break;//      "Resolution/XAxis",
     455         [ +  - ]:         75 :                     case  4: aSnap.Height() = MM100_TO_TWIP(nSet); break;//      "Resolution/YAxis",
     456                 :         75 :                     case  5: rParent.SetDivisionX((short)nSet); break;//   "Subdivision/XAxis",
     457                 :        525 :                     case  6: rParent.SetDivisionY((short)nSet); break;//   "Subdivision/YAxis"
     458                 :            :                 }
     459                 :            :             }
     460                 :            :         }
     461                 :         75 :         rParent.SetSnapSize(aSnap);
     462 [ +  - ][ +  - ]:         75 :     }
     463                 :         75 : }
     464                 :            : 
     465                 :          0 : void SwGridConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
     466                 :            : 
     467                 :         75 : Sequence<OUString> SwCursorConfig::GetPropertyNames()
     468                 :            : {
     469                 :            :     static const char* aPropNames[] =
     470                 :            :     {
     471                 :            :         "DirectCursor/UseDirectCursor", // 0
     472                 :            :         "DirectCursor/Insert",          // 1
     473                 :            :         "Option/ProtectedArea"          // 2
     474                 :            :     };
     475                 :         75 :     const int nCount = 3;
     476                 :         75 :     Sequence<OUString> aNames(nCount);
     477         [ +  - ]:         75 :     OUString* pNames = aNames.getArray();
     478         [ +  + ]:        300 :     for(int i = 0; i < nCount; i++)
     479                 :        225 :         pNames[i] = rtl::OUString::createFromAscii(aPropNames[i]);
     480                 :         75 :     return aNames;
     481                 :            : }
     482                 :            : 
     483                 :         75 : SwCursorConfig::SwCursorConfig(SwMasterUsrPref& rPar) :
     484                 :            :     ConfigItem(C2U("Office.Writer/Cursor"),
     485                 :            :         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
     486         [ +  - ]:         75 :     rParent(rPar)
     487                 :            : {
     488                 :         75 : }
     489                 :            : 
     490                 :         42 : SwCursorConfig::~SwCursorConfig()
     491                 :            : {
     492         [ -  + ]:         42 : }
     493                 :            : 
     494                 :          0 : void SwCursorConfig::Commit()
     495                 :            : {
     496         [ #  # ]:          0 :     Sequence<OUString> aNames = GetPropertyNames();
     497                 :            : 
     498         [ #  # ]:          0 :     Sequence<Any> aValues(aNames.getLength());
     499         [ #  # ]:          0 :     Any* pValues = aValues.getArray();
     500                 :            : 
     501         [ #  # ]:          0 :     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     502                 :            :     {
     503                 :            :         sal_Bool bSet;
     504   [ #  #  #  # ]:          0 :         switch(nProp)
     505                 :            :         {
     506                 :          0 :             case  0: bSet = rParent.IsShadowCursor();       break;//  "DirectCursor/UseDirectCursor",
     507         [ #  # ]:          0 :             case  1: pValues[nProp] <<= (sal_Int32)rParent.GetShdwCrsrFillMode();   break;//  "DirectCursor/Insert",
     508                 :          0 :             case  2: bSet = rParent.IsCursorInProtectedArea(); break;// "Option/ProtectedArea"
     509                 :            :         }
     510         [ #  # ]:          0 :         if(nProp != 1 )
     511         [ #  # ]:          0 :               pValues[nProp].setValue(&bSet, ::getBooleanCppuType());
     512                 :            :     }
     513 [ #  # ][ #  # ]:          0 :     PutProperties(aNames, aValues);
                 [ #  # ]
     514                 :          0 : }
     515                 :            : 
     516                 :         75 : void SwCursorConfig::Load()
     517                 :            : {
     518         [ +  - ]:         75 :     Sequence<OUString> aNames = GetPropertyNames();
     519         [ +  - ]:         75 :     Sequence<Any> aValues = GetProperties(aNames);
     520                 :         75 :     const Any* pValues = aValues.getConstArray();
     521                 :            :     OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
     522         [ +  - ]:         75 :     if(aValues.getLength() == aNames.getLength())
     523                 :            :     {
     524                 :            : 
     525         [ +  + ]:        300 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     526                 :            :         {
     527         [ +  - ]:        225 :             if(pValues[nProp].hasValue())
     528                 :            :             {
     529                 :        225 :                 sal_Bool bSet = sal_False;
     530                 :        225 :                 sal_Int32 nSet = 0;
     531         [ +  + ]:        225 :                 if(nProp != 1 )
     532                 :        150 :                     bSet = *(sal_Bool*)pValues[nProp].getValue();
     533                 :            :                 else
     534                 :         75 :                     pValues[nProp] >>= nSet;
     535   [ +  +  +  - ]:        225 :                 switch(nProp)
     536                 :            :                 {
     537                 :         75 :                     case  0: rParent.SetShadowCursor(bSet);         break;//  "DirectCursor/UseDirectCursor",
     538                 :         75 :                     case  1: rParent.SetShdwCrsrFillMode((sal_uInt8)nSet); break;//  "DirectCursor/Insert",
     539                 :        225 :                     case  2: rParent.SetCursorInProtectedArea(bSet); break;// "Option/ProtectedArea"
     540                 :            :                 }
     541                 :            :             }
     542                 :            :         }
     543                 :            : 
     544 [ +  - ][ +  - ]:         75 :     }
     545                 :         75 : }
     546                 :            : 
     547                 :          0 : void SwCursorConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
     548                 :            : 
     549                 :          2 : SwWebColorConfig::SwWebColorConfig(SwMasterUsrPref& rPar) :
     550                 :            :     ConfigItem(C2U("Office.WriterWeb/Background"),
     551                 :            :         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
     552                 :            :     rParent(rPar),
     553 [ +  - ][ +  - ]:          2 :     aPropNames(1)
     554                 :            : {
     555 [ +  - ][ +  - ]:          2 :     aPropNames.getArray()[0] = C2U("Color");
     556                 :          2 : }
     557                 :            : 
     558         [ +  - ]:          2 : SwWebColorConfig::~SwWebColorConfig()
     559                 :            : {
     560         [ -  + ]:          4 : }
     561                 :            : 
     562                 :          0 : void SwWebColorConfig::Commit()
     563                 :            : {
     564         [ #  # ]:          0 :     Sequence<Any> aValues(aPropNames.getLength());
     565         [ #  # ]:          0 :     Any* pValues = aValues.getArray();
     566         [ #  # ]:          0 :     for(int nProp = 0; nProp < aPropNames.getLength(); nProp++)
     567                 :            :     {
     568         [ #  # ]:          0 :         switch(nProp)
     569                 :            :         {
     570         [ #  # ]:          0 :             case  0: pValues[nProp] <<= (sal_Int32)rParent.GetRetoucheColor().GetColor();   break;// "Color",
     571                 :            :         }
     572                 :            :     }
     573 [ #  # ][ #  # ]:          0 :     PutProperties(aPropNames, aValues);
     574                 :          0 : }
     575                 :            : 
     576                 :          0 : void SwWebColorConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
     577                 :            : 
     578                 :          2 : void SwWebColorConfig::Load()
     579                 :            : {
     580         [ +  - ]:          2 :     Sequence<Any> aValues = GetProperties(aPropNames);
     581                 :          2 :     const Any* pValues = aValues.getConstArray();
     582                 :            :     OSL_ENSURE(aValues.getLength() == aPropNames.getLength(), "GetProperties failed");
     583         [ +  - ]:          2 :     if(aValues.getLength() == aPropNames.getLength())
     584                 :            :     {
     585         [ +  + ]:          4 :         for(int nProp = 0; nProp < aPropNames.getLength(); nProp++)
     586                 :            :         {
     587         [ -  + ]:          2 :             if(pValues[nProp].hasValue())
     588                 :            :             {
     589         [ #  # ]:          0 :                 switch(nProp)
     590                 :            :                 {
     591                 :            :                     case  0:
     592                 :          0 :                         sal_Int32 nSet = 0;
     593                 :          0 :                         pValues[nProp] >>= nSet; rParent.SetRetoucheColor(nSet);
     594                 :            :                     break;// "Color",
     595                 :            :                 }
     596                 :            :             }
     597                 :            :         }
     598         [ +  - ]:          2 :     }
     599                 :          2 : }
     600                 :            : 
     601                 :            : 
     602                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10