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 <com/sun/star/uno/Any.hxx>
30 : : #include <com/sun/star/uno/Sequence.hxx>
31 : :
32 : : #include "filtopt.hxx"
33 : : #include "miscuno.hxx"
34 : :
35 : : using namespace utl;
36 : : using namespace com::sun::star::uno;
37 : :
38 : : using ::rtl::OUString;
39 : :
40 : : //------------------------------------------------------------------
41 : :
42 : : #define CFGPATH_FILTER "Office.Calc/Filter/Import"
43 : :
44 : : #define SCFILTOPT_COLSCALE 0
45 : : #define SCFILTOPT_ROWSCALE 1
46 : : #define SCFILTOPT_WK3 2
47 : : #define SCFILTOPT_COUNT 3
48 : :
49 : 0 : Sequence<OUString> ScFilterOptions::GetPropertyNames()
50 : : {
51 : : static const char* aPropNames[] =
52 : : {
53 : : "MS_Excel/ColScale", // SCFILTOPT_COLSCALE
54 : : "MS_Excel/RowScale", // SCFILTOPT_ROWSCALE
55 : : "Lotus123/WK3" // SCFILTOPT_WK3
56 : : };
57 : 0 : Sequence<OUString> aNames(SCFILTOPT_COUNT);
58 [ # # ]: 0 : OUString* pNames = aNames.getArray();
59 [ # # ]: 0 : for(int i = 0; i < SCFILTOPT_COUNT; i++)
60 : 0 : pNames[i] = OUString::createFromAscii(aPropNames[i]);
61 : :
62 : 0 : return aNames;
63 : : }
64 : :
65 : 0 : ScFilterOptions::ScFilterOptions() :
66 : : ConfigItem( OUString(RTL_CONSTASCII_USTRINGPARAM( CFGPATH_FILTER )) ),
67 : : bWK3Flag( false ),
68 : : fExcelColScale( 0 ),
69 [ # # ]: 0 : fExcelRowScale( 0 )
70 : : {
71 [ # # ]: 0 : Sequence<OUString> aNames = GetPropertyNames();
72 [ # # ]: 0 : Sequence<Any> aValues = GetProperties(aNames);
73 : 0 : const Any* pValues = aValues.getConstArray();
74 : : OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
75 [ # # ]: 0 : if(aValues.getLength() == aNames.getLength())
76 : : {
77 [ # # ]: 0 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
78 : : {
79 : : OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
80 [ # # ]: 0 : if(pValues[nProp].hasValue())
81 : : {
82 [ # # # # ]: 0 : switch(nProp)
83 : : {
84 : : case SCFILTOPT_COLSCALE:
85 : 0 : pValues[nProp] >>= fExcelColScale;
86 : 0 : break;
87 : : case SCFILTOPT_ROWSCALE:
88 : 0 : pValues[nProp] >>= fExcelRowScale;
89 : 0 : break;
90 : : case SCFILTOPT_WK3:
91 [ # # ]: 0 : bWK3Flag = ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] );
92 : 0 : break;
93 : : }
94 : : }
95 : : }
96 [ # # ][ # # ]: 0 : }
97 : 0 : }
98 : :
99 : :
100 : 0 : void ScFilterOptions::Commit()
101 : : {
102 : : // options are never modified from office
103 : :
104 : : OSL_FAIL("trying to commit changed ScFilterOptions?");
105 : 0 : }
106 : :
107 : 0 : void ScFilterOptions::Notify( const Sequence<OUString>& /* aPropertyNames */ )
108 : : {
109 : : OSL_FAIL("properties have been changed");
110 : 0 : }
111 : :
112 : :
113 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|