bump product version to 4.1.6.2
[LibreOffice.git] / xmloff / source / transform / PersMixedContentTContext.cxx
blob7d20c02be1b147c5adee8e56c91a8c5941c4f024
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
21 #include "TransformerBase.hxx"
22 #include "PersMixedContentTContext.hxx"
24 using namespace ::com::sun::star::uno;
25 using namespace ::com::sun::star::xml::sax;
27 //------------------------------------------------------------------------------
28 class XMLPersTextTContext_Impl : public XMLTransformerContext
30 OUString m_aCharacters;
32 public:
33 TYPEINFO();
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 );
43 virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
44 virtual void EndElement();
45 virtual void Characters( const OUString& rChars );
47 virtual sal_Bool IsPersistent() const;
48 virtual void Export();
49 const OUString& GetText() const { return m_aCharacters; }
52 TYPEINIT1( XMLPersTextTContext_Impl, XMLTransformerContext );
54 XMLPersTextTContext_Impl::XMLPersTextTContext_Impl(
55 XMLTransformerBase& rImp,
56 const OUString& rChars ) :
57 XMLTransformerContext( rImp, OUString() ),
58 m_aCharacters( rChars )
62 XMLPersTextTContext_Impl::~XMLPersTextTContext_Impl()
66 XMLTransformerContext *XMLPersTextTContext_Impl::CreateChildContext(
67 sal_uInt16,
68 const OUString&,
69 const OUString&,
70 const Reference< XAttributeList >& )
72 OSL_ENSURE( !this, "illegal call to CreateChildContext" );
73 return 0;
76 void XMLPersTextTContext_Impl::StartElement(
77 const Reference< XAttributeList >& )
79 OSL_ENSURE( !this, "illegal call to StartElement" );
82 void XMLPersTextTContext_Impl::EndElement()
84 OSL_ENSURE( !this, "illegal call to EndElement" );
87 sal_Bool XMLPersTextTContext_Impl::IsPersistent() const
89 return sal_True;
92 void XMLPersTextTContext_Impl::Characters( const OUString& rChars )
94 m_aCharacters += rChars;
97 void XMLPersTextTContext_Impl::Export()
99 GetTransformer().GetDocHandler()->characters( m_aCharacters );
102 //------------------------------------------------------------------------------
104 TYPEINIT1( XMLPersMixedContentTContext, XMLPersElemContentTContext );
106 XMLPersMixedContentTContext::XMLPersMixedContentTContext(
107 XMLTransformerBase& rImp,
108 const OUString& rQName ) :
109 XMLPersElemContentTContext( rImp, rQName )
113 XMLPersMixedContentTContext::XMLPersMixedContentTContext(
114 XMLTransformerBase& rImp,
115 const OUString& rQName,
116 sal_uInt16 nActionMap ) :
117 XMLPersElemContentTContext( rImp, rQName, nActionMap )
121 XMLPersMixedContentTContext::XMLPersMixedContentTContext(
122 XMLTransformerBase& rImp,
123 const OUString& rQName,
124 sal_uInt16 nPrefix,
125 ::xmloff::token::XMLTokenEnum eToken ) :
126 XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken )
130 XMLPersMixedContentTContext::XMLPersMixedContentTContext(
131 XMLTransformerBase& rImp,
132 const OUString& rQName,
133 sal_uInt16 nPrefix,
134 ::xmloff::token::XMLTokenEnum eToken,
135 sal_uInt16 nActionMap ) :
136 XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken, nActionMap )
140 XMLPersMixedContentTContext::~XMLPersMixedContentTContext()
144 void XMLPersMixedContentTContext::Characters( const OUString& rChars )
146 AddContent( new XMLPersTextTContext_Impl( GetTransformer(), rChars ) );
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */