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 <xmloff/xmlnmspe.hxx>
21 : #include "xmlimp.hxx"
22 :
23 : using namespace ::com::sun::star;
24 : using namespace ::com::sun::star::uno;
25 : using namespace ::com::sun::star::text;
26 :
27 : // ---------------------------------------------------------------------
28 :
29 :
30 : class SwXMLBodyContentContext_Impl : public SvXMLImportContext
31 : {
32 412 : SwXMLImport& GetSwImport() { return (SwXMLImport&)GetImport(); }
33 :
34 : public:
35 :
36 : SwXMLBodyContentContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx,
37 : const OUString& rLName );
38 : virtual ~SwXMLBodyContentContext_Impl();
39 :
40 : virtual SvXMLImportContext *CreateChildContext(
41 : sal_uInt16 nPrefix, const OUString& rLocalName,
42 : const Reference< xml::sax::XAttributeList > & xAttrList );
43 :
44 : // The body element's text:global attribute can be ignored, because
45 : // we must have the correct object shell already.
46 : virtual void EndElement();
47 : };
48 :
49 52 : SwXMLBodyContentContext_Impl::SwXMLBodyContentContext_Impl( SwXMLImport& rImport,
50 : sal_uInt16 nPrfx,
51 : const OUString& rLName ) :
52 52 : SvXMLImportContext( rImport, nPrfx, rLName )
53 : {
54 52 : }
55 :
56 104 : SwXMLBodyContentContext_Impl::~SwXMLBodyContentContext_Impl()
57 : {
58 104 : }
59 :
60 412 : SvXMLImportContext *SwXMLBodyContentContext_Impl::CreateChildContext(
61 : sal_uInt16 nPrefix, const OUString& rLocalName,
62 : const Reference< xml::sax::XAttributeList > & xAttrList )
63 : {
64 412 : SvXMLImportContext *pContext = 0;
65 :
66 412 : pContext = GetSwImport().GetTextImport()->CreateTextChildContext(
67 412 : GetImport(), nPrefix, rLocalName, xAttrList,
68 824 : XML_TEXT_TYPE_BODY );
69 412 : if( !pContext )
70 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
71 :
72 412 : return pContext;
73 : }
74 :
75 52 : void SwXMLBodyContentContext_Impl::EndElement()
76 : {
77 : /* Code moved to SwXMLOmport::endDocument */
78 52 : GetImport().GetTextImport()->SetOutlineStyles( sal_False );
79 52 : }
80 :
81 52 : SvXMLImportContext *SwXMLImport::CreateBodyContentContext(
82 : const OUString& rLocalName )
83 : {
84 52 : SvXMLImportContext *pContext = 0;
85 :
86 52 : if( !IsStylesOnlyMode() )
87 : pContext = new SwXMLBodyContentContext_Impl( *this, XML_NAMESPACE_OFFICE,
88 52 : rLocalName );
89 : else
90 : pContext = new SvXMLImportContext( *this, XML_NAMESPACE_OFFICE,
91 0 : rLocalName );
92 :
93 52 : return pContext;
94 : }
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|