tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / filter / xml / XMLCellRangeSourceContext.cxx
blob72bdc7b90677fc5d83334f15e8276c3bc0f34b72
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 "XMLCellRangeSourceContext.hxx"
22 #include <sax/tools/converter.hxx>
24 #include "xmlimprt.hxx"
25 #include <xmloff/xmlnamespace.hxx>
26 #include <xmloff/xmltoken.hxx>
28 using namespace ::com::sun::star;
29 using namespace xmloff::token;
31 ScMyImpCellRangeSource::ScMyImpCellRangeSource() :
32 nColumns( 0 ),
33 nRows( 0 ),
34 nRefresh( 0 )
38 ScXMLCellRangeSourceContext::ScXMLCellRangeSourceContext(
39 ScXMLImport& rImport,
40 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
41 ScMyImpCellRangeSource* pCellRangeSource ) :
42 ScXMLImportContext( rImport )
44 if ( !rAttrList.is() )
45 return;
47 for (auto &aIter : *rAttrList)
49 switch (aIter.getToken())
51 case XML_ELEMENT( TABLE, XML_NAME ):
52 pCellRangeSource->sSourceStr = aIter.toString();
53 break;
54 case XML_ELEMENT( TABLE, XML_FILTER_NAME ):
55 pCellRangeSource->sFilterName = aIter.toString();
56 break;
57 case XML_ELEMENT( TABLE, XML_FILTER_OPTIONS ):
58 pCellRangeSource->sFilterOptions = aIter.toString();
59 break;
60 case XML_ELEMENT( XLINK, XML_HREF ):
61 pCellRangeSource->sURL = GetScImport().GetAbsoluteReference(aIter.toString());
62 break;
63 case XML_ELEMENT( TABLE, XML_LAST_COLUMN_SPANNED ):
65 sal_Int32 nValue;
66 if (::sax::Converter::convertNumber( nValue, aIter.toView(), 1 ))
67 pCellRangeSource->nColumns = nValue;
68 else
69 pCellRangeSource->nColumns = 1;
71 break;
72 case XML_ELEMENT( TABLE, XML_LAST_ROW_SPANNED ):
74 sal_Int32 nValue;
75 if (::sax::Converter::convertNumber( nValue, aIter.toView(), 1 ))
76 pCellRangeSource->nRows = nValue;
77 else
78 pCellRangeSource->nRows = 1;
80 break;
81 case XML_ELEMENT( TABLE, XML_REFRESH_DELAY ):
83 double fTime;
84 if (::sax::Converter::convertDuration( fTime, aIter.toView() ))
85 pCellRangeSource->nRefresh = std::max( static_cast<sal_Int32>(fTime * 86400.0), sal_Int32(0) );
87 break;
92 ScXMLCellRangeSourceContext::~ScXMLCellRangeSourceContext()
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */