LibreOffice Module sw (master)  1
xmltext.cxx
Go to the documentation of this file.
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 "xmlimp.hxx"
21 
22 using namespace ::com::sun::star;
23 using namespace ::com::sun::star::uno;
24 using namespace ::com::sun::star::text;
25 
26 namespace {
27 
28 class SwXMLBodyContentContext_Impl : public SvXMLImportContext
29 {
30  SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); }
31 
32 public:
33 
34  SwXMLBodyContentContext_Impl( SwXMLImport& rImport );
35 
37  sal_uInt16 nPrefix, const OUString& rLocalName,
38  const Reference< xml::sax::XAttributeList > & xAttrList ) override;
39 
40  // The body element's text:global attribute can be ignored, because
41  // we must have the correct object shell already.
42  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
43 };
44 
45 }
46 
47 SwXMLBodyContentContext_Impl::SwXMLBodyContentContext_Impl( SwXMLImport& rImport ) :
48  SvXMLImportContext( rImport )
49 {
50 }
51 
52 SvXMLImportContextRef SwXMLBodyContentContext_Impl::CreateChildContext(
53  sal_uInt16 nPrefix, const OUString& rLocalName,
54  const Reference< xml::sax::XAttributeList > & xAttrList )
55 {
56  SvXMLImportContext *pContext = GetSwImport().GetTextImport()->CreateTextChildContext(
57  GetImport(), nPrefix, rLocalName, xAttrList,
58  XMLTextType::Body );
59 
60  return pContext;
61 }
62 
63 void SwXMLBodyContentContext_Impl::endFastElement(sal_Int32 )
64 {
65  /* Code moved to SwXMLOmport::endDocument */
66  GetImport().GetTextImport()->SetOutlineStyles( false );
67 }
68 
70 {
71  SvXMLImportContext *pContext = nullptr;
72 
73  if( !IsStylesOnlyMode() )
74  pContext = new SwXMLBodyContentContext_Impl( *this );
75 
76  return pContext;
77 }
78 
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvXMLImport & GetImport()
bool IsStylesOnlyMode() const
Definition: xmlimp.hxx:143
SvXMLImportContext * CreateBodyContentContext()
Definition: xmltext.cxx:69
virtual void SAL_CALL endFastElement(sal_Int32 Element) override
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)