LCOV - code coverage report
Current view: top level - sw/source/core/uibase/utlui - navicfg.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 44 0.0 %
Date: 2014-04-14 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <swtypes.hxx>
      21             : #include <navicfg.hxx>
      22             : #include <swcont.hxx>
      23             : #include <osl/diagnose.h>
      24             : #include <com/sun/star/uno/Any.hxx>
      25             : #include <com/sun/star/uno/Sequence.hxx>
      26             : 
      27             : #include <unomid.h>
      28             : 
      29             : using namespace ::utl;
      30             : using namespace ::rtl;
      31             : using namespace ::com::sun::star::uno;
      32             : 
      33           0 : Sequence<OUString> SwNavigationConfig::GetPropertyNames()
      34             : {
      35             :     static const char* aPropNames[] =
      36             :     {
      37             :         "RootType",             //0
      38             :         "SelectedPosition",     //1
      39             :         "OutlineLevel",         //2
      40             :         "InsertMode",           //3
      41             :         "ActiveBlock",          //4
      42             :         "ShowListBox",          //5
      43             :         "GlobalDocMode"         //6
      44             :     };
      45           0 :     const int nCount = 7;
      46           0 :     Sequence<OUString> aNames(nCount);
      47           0 :     OUString* pNames = aNames.getArray();
      48           0 :     for(int i = 0; i < nCount; i++)
      49             :     {
      50           0 :         pNames[i] = OUString::createFromAscii(aPropNames[i]);
      51             :     }
      52           0 :     return aNames;
      53             : }
      54             : 
      55           0 : SwNavigationConfig::SwNavigationConfig() :
      56             :     utl::ConfigItem("Office.Writer/Navigator"),
      57             :     nRootType(0xffff),
      58             :     nSelectedPos(0),
      59             :     nOutlineLevel(MAXLEVEL),
      60             :     nRegionMode(REGION_MODE_NONE),
      61             :     nActiveBlock(0),
      62             :     bIsSmall(sal_False),
      63           0 :     bIsGlobalActive(sal_True)
      64             : {
      65           0 :     Sequence<OUString> aNames = GetPropertyNames();
      66           0 :     Sequence<Any> aValues = GetProperties(aNames);
      67           0 :     const Any* pValues = aValues.getConstArray();
      68             :     OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
      69           0 :     if(aValues.getLength() == aNames.getLength())
      70             :     {
      71           0 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
      72             :         {
      73           0 :             if(pValues[nProp].hasValue())
      74             :             {
      75           0 :                 switch(nProp)
      76             :                 {
      77           0 :                     case 0: pValues[nProp] >>= nRootType;      break;
      78           0 :                     case 1: pValues[nProp] >>= nSelectedPos;   break;
      79           0 :                     case 2: pValues[nProp] >>= nOutlineLevel;  break;
      80           0 :                     case 3: pValues[nProp] >>= nRegionMode;    break;
      81           0 :                     case 4: pValues[nProp] >>= nActiveBlock;    break;
      82           0 :                     case 5: bIsSmall        = *(sal_Bool*)pValues[nProp].getValue();  break;
      83           0 :                     case 6: bIsGlobalActive = *(sal_Bool*)pValues[nProp].getValue();  break;
      84             :                 }
      85             :             }
      86             :         }
      87           0 :     }
      88           0 : }
      89             : 
      90           0 : SwNavigationConfig::~SwNavigationConfig()
      91             : {
      92           0 : }
      93             : 
      94           0 : void SwNavigationConfig::Commit()
      95             : {
      96           0 :     Sequence<OUString> aNames = GetPropertyNames();
      97           0 :     Sequence<Any> aValues(aNames.getLength());
      98           0 :     Any* pValues = aValues.getArray();
      99           0 :     const Type& rType = ::getBooleanCppuType();
     100             : 
     101           0 :     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     102             :     {
     103           0 :         switch(nProp)
     104             :         {
     105           0 :             case 0: pValues[nProp] <<= nRootType;     break;
     106           0 :             case 1: pValues[nProp] <<= nSelectedPos;  break;
     107           0 :             case 2: pValues[nProp] <<= nOutlineLevel; break;
     108           0 :             case 3: pValues[nProp] <<= nRegionMode;   break;
     109           0 :             case 4: pValues[nProp] <<= nActiveBlock;    break;
     110           0 :             case 5: pValues[nProp].setValue(&bIsSmall, rType);          break;
     111           0 :             case 6: pValues[nProp].setValue(&bIsGlobalActive, rType);   break;
     112             :         }
     113             :     }
     114           0 :     PutProperties(aNames, aValues);
     115           0 : }
     116             : 
     117           0 : void SwNavigationConfig::Notify( const ::com::sun::star::uno::Sequence< OUString >& ) {}
     118             : 
     119             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10