Line data Source code
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 "XMLStringBufferImportContext.hxx"
21 : #include <xmloff/xmltoken.hxx>
22 : #include "xmloff/xmlnmspe.hxx"
23 :
24 :
25 : using ::rtl::OUString;
26 : using ::rtl::OUStringBuffer;
27 : using ::com::sun::star::uno::Reference;
28 : using ::com::sun::star::xml::sax::XAttributeList;
29 : using ::xmloff::token::IsXMLToken;
30 : using ::xmloff::token::XML_P;
31 :
32 :
33 0 : TYPEINIT1(XMLStringBufferImportContext, SvXMLImportContext);
34 :
35 6 : XMLStringBufferImportContext::XMLStringBufferImportContext(
36 : SvXMLImport& rImport,
37 : sal_uInt16 nPrefix,
38 : const OUString& sLocalName,
39 : OUStringBuffer& rBuffer) :
40 : SvXMLImportContext(rImport, nPrefix, sLocalName),
41 6 : rTextBuffer(rBuffer)
42 : {
43 6 : }
44 :
45 12 : XMLStringBufferImportContext::~XMLStringBufferImportContext()
46 : {
47 12 : }
48 :
49 0 : SvXMLImportContext *XMLStringBufferImportContext::CreateChildContext(
50 : sal_uInt16 nPrefix,
51 : const OUString& rLocalName,
52 : const Reference<XAttributeList> &)
53 : {
54 0 : return new XMLStringBufferImportContext(GetImport(), nPrefix,
55 0 : rLocalName, rTextBuffer);
56 : }
57 :
58 6 : void XMLStringBufferImportContext::Characters(
59 : const OUString& rChars )
60 : {
61 6 : rTextBuffer.append(rChars);
62 6 : }
63 :
64 6 : void XMLStringBufferImportContext::EndElement()
65 : {
66 : // add return for paragraph elements
67 8 : if ( (XML_NAMESPACE_TEXT == GetPrefix()) &&
68 2 : (IsXMLToken(GetLocalName(), XML_P)) )
69 : {
70 0 : rTextBuffer.append(sal_Unicode(0x0a));
71 : }
72 6 : }
73 :
74 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|