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