fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / filter / xml / xmllabri.cxx
blob82cc26d23c4c3400c92034044bbaa8aadc1cd04c
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 "xmllabri.hxx"
21 #include <xmloff/nmspmap.hxx>
22 #include <xmloff/xmltoken.hxx>
23 #include "xmlimprt.hxx"
25 using namespace ::com::sun::star;
26 using namespace xmloff::token;
28 ScXMLLabelRangesContext::ScXMLLabelRangesContext(
29 ScXMLImport& rImport,
30 sal_uInt16 nPrefix,
31 const OUString& rLName,
32 const uno::Reference< xml::sax::XAttributeList >& /* xAttrList */ ):
33 SvXMLImportContext( rImport, nPrefix, rLName )
35 rImport.LockSolarMutex();
38 ScXMLLabelRangesContext::~ScXMLLabelRangesContext()
40 GetScImport().UnlockSolarMutex();
43 SvXMLImportContext* ScXMLLabelRangesContext::CreateChildContext(
44 sal_uInt16 nPrefix,
45 const OUString& rLName,
46 const uno::Reference< xml::sax::XAttributeList >& xAttrList )
48 SvXMLImportContext* pContext(NULL);
49 const SvXMLTokenMap& rTokenMap(GetScImport().GetLabelRangesElemTokenMap());
51 switch( rTokenMap.Get( nPrefix, rLName ) )
53 case XML_TOK_LABEL_RANGE_ELEM:
54 pContext = new ScXMLLabelRangeContext( GetScImport(), nPrefix, rLName, xAttrList );
55 break;
57 if( !pContext )
58 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
60 return pContext;
63 void ScXMLLabelRangesContext::EndElement()
67 ScXMLLabelRangeContext::ScXMLLabelRangeContext(
68 ScXMLImport& rImport,
69 sal_uInt16 nPrfx,
70 const OUString& rLName,
71 const uno::Reference< xml::sax::XAttributeList >& xAttrList ) :
72 SvXMLImportContext( rImport, nPrfx, rLName ),
73 bColumnOrientation( false )
75 sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
76 const SvXMLTokenMap& rAttrTokenMap(GetScImport().GetLabelRangeAttrTokenMap());
78 for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
80 const OUString& sAttrName (xAttrList->getNameByIndex( nIndex ));
81 const OUString& sValue (xAttrList->getValueByIndex( nIndex ));
82 OUString aLocalName;
83 sal_uInt16 nPrefix (GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ));
85 switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
87 case XML_TOK_LABEL_RANGE_ATTR_LABEL_RANGE:
88 sLabelRangeStr = sValue;
89 break;
90 case XML_TOK_LABEL_RANGE_ATTR_DATA_RANGE:
91 sDataRangeStr = sValue;
92 break;
93 case XML_TOK_LABEL_RANGE_ATTR_ORIENTATION:
94 bColumnOrientation = IsXMLToken(sValue, XML_COLUMN );
95 break;
100 ScXMLLabelRangeContext::~ScXMLLabelRangeContext()
104 SvXMLImportContext* ScXMLLabelRangeContext::CreateChildContext(
105 sal_uInt16 nPrefix,
106 const OUString& rLName,
107 const uno::Reference< xml::sax::XAttributeList >& /* xAttrList */ )
109 return new SvXMLImportContext( GetImport(), nPrefix, rLName );
112 void ScXMLLabelRangeContext::EndElement()
114 // Label ranges must be stored as strings until all sheets are loaded
115 // (like named expressions).
117 ScMyLabelRange* pLabelRange = new ScMyLabelRange;
119 pLabelRange->sLabelRangeStr = sLabelRangeStr;
120 pLabelRange->sDataRangeStr = sDataRangeStr;
121 pLabelRange->bColumnOrientation = bColumnOrientation;
123 GetScImport().AddLabelRange(pLabelRange);
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */