1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "TransformerBase.hxx"
21 #include "PersMixedContentTContext.hxx"
23 #include <osl/diagnose.h>
25 using namespace ::com::sun::star::uno
;
26 using namespace ::com::sun::star::xml::sax
;
28 class XMLPersTextTContext_Impl
: public XMLTransformerContext
30 OUString m_aCharacters
;
35 XMLPersTextTContext_Impl( XMLTransformerBase
& rTransformer
,
36 const OUString
& rChars
);
37 virtual ~XMLPersTextTContext_Impl();
39 virtual XMLTransformerContext
*CreateChildContext( sal_uInt16 nPrefix
,
40 const OUString
& rLocalName
,
41 const OUString
& rQName
,
42 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
43 virtual void StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
44 virtual void EndElement() SAL_OVERRIDE
;
45 virtual void Characters( const OUString
& rChars
) SAL_OVERRIDE
;
47 virtual bool IsPersistent() const SAL_OVERRIDE
;
48 virtual void Export() SAL_OVERRIDE
;
51 TYPEINIT1( XMLPersTextTContext_Impl
, XMLTransformerContext
);
53 XMLPersTextTContext_Impl::XMLPersTextTContext_Impl(
54 XMLTransformerBase
& rImp
,
55 const OUString
& rChars
) :
56 XMLTransformerContext( rImp
, OUString() ),
57 m_aCharacters( rChars
)
61 XMLPersTextTContext_Impl::~XMLPersTextTContext_Impl()
65 XMLTransformerContext
*XMLPersTextTContext_Impl::CreateChildContext(
69 const Reference
< XAttributeList
>& )
71 OSL_ENSURE( false, "illegal call to CreateChildContext" );
75 void XMLPersTextTContext_Impl::StartElement(
76 const Reference
< XAttributeList
>& )
78 OSL_ENSURE( false, "illegal call to StartElement" );
81 void XMLPersTextTContext_Impl::EndElement()
83 OSL_ENSURE( false, "illegal call to EndElement" );
86 bool XMLPersTextTContext_Impl::IsPersistent() const
91 void XMLPersTextTContext_Impl::Characters( const OUString
& rChars
)
93 m_aCharacters
+= rChars
;
96 void XMLPersTextTContext_Impl::Export()
98 GetTransformer().GetDocHandler()->characters( m_aCharacters
);
101 TYPEINIT1( XMLPersMixedContentTContext
, XMLPersElemContentTContext
);
103 XMLPersMixedContentTContext::XMLPersMixedContentTContext(
104 XMLTransformerBase
& rImp
,
105 const OUString
& rQName
) :
106 XMLPersElemContentTContext( rImp
, rQName
)
110 XMLPersMixedContentTContext::XMLPersMixedContentTContext(
111 XMLTransformerBase
& rImp
,
112 const OUString
& rQName
,
113 sal_uInt16 nActionMap
) :
114 XMLPersElemContentTContext( rImp
, rQName
, nActionMap
)
118 XMLPersMixedContentTContext::XMLPersMixedContentTContext(
119 XMLTransformerBase
& rImp
,
120 const OUString
& rQName
,
122 ::xmloff::token::XMLTokenEnum eToken
) :
123 XMLPersElemContentTContext( rImp
, rQName
, nPrefix
, eToken
)
127 XMLPersMixedContentTContext::XMLPersMixedContentTContext(
128 XMLTransformerBase
& rImp
,
129 const OUString
& rQName
,
131 ::xmloff::token::XMLTokenEnum eToken
,
132 sal_uInt16 nActionMap
) :
133 XMLPersElemContentTContext( rImp
, rQName
, nPrefix
, eToken
, nActionMap
)
137 XMLPersMixedContentTContext::~XMLPersMixedContentTContext()
141 void XMLPersMixedContentTContext::Characters( const OUString
& rChars
)
143 AddContent( new XMLPersTextTContext_Impl( GetTransformer(), rChars
) );
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */