LibreOffice Module sc (master) 1
xmllabri.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include "xmllabri.hxx"
21#include <xmloff/xmltoken.hxx>
22#include "xmlimprt.hxx"
24
25using namespace ::com::sun::star;
26using namespace xmloff::token;
27
29 ScXMLImport& rImport ):
30 ScXMLImportContext( rImport )
31{
32 rImport.LockSolarMutex();
33}
34
36{
38}
39
40uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLLabelRangesContext::createFastChildContext(
41 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
42{
43 SvXMLImportContext* pContext(nullptr);
46
47 switch (nElement)
48 {
50 pContext = new ScXMLLabelRangeContext( GetScImport(), pAttribList );
51 break;
52 }
53
54 return pContext;
55}
56
58 ScXMLImport& rImport,
60 ScXMLImportContext( rImport ),
61 bColumnOrientation( false )
62{
63 if ( !rAttrList.is() )
64 return;
65
66 for (auto &aIter : *rAttrList)
67 {
68 switch (aIter.getToken())
69 {
71 sLabelRangeStr = aIter.toString();
72 break;
74 sDataRangeStr = aIter.toString();
75 break;
78 break;
79 }
80 }
81}
82
84{
85}
86
87void SAL_CALL ScXMLLabelRangeContext::endFastElement( sal_Int32 /*nElement*/ )
88{
89 // Label ranges must be stored as strings until all sheets are loaded
90 // (like named expressions).
91
92 ScMyLabelRange aLabelRange(
94
95 GetScImport().AddLabelRange(std::move(aLabelRange));
96}
97
98/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class exists only to provide GetScImport() to its derived classes.
ScXMLImport & GetScImport()
void LockSolarMutex()
Definition: xmlimprt.cxx:1519
void AddLabelRange(ScMyLabelRange aMyLabelRange)
Definition: xmlimprt.hxx:233
void UnlockSolarMutex()
Definition: xmlimprt.cxx:1537
virtual ~ScXMLLabelRangeContext() override
Definition: xmllabri.cxx:83
ScXMLLabelRangeContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList)
Definition: xmllabri.cxx:57
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmllabri.cxx:87
virtual ~ScXMLLabelRangesContext() override
Definition: xmllabri.cxx:35
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmllabri.cxx:40
ScXMLLabelRangesContext(ScXMLImport &rImport)
Definition: xmllabri.cxx:28
TABLE
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
XML_COLUMN
XML_LABEL_RANGE
XML_DATA_CELL_RANGE_ADDRESS
XML_LABEL_CELL_RANGE_ADDRESS
XML_ORIENTATION
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
#define XML_ELEMENT(prefix, name)