LCOV - code coverage report
Current view: top level - sc/source/core/tool - filtopt.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 23 27 85.2 %
Date: 2015-06-13 12:38:46 Functions: 2 4 50.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 <com/sun/star/uno/Any.hxx>
      21             : #include <com/sun/star/uno/Sequence.hxx>
      22             : #include <osl/diagnose.h>
      23             : 
      24             : #include "filtopt.hxx"
      25             : #include "miscuno.hxx"
      26             : 
      27             : using namespace utl;
      28             : using namespace com::sun::star::uno;
      29             : 
      30             : #define CFGPATH_FILTER          "Office.Calc/Filter/Import"
      31             : 
      32             : #define SCFILTOPT_COLSCALE      0
      33             : #define SCFILTOPT_ROWSCALE      1
      34             : #define SCFILTOPT_WK3           2
      35             : #define SCFILTOPT_COUNT         3
      36             : 
      37           4 : Sequence<OUString> ScFilterOptions::GetPropertyNames()
      38             : {
      39             :     static const char* aPropNames[] =
      40             :     {
      41             :         "MS_Excel/ColScale",            // SCFILTOPT_COLSCALE
      42             :         "MS_Excel/RowScale",            // SCFILTOPT_ROWSCALE
      43             :         "Lotus123/WK3"                  // SCFILTOPT_WK3
      44             :     };
      45           4 :     Sequence<OUString> aNames(SCFILTOPT_COUNT);
      46           4 :     OUString* pNames = aNames.getArray();
      47          16 :     for(int i = 0; i < SCFILTOPT_COUNT; i++)
      48          12 :         pNames[i] = OUString::createFromAscii(aPropNames[i]);
      49             : 
      50           4 :     return aNames;
      51             : }
      52             : 
      53           4 : ScFilterOptions::ScFilterOptions() :
      54             :     ConfigItem( OUString( CFGPATH_FILTER ) ),
      55             :     bWK3Flag( false ),
      56             :     fExcelColScale( 0 ),
      57           4 :     fExcelRowScale( 0 )
      58             : {
      59           4 :     Sequence<OUString> aNames = GetPropertyNames();
      60           8 :     Sequence<Any> aValues = GetProperties(aNames);
      61           4 :     const Any* pValues = aValues.getConstArray();
      62             :     OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
      63           4 :     if(aValues.getLength() == aNames.getLength())
      64             :     {
      65          16 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
      66             :         {
      67             :             OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
      68          12 :             if(pValues[nProp].hasValue())
      69             :             {
      70          12 :                 switch(nProp)
      71             :                 {
      72             :                     case SCFILTOPT_COLSCALE:
      73           4 :                         pValues[nProp] >>= fExcelColScale;
      74           4 :                         break;
      75             :                     case SCFILTOPT_ROWSCALE:
      76           4 :                         pValues[nProp] >>= fExcelRowScale;
      77           4 :                         break;
      78             :                     case SCFILTOPT_WK3:
      79           4 :                         bWK3Flag = ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] );
      80           4 :                         break;
      81             :                 }
      82             :             }
      83             :         }
      84           4 :     }
      85           4 : }
      86             : 
      87           0 : void ScFilterOptions::ImplCommit()
      88             : {
      89             :     // options are never modified from office
      90             : 
      91             :     OSL_FAIL("trying to commit changed ScFilterOptions?");
      92           0 : }
      93             : 
      94           0 : void ScFilterOptions::Notify( const Sequence<OUString>& /* aPropertyNames */ )
      95             : {
      96             :     OSL_FAIL("properties have been changed");
      97           0 : }
      98             : 
      99             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11