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