fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / filter / xml / XMLCellRangeSourceContext.cxx
blob5fbbf75e256592f5f20d57dc4810be7f83b02f1b
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 <xmloff/nmspmap.hxx>
25 #include "xmlimprt.hxx"
27 using namespace ::com::sun::star;
29 ScMyImpCellRangeSource::ScMyImpCellRangeSource() :
30 nColumns( 0 ),
31 nRows( 0 ),
32 nRefresh( 0 )
36 ScXMLCellRangeSourceContext::ScXMLCellRangeSourceContext(
37 ScXMLImport& rImport,
38 sal_uInt16 nPrfx,
39 const OUString& rLName,
40 const uno::Reference< xml::sax::XAttributeList >& xAttrList,
41 ScMyImpCellRangeSource* pCellRangeSource ) :
42 SvXMLImportContext( rImport, nPrfx, rLName )
44 if( !xAttrList.is() ) return;
46 sal_Int16 nAttrCount = xAttrList->getLength();
47 const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetTableCellRangeSourceAttrTokenMap();
49 for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
51 const OUString& sAttrName(xAttrList->getNameByIndex( nIndex ));
52 const OUString& sValue(xAttrList->getValueByIndex( nIndex ));
53 OUString aLocalName;
54 sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
56 switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
58 case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_NAME:
59 pCellRangeSource->sSourceStr = sValue;
60 break;
61 case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_NAME:
62 pCellRangeSource->sFilterName = sValue;
63 break;
64 case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_OPTIONS:
65 pCellRangeSource->sFilterOptions = sValue;
66 break;
67 case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_HREF:
68 pCellRangeSource->sURL = GetScImport().GetAbsoluteReference(sValue);
69 break;
70 case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_COLUMN:
72 sal_Int32 nValue;
73 if (::sax::Converter::convertNumber( nValue, sValue, 1 ))
74 pCellRangeSource->nColumns = nValue;
75 else
76 pCellRangeSource->nColumns = 1;
78 break;
79 case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_ROW:
81 sal_Int32 nValue;
82 if (::sax::Converter::convertNumber( nValue, sValue, 1 ))
83 pCellRangeSource->nRows = nValue;
84 else
85 pCellRangeSource->nRows = 1;
87 break;
88 case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_REFRESH_DELAY:
90 double fTime;
91 if (::sax::Converter::convertDuration( fTime, sValue ))
92 pCellRangeSource->nRefresh = std::max( (sal_Int32)(fTime * 86400.0), (sal_Int32)0 );
94 break;
99 ScXMLCellRangeSourceContext::~ScXMLCellRangeSourceContext()
103 SvXMLImportContext *ScXMLCellRangeSourceContext::CreateChildContext(
104 sal_uInt16 nPrefix,
105 const OUString& rLName,
106 const uno::Reference< xml::sax::XAttributeList>& /* xAttrList */ )
108 return new SvXMLImportContext( GetImport(), nPrefix, rLName );
111 void ScXMLCellRangeSourceContext::EndElement()
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */