Update ooo320-m1
[ooovba.git] / sw / source / filter / xml / xmltext.cxx
blob98aa5f4fbda5641861de7a29b0587b07954fa06e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmltext.cxx,v $
10 * $Revision: 1.16 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <xmloff/xmlnmspe.hxx>
36 #include "xmlimp.hxx"
38 using ::rtl::OUString;
39 using namespace ::com::sun::star;
40 using namespace ::com::sun::star::uno;
41 using namespace ::com::sun::star::text;
43 // ---------------------------------------------------------------------
46 class SwXMLBodyContentContext_Impl : public SvXMLImportContext
48 SwXMLImport& GetSwImport() { return (SwXMLImport&)GetImport(); }
50 public:
52 SwXMLBodyContentContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx,
53 const OUString& rLName );
54 virtual ~SwXMLBodyContentContext_Impl();
56 virtual SvXMLImportContext *CreateChildContext(
57 sal_uInt16 nPrefix, const OUString& rLocalName,
58 const Reference< xml::sax::XAttributeList > & xAttrList );
60 // The body element's text:global attribute can be ignored, because
61 // we must have the correct object shell already.
62 virtual void EndElement();
65 SwXMLBodyContentContext_Impl::SwXMLBodyContentContext_Impl( SwXMLImport& rImport,
66 sal_uInt16 nPrfx,
67 const OUString& rLName ) :
68 SvXMLImportContext( rImport, nPrfx, rLName )
72 SwXMLBodyContentContext_Impl::~SwXMLBodyContentContext_Impl()
76 SvXMLImportContext *SwXMLBodyContentContext_Impl::CreateChildContext(
77 sal_uInt16 nPrefix, const OUString& rLocalName,
78 const Reference< xml::sax::XAttributeList > & xAttrList )
80 SvXMLImportContext *pContext = 0;
82 pContext = GetSwImport().GetTextImport()->CreateTextChildContext(
83 GetImport(), nPrefix, rLocalName, xAttrList,
84 XML_TEXT_TYPE_BODY );
85 if( !pContext )
86 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
88 return pContext;
91 void SwXMLBodyContentContext_Impl::EndElement()
93 /* #108146# Code moved to SwXMLOmport::endDocument */
94 GetImport().GetTextImport()->SetOutlineStyles( sal_False );
97 SvXMLImportContext *SwXMLImport::CreateBodyContentContext(
98 const OUString& rLocalName )
100 SvXMLImportContext *pContext = 0;
102 if( !IsStylesOnlyMode() )
103 pContext = new SwXMLBodyContentContext_Impl( *this, XML_NAMESPACE_OFFICE,
104 rLocalName );
105 else
106 pContext = new SvXMLImportContext( *this, XML_NAMESPACE_OFFICE,
107 rLocalName );
109 return pContext;