1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: filtopt.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 //------------------------------------------------------------------
38 #include <tools/debug.hxx>
40 #include <com/sun/star/uno/Any.hxx>
41 #include <com/sun/star/uno/Sequence.hxx>
43 #include "filtopt.hxx"
44 #include "miscuno.hxx"
48 using namespace com::sun::star::uno
;
50 //------------------------------------------------------------------
52 #define CFGPATH_FILTER "Office.Calc/Filter/Import"
54 #define SCFILTOPT_COLSCALE 0
55 #define SCFILTOPT_ROWSCALE 1
56 #define SCFILTOPT_WK3 2
57 #define SCFILTOPT_COUNT 3
59 Sequence
<OUString
> ScFilterOptions::GetPropertyNames()
61 static const char* aPropNames
[] =
63 "MS_Excel/ColScale", // SCFILTOPT_COLSCALE
64 "MS_Excel/RowScale", // SCFILTOPT_ROWSCALE
65 "Lotus123/WK3" // SCFILTOPT_WK3
67 Sequence
<OUString
> aNames(SCFILTOPT_COUNT
);
68 OUString
* pNames
= aNames
.getArray();
69 for(int i
= 0; i
< SCFILTOPT_COUNT
; i
++)
70 pNames
[i
] = OUString::createFromAscii(aPropNames
[i
]);
75 ScFilterOptions::ScFilterOptions() :
76 ConfigItem( OUString::createFromAscii( CFGPATH_FILTER
) ),
81 Sequence
<OUString
> aNames
= GetPropertyNames();
82 Sequence
<Any
> aValues
= GetProperties(aNames
);
83 // EnableNotification(aNames);
84 const Any
* pValues
= aValues
.getConstArray();
85 DBG_ASSERT(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
86 if(aValues
.getLength() == aNames
.getLength())
88 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
90 DBG_ASSERT(pValues
[nProp
].hasValue(), "property value missing");
91 if(pValues
[nProp
].hasValue())
95 case SCFILTOPT_COLSCALE
:
96 pValues
[nProp
] >>= fExcelColScale
;
98 case SCFILTOPT_ROWSCALE
:
99 pValues
[nProp
] >>= fExcelRowScale
;
102 bWK3Flag
= ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] );
111 void ScFilterOptions::Commit()
113 // options are never modified from office
115 DBG_ERROR("trying to commit changed ScFilterOptions?");
118 void ScFilterOptions::Notify( const Sequence
<rtl::OUString
>& /* aPropertyNames */ )
120 DBG_ERROR("properties have been changed");