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 <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 
28 {
29  SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); }
30 
31 public:
32 
33  SwXMLBodyContentContext_Impl( SwXMLImport& rImport, const OUString& rLName );
34 
36  sal_uInt16 nPrefix, const OUString& rLocalName,
37  const Reference< xml::sax::XAttributeList > & xAttrList ) override;
38 
39  // The body element's text:global attribute can be ignored, because
40  // we must have the correct object shell already.
41  virtual void EndElement() override;
42 };
43 
45  const OUString& rLName ) :
46  SvXMLImportContext( rImport, XML_NAMESPACE_OFFICE, rLName )
47 {
48 }
49 
51  sal_uInt16 nPrefix, const OUString& rLocalName,
52  const Reference< xml::sax::XAttributeList > & xAttrList )
53 {
54  SvXMLImportContext *pContext = GetSwImport().GetTextImport()->CreateTextChildContext(
55  GetImport(), nPrefix, rLocalName, xAttrList,
56  XMLTextType::Body );
57  if( !pContext )
58  pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
59 
60  return pContext;
61 }
62 
64 {
65  /* Code moved to SwXMLOmport::endDocument */
66  GetImport().GetTextImport()->SetOutlineStyles( false );
67 }
68 
70  const OUString& rLocalName )
71 {
72  SvXMLImportContext *pContext = nullptr;
73 
74  if( !IsStylesOnlyMode() )
75  pContext = new SwXMLBodyContentContext_Impl( *this, rLocalName );
76  else
77  pContext = new SvXMLImportContext( *this, XML_NAMESPACE_OFFICE,
78  rLocalName );
79 
80  return pContext;
81 }
82 
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvXMLImport & GetImport()
SvXMLImportContext * CreateBodyContentContext(const OUString &rLocalName)
Definition: xmltext.cxx:69
rtl::Reference< XMLTextImportHelper > const & GetTextImport()
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const Reference< xml::sax::XAttributeList > &xAttrList) override
Definition: xmltext.cxx:50
bool IsStylesOnlyMode() const
Definition: xmlimp.hxx:155
friend friend class SvXMLImportContext
virtual void EndElement() override
Definition: xmltext.cxx:63
SvXMLImportContext(SvXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLName)
SwXMLImport & GetSwImport()
Definition: xmltext.cxx:29
SwXMLBodyContentContext_Impl(SwXMLImport &rImport, const OUString &rLName)
Definition: xmltext.cxx:44