bump product version to 5.0.4.1
[LibreOffice.git] / xmloff / source / text / XMLLineNumberingSeparatorImportContext.cxx
blob50235ef7bb9979c3b48792b8d1bde173df787121
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 .
21 #include "XMLLineNumberingSeparatorImportContext.hxx"
23 #include <sax/tools/converter.hxx>
24 #include "XMLLineNumberingImportContext.hxx"
25 #include <xmloff/xmlimp.hxx>
26 #include <xmloff/nmspmap.hxx>
27 #include <xmloff/xmlnmspe.hxx>
28 #include <xmloff/xmltoken.hxx>
31 using namespace ::com::sun::star::uno;
33 using ::com::sun::star::xml::sax::XAttributeList;
34 using ::xmloff::token::IsXMLToken;
35 using ::xmloff::token::XML_INCREMENT;
37 TYPEINIT1( XMLLineNumberingSeparatorImportContext, SvXMLImportContext );
39 XMLLineNumberingSeparatorImportContext::XMLLineNumberingSeparatorImportContext(
40 SvXMLImport& rImport,
41 sal_uInt16 nPrfx,
42 const OUString& rLocalName,
43 XMLLineNumberingImportContext& rLineNumbering) :
44 SvXMLImportContext(rImport, nPrfx, rLocalName),
45 rLineNumberingContext(rLineNumbering)
49 XMLLineNumberingSeparatorImportContext::~XMLLineNumberingSeparatorImportContext()
53 void XMLLineNumberingSeparatorImportContext::StartElement(
54 const Reference<XAttributeList> & xAttrList)
56 sal_Int16 nLength = xAttrList->getLength();
57 for(sal_Int16 i=0; i<nLength; i++)
59 OUString sLocalName;
60 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
61 GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
63 if ( (nPrefix == XML_NAMESPACE_TEXT) &&
64 IsXMLToken(sLocalName, XML_INCREMENT) )
66 sal_Int32 nTmp;
67 if (::sax::Converter::convertNumber(
68 nTmp, xAttrList->getValueByIndex(i), 0))
70 rLineNumberingContext.SetSeparatorIncrement((sal_Int16)nTmp);
72 // else: invalid number -> ignore
74 // else: unknown attribute -> ignore
78 void XMLLineNumberingSeparatorImportContext::Characters(
79 const OUString& rChars )
81 sSeparatorBuf.append(rChars);
84 void XMLLineNumberingSeparatorImportContext::EndElement()
86 rLineNumberingContext.SetSeparatorText(sSeparatorBuf.makeStringAndClear());
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */