Branch data 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 : :
21 : : #include "SchXMLImport.hxx"
22 : : #include "SchXMLTextListContext.hxx"
23 : : #include "SchXMLParagraphContext.hxx"
24 : :
25 : : #include "xmloff/xmlnmspe.hxx"
26 : : #include <xmloff/xmltoken.hxx>
27 : : #include <xmloff/nmspmap.hxx>
28 : :
29 : : using ::rtl::OUString;
30 : : using ::com::sun::star::uno::Sequence;
31 : : using ::com::sun::star::uno::Reference;
32 : : using namespace com::sun::star;
33 : : using namespace ::xmloff::token;
34 : :
35 : : //-------------------------------------------------
36 : : class SchXMLListItemContext : public SvXMLImportContext
37 : : {
38 : : public:
39 : : SchXMLListItemContext( SvXMLImport& rImport, const OUString& rLocalName, OUString& rText );
40 : : virtual ~SchXMLListItemContext();
41 : : virtual void StartElement( const Reference< xml::sax::XAttributeList >& xAttrList );
42 : : virtual void EndElement();
43 : :
44 : : virtual SvXMLImportContext* CreateChildContext(
45 : : sal_uInt16 nPrefix,
46 : : const ::rtl::OUString& rLocalName,
47 : : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
48 : :
49 : : private:
50 : : ::rtl::OUString& m_rText;
51 : : };
52 : :
53 : 0 : SchXMLListItemContext::SchXMLListItemContext(
54 : : SvXMLImport& rImport
55 : : , const OUString& rLocalName
56 : : , OUString& rText )
57 : : : SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName )
58 : 0 : , m_rText( rText )
59 : : {
60 : 0 : }
61 : :
62 : 0 : SchXMLListItemContext::~SchXMLListItemContext()
63 [ # # ]: 0 : {}
64 : :
65 : 0 : void SchXMLListItemContext::StartElement( const Reference< xml::sax::XAttributeList >& /*xAttrList*/ )
66 : : {
67 : 0 : }
68 : :
69 : 0 : void SchXMLListItemContext::EndElement()
70 : : {
71 : 0 : }
72 : :
73 : 0 : SvXMLImportContext* SchXMLListItemContext::CreateChildContext(
74 : : sal_uInt16 nPrefix, const OUString& rLocalName,
75 : : const uno::Reference< xml::sax::XAttributeList >& )
76 : : {
77 : 0 : SvXMLImportContext* pContext = 0;
78 [ # # ][ # # ]: 0 : if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_P ) )
[ # # ]
79 [ # # ]: 0 : pContext = new SchXMLParagraphContext( GetImport(), rLocalName, m_rText );
80 : : else
81 [ # # ]: 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
82 : 0 : return pContext;
83 : : }
84 : :
85 : : //-------------------------------------------------
86 : :
87 : 0 : SchXMLTextListContext::SchXMLTextListContext(
88 : : SvXMLImport& rImport
89 : : , const OUString& rLocalName
90 : : , Sequence< OUString>& rTextList )
91 : : : SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName )
92 : : , m_rTextList( rTextList )
93 [ # # ]: 0 : , m_aTextVector()
94 : : {
95 : 0 : }
96 : :
97 : 0 : SchXMLTextListContext::~SchXMLTextListContext()
98 : : {
99 [ # # ]: 0 : }
100 : :
101 : 0 : void SchXMLTextListContext::StartElement( const Reference< xml::sax::XAttributeList >& /*xAttrList*/ )
102 : : {
103 : 0 : }
104 : :
105 : 0 : void SchXMLTextListContext::EndElement()
106 : : {
107 : 0 : sal_Int32 nCount = m_aTextVector.size();
108 : 0 : m_rTextList.realloc(nCount);
109 [ # # ]: 0 : for( sal_Int32 nN=0; nN<nCount; nN++ )
110 : 0 : m_rTextList[nN]=m_aTextVector[nN];
111 : 0 : }
112 : :
113 : 0 : SvXMLImportContext* SchXMLTextListContext::CreateChildContext(
114 : : sal_uInt16 nPrefix, const OUString& rLocalName,
115 : : const uno::Reference< xml::sax::XAttributeList >& )
116 : : {
117 : 0 : SvXMLImportContext* pContext = 0;
118 [ # # ][ # # ]: 0 : if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_LIST_ITEM ) )
[ # # ]
119 : : {
120 [ # # ]: 0 : m_aTextVector.push_back( OUString() );
121 [ # # ]: 0 : pContext = new SchXMLListItemContext( GetImport(), rLocalName, m_aTextVector.back() );
122 : : }
123 : : else
124 [ # # ]: 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
125 : 0 : return pContext;
126 : : }
127 : :
128 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|