Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "XMLLineNumberingSeparatorImportContext.hxx"
31 : :
32 : : #include <sax/tools/converter.hxx>
33 : : #include "XMLLineNumberingImportContext.hxx"
34 : : #include <xmloff/xmlimp.hxx>
35 : : #include <xmloff/nmspmap.hxx>
36 : : #include "xmloff/xmlnmspe.hxx"
37 : : #include <xmloff/xmltoken.hxx>
38 : :
39 : :
40 : : using namespace ::com::sun::star::uno;
41 : :
42 : : using ::com::sun::star::xml::sax::XAttributeList;
43 : : using ::rtl::OUString;
44 : : using ::rtl::OUStringBuffer;
45 : : using ::xmloff::token::IsXMLToken;
46 : : using ::xmloff::token::XML_INCREMENT;
47 : :
48 [ # # ][ # # ]: 0 : TYPEINIT1( XMLLineNumberingSeparatorImportContext, SvXMLImportContext );
49 : :
50 : 0 : XMLLineNumberingSeparatorImportContext::XMLLineNumberingSeparatorImportContext(
51 : : SvXMLImport& rImport,
52 : : sal_uInt16 nPrfx,
53 : : const OUString& rLocalName,
54 : : XMLLineNumberingImportContext& rLineNumbering) :
55 : : SvXMLImportContext(rImport, nPrfx, rLocalName),
56 : 0 : rLineNumberingContext(rLineNumbering)
57 : : {
58 : 0 : }
59 : :
60 : 0 : XMLLineNumberingSeparatorImportContext::~XMLLineNumberingSeparatorImportContext()
61 : : {
62 [ # # ]: 0 : }
63 : :
64 : 0 : void XMLLineNumberingSeparatorImportContext::StartElement(
65 : : const Reference<XAttributeList> & xAttrList)
66 : : {
67 : 0 : sal_Int16 nLength = xAttrList->getLength();
68 [ # # ]: 0 : for(sal_Int16 i=0; i<nLength; i++)
69 : : {
70 : 0 : OUString sLocalName;
71 : 0 : sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
72 [ # # # # ]: 0 : GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
[ # # ]
73 : :
74 [ # # ][ # # ]: 0 : if ( (nPrefix == XML_NAMESPACE_TEXT) &&
[ # # ]
75 [ # # ]: 0 : IsXMLToken(sLocalName, XML_INCREMENT) )
76 : : {
77 : : sal_Int32 nTmp;
78 [ # # # # ]: 0 : if (::sax::Converter::convertNumber(
79 [ # # ][ # # ]: 0 : nTmp, xAttrList->getValueByIndex(i), 0))
80 : : {
81 [ # # ]: 0 : rLineNumberingContext.SetSeparatorIncrement((sal_Int16)nTmp);
82 : : }
83 : : // else: invalid number -> ignore
84 : : }
85 : : // else: unknown attribute -> ignore
86 : 0 : }
87 : 0 : }
88 : :
89 : 0 : void XMLLineNumberingSeparatorImportContext::Characters(
90 : : const OUString& rChars )
91 : : {
92 : 0 : sSeparatorBuf.append(rChars);
93 : 0 : }
94 : :
95 : 0 : void XMLLineNumberingSeparatorImportContext::EndElement()
96 : : {
97 [ # # ]: 0 : rLineNumberingContext.SetSeparatorText(sSeparatorBuf.makeStringAndClear());
98 : 0 : }
99 : :
100 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|