1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sc.hxx" 30 31 32 33 //------------------------------------------------------------------ 34 35 #include <tools/debug.hxx> 36 37 #include <com/sun/star/uno/Any.hxx> 38 #include <com/sun/star/uno/Sequence.hxx> 39 40 #include "filtopt.hxx" 41 #include "miscuno.hxx" 42 43 using namespace utl; 44 using namespace rtl; 45 using namespace com::sun::star::uno; 46 47 //------------------------------------------------------------------ 48 49 #define CFGPATH_FILTER "Office.Calc/Filter/Import" 50 51 #define SCFILTOPT_COLSCALE 0 52 #define SCFILTOPT_ROWSCALE 1 53 #define SCFILTOPT_WK3 2 54 #define SCFILTOPT_COUNT 3 55 56 Sequence<OUString> ScFilterOptions::GetPropertyNames() 57 { 58 static const char* aPropNames[] = 59 { 60 "MS_Excel/ColScale", // SCFILTOPT_COLSCALE 61 "MS_Excel/RowScale", // SCFILTOPT_ROWSCALE 62 "Lotus123/WK3" // SCFILTOPT_WK3 63 }; 64 Sequence<OUString> aNames(SCFILTOPT_COUNT); 65 OUString* pNames = aNames.getArray(); 66 for(int i = 0; i < SCFILTOPT_COUNT; i++) 67 pNames[i] = OUString::createFromAscii(aPropNames[i]); 68 69 return aNames; 70 } 71 72 ScFilterOptions::ScFilterOptions() : 73 ConfigItem( OUString::createFromAscii( CFGPATH_FILTER ) ), 74 bWK3Flag( sal_False ), 75 fExcelColScale( 0 ), 76 fExcelRowScale( 0 ) 77 { 78 Sequence<OUString> aNames = GetPropertyNames(); 79 Sequence<Any> aValues = GetProperties(aNames); 80 // EnableNotification(aNames); 81 const Any* pValues = aValues.getConstArray(); 82 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); 83 if(aValues.getLength() == aNames.getLength()) 84 { 85 for(int nProp = 0; nProp < aNames.getLength(); nProp++) 86 { 87 DBG_ASSERT(pValues[nProp].hasValue(), "property value missing"); 88 if(pValues[nProp].hasValue()) 89 { 90 switch(nProp) 91 { 92 case SCFILTOPT_COLSCALE: 93 pValues[nProp] >>= fExcelColScale; 94 break; 95 case SCFILTOPT_ROWSCALE: 96 pValues[nProp] >>= fExcelRowScale; 97 break; 98 case SCFILTOPT_WK3: 99 bWK3Flag = ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ); 100 break; 101 } 102 } 103 } 104 } 105 } 106 107 108 void ScFilterOptions::Commit() 109 { 110 // options are never modified from office 111 112 DBG_ERROR("trying to commit changed ScFilterOptions?"); 113 } 114 115 void ScFilterOptions::Notify( const Sequence<rtl::OUString>& /* aPropertyNames */ ) 116 { 117 DBG_ERROR("properties have been changed"); 118 } 119 120 121