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