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
22using namespace ::com::sun::star;
23using namespace ::com::sun::star::uno;
24using namespace ::com::sun::star::text;
25
26namespace {
27
28class SwXMLBodyContentContext_Impl : public SvXMLImportContext
29{
30 SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); }
31
32public:
33
34 SwXMLBodyContentContext_Impl( SwXMLImport& rImport );
35
36 css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
37 sal_Int32 nElement,
38 const css::uno::Reference< css::xml::sax::XFastAttributeList >& 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
47SwXMLBodyContentContext_Impl::SwXMLBodyContentContext_Impl( SwXMLImport& rImport ) :
48 SvXMLImportContext( rImport )
49{
50}
51
52css::uno::Reference< css::xml::sax::XFastContextHandler > SwXMLBodyContentContext_Impl::createFastChildContext(
53 sal_Int32 nElement,
54 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
55{
56 return GetSwImport().GetTextImport()->CreateTextChildContext(
57 GetImport(), nElement, xAttrList,
58 XMLTextType::Body );
59}
60
61void SwXMLBodyContentContext_Impl::endFastElement(sal_Int32 )
62{
63 /* Code moved to SwXMLOmport::endDocument */
64 GetImport().GetTextImport()->SetOutlineStyles( false );
65}
66
68{
69 SvXMLImportContext *pContext = nullptr;
70
71 if( !IsStylesOnlyMode() )
72 pContext = new SwXMLBodyContentContext_Impl( *this );
73
74 return pContext;
75}
76
77/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL endFastElement(sal_Int32 Element) override
SvXMLImport & GetImport()
virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
SvXMLImportContext * CreateBodyContentContext()
Definition: xmltext.cxx:67
bool IsStylesOnlyMode() const
Definition: xmlimp.hxx:138