1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <com/sun/star/uno/Any.hxx>
21 #include <com/sun/star/uno/Sequence.hxx>
22 #include <osl/diagnose.h>
24 #include "filtopt.hxx"
25 #include "miscuno.hxx"
28 using namespace com::sun::star::uno
;
30 #define CFGPATH_FILTER "Office.Calc/Filter/Import"
32 #define SCFILTOPT_COLSCALE 0
33 #define SCFILTOPT_ROWSCALE 1
34 #define SCFILTOPT_WK3 2
35 #define SCFILTOPT_COUNT 3
37 Sequence
<OUString
> ScFilterOptions::GetPropertyNames()
39 static const char* aPropNames
[] =
41 "MS_Excel/ColScale", // SCFILTOPT_COLSCALE
42 "MS_Excel/RowScale", // SCFILTOPT_ROWSCALE
43 "Lotus123/WK3" // SCFILTOPT_WK3
45 Sequence
<OUString
> aNames(SCFILTOPT_COUNT
);
46 OUString
* pNames
= aNames
.getArray();
47 for(int i
= 0; i
< SCFILTOPT_COUNT
; i
++)
48 pNames
[i
] = OUString::createFromAscii(aPropNames
[i
]);
53 ScFilterOptions::ScFilterOptions() :
54 ConfigItem( OUString( CFGPATH_FILTER
) ),
59 Sequence
<OUString
> aNames
= GetPropertyNames();
60 Sequence
<Any
> aValues
= GetProperties(aNames
);
61 const Any
* pValues
= aValues
.getConstArray();
62 OSL_ENSURE(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
63 if(aValues
.getLength() == aNames
.getLength())
65 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
67 OSL_ENSURE(pValues
[nProp
].hasValue(), "property value missing");
68 if(pValues
[nProp
].hasValue())
72 case SCFILTOPT_COLSCALE
:
73 pValues
[nProp
] >>= fExcelColScale
;
75 case SCFILTOPT_ROWSCALE
:
76 pValues
[nProp
] >>= fExcelRowScale
;
79 bWK3Flag
= ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] );
87 void ScFilterOptions::ImplCommit()
89 // options are never modified from office
91 OSL_FAIL("trying to commit changed ScFilterOptions?");
94 void ScFilterOptions::Notify( const Sequence
<OUString
>& /* aPropertyNames */ )
96 OSL_FAIL("properties have been changed");
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */