cid#1640468 Dereference after null check
[LibreOffice.git] / sc / source / core / tool / filtopt.cxx
blob5c6ee2c437e838897351ac5fc2eb3e80b94a2c1c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
27 using namespace utl;
28 using namespace css::uno;
30 constexpr OUStringLiteral CFGPATH_FILTER = u"Office.Calc/Filter/Import";
32 #define SCFILTOPT_WK3 2
34 ScFilterOptions::ScFilterOptions() :
35 ConfigItem( CFGPATH_FILTER ),
36 bWK3Flag( false )
38 Sequence<OUString> aNames { u"MS_Excel/ColScale"_ustr, // SCFILTOPT_COLSCALE
39 u"MS_Excel/RowScale"_ustr, // SCFILTOPT_ROWSCALE
40 u"Lotus123/WK3"_ustr }; // SCFILTOPT_WK3
41 Sequence<Any> aValues = GetProperties(aNames);
42 const Any* pValues = aValues.getConstArray();
43 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
44 if(aValues.getLength() != aNames.getLength())
45 return;
47 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
49 OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
50 if(pValues[nProp].hasValue())
52 switch(nProp)
54 case SCFILTOPT_WK3:
55 bWK3Flag = ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] );
56 break;
62 void ScFilterOptions::ImplCommit()
64 // options are never modified from office
66 OSL_FAIL("trying to commit changed ScFilterOptions?");
69 void ScFilterOptions::Notify( const Sequence<OUString>& /* aPropertyNames */ )
71 OSL_FAIL("properties have been changed");
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */