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 "TransformerBase.hxx"
22 : : #include "PersMixedContentTContext.hxx"
23 : :
24 : : using ::rtl::OUString;
25 : : using namespace ::com::sun::star::uno;
26 : : using namespace ::com::sun::star::xml::sax;
27 : :
28 : : //------------------------------------------------------------------------------
29 : : class XMLPersTextTContext_Impl : public XMLTransformerContext
30 : : {
31 : : ::rtl::OUString m_aCharacters;
32 : :
33 : : public:
34 : : TYPEINFO();
35 : :
36 : : XMLPersTextTContext_Impl( XMLTransformerBase& rTransformer,
37 : : const ::rtl::OUString& rChars );
38 : : virtual ~XMLPersTextTContext_Impl();
39 : :
40 : : virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
41 : : const ::rtl::OUString& rLocalName,
42 : : const ::rtl::OUString& rQName,
43 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
44 : : virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
45 : : virtual void EndElement();
46 : : virtual void Characters( const ::rtl::OUString& rChars );
47 : :
48 : : virtual sal_Bool IsPersistent() const;
49 : : virtual void Export();
50 : : const ::rtl::OUString& GetText() const { return m_aCharacters; }
51 : : };
52 : :
53 [ # # ][ # # ]: 0 : TYPEINIT1( XMLPersTextTContext_Impl, XMLTransformerContext );
54 : :
55 : 0 : XMLPersTextTContext_Impl::XMLPersTextTContext_Impl(
56 : : XMLTransformerBase& rImp,
57 : : const OUString& rChars ) :
58 : : XMLTransformerContext( rImp, OUString() ),
59 [ # # ]: 0 : m_aCharacters( rChars )
60 : : {
61 : 0 : }
62 : :
63 : 0 : XMLPersTextTContext_Impl::~XMLPersTextTContext_Impl()
64 : : {
65 [ # # ]: 0 : }
66 : :
67 : 0 : XMLTransformerContext *XMLPersTextTContext_Impl::CreateChildContext(
68 : : sal_uInt16,
69 : : const OUString&,
70 : : const OUString&,
71 : : const Reference< XAttributeList >& )
72 : : {
73 : : OSL_ENSURE( !this, "illegal call to CreateChildContext" );
74 : 0 : return 0;
75 : : }
76 : :
77 : 0 : void XMLPersTextTContext_Impl::StartElement(
78 : : const Reference< XAttributeList >& )
79 : : {
80 : : OSL_ENSURE( !this, "illegal call to StartElement" );
81 : 0 : }
82 : :
83 : 0 : void XMLPersTextTContext_Impl::EndElement()
84 : : {
85 : : OSL_ENSURE( !this, "illegal call to EndElement" );
86 : 0 : }
87 : :
88 : 0 : sal_Bool XMLPersTextTContext_Impl::IsPersistent() const
89 : : {
90 : 0 : return sal_True;
91 : : }
92 : :
93 : 0 : void XMLPersTextTContext_Impl::Characters( const OUString& rChars )
94 : : {
95 : 0 : m_aCharacters += rChars;
96 : 0 : }
97 : :
98 : 0 : void XMLPersTextTContext_Impl::Export()
99 : : {
100 : 0 : GetTransformer().GetDocHandler()->characters( m_aCharacters );
101 : 0 : }
102 : :
103 : : //------------------------------------------------------------------------------
104 : :
105 [ # # ][ # # ]: 0 : TYPEINIT1( XMLPersMixedContentTContext, XMLPersElemContentTContext );
106 : :
107 : 106 : XMLPersMixedContentTContext::XMLPersMixedContentTContext(
108 : : XMLTransformerBase& rImp,
109 : : const OUString& rQName ) :
110 : 106 : XMLPersElemContentTContext( rImp, rQName )
111 : : {
112 : 106 : }
113 : :
114 : 44 : XMLPersMixedContentTContext::XMLPersMixedContentTContext(
115 : : XMLTransformerBase& rImp,
116 : : const OUString& rQName,
117 : : sal_uInt16 nActionMap ) :
118 : 44 : XMLPersElemContentTContext( rImp, rQName, nActionMap )
119 : : {
120 : 44 : }
121 : :
122 : 0 : XMLPersMixedContentTContext::XMLPersMixedContentTContext(
123 : : XMLTransformerBase& rImp,
124 : : const OUString& rQName,
125 : : sal_uInt16 nPrefix,
126 : : ::xmloff::token::XMLTokenEnum eToken ) :
127 : 0 : XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken )
128 : : {
129 : 0 : }
130 : :
131 : 0 : XMLPersMixedContentTContext::XMLPersMixedContentTContext(
132 : : XMLTransformerBase& rImp,
133 : : const OUString& rQName,
134 : : sal_uInt16 nPrefix,
135 : : ::xmloff::token::XMLTokenEnum eToken,
136 : : sal_uInt16 nActionMap ) :
137 : 0 : XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken, nActionMap )
138 : : {
139 : 0 : }
140 : :
141 : 150 : XMLPersMixedContentTContext::~XMLPersMixedContentTContext()
142 : : {
143 [ - + ]: 300 : }
144 : :
145 : 0 : void XMLPersMixedContentTContext::Characters( const OUString& rChars )
146 : : {
147 [ # # ]: 0 : AddContent( new XMLPersTextTContext_Impl( GetTransformer(), rChars ) );
148 : 0 : }
149 : :
150 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|