LibreOffice Module starmath (master) 1
mathmlimport.hxx
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#pragma once
21
22#include <utility>
23#include <xmloff/xmlimp.hxx>
25
26#include <deque>
27
28class SmNode;
29class SfxMedium;
30namespace com::sun::star
31{
32namespace beans
33{
34class XPropertySet;
35}
36}
37class SmModel;
38
39typedef std::deque<std::unique_ptr<SmNode>> SmNodeStack;
40
42{
44
45private:
46 // Use customized entities
48
49public:
51 : m_xModel(std::move(xRef))
53 {
54 }
55
56 ErrCode Import(SfxMedium& rMedium);
57 void useHTMLMLEntities(bool bUseHTMLMLEntities) { m_bUseHTMLMLEntities = bUseHTMLMLEntities; }
58
59 static ErrCode
60 ReadThroughComponent(const css::uno::Reference<css::io::XInputStream>& xInputStream,
61 const css::uno::Reference<css::lang::XComponent>& xModelComponent,
62 css::uno::Reference<css::uno::XComponentContext> const& rxContext,
63 css::uno::Reference<css::beans::XPropertySet> const& rPropSet,
64 const char* pFilterName, bool bEncrypted, bool bUseHTMLMLEntities);
65
66 static ErrCode
67 ReadThroughComponent(const css::uno::Reference<css::embed::XStorage>& xStorage,
68 const css::uno::Reference<css::lang::XComponent>& xModelComponent,
69 const char* pStreamName,
70 css::uno::Reference<css::uno::XComponentContext> const& rxContext,
71 css::uno::Reference<css::beans::XPropertySet> const& rPropSet,
72 const char* pFilterName, bool bUseHTMLMLEntities);
73};
74
75class SmXMLImport final : public SvXMLImport
76{
80 OUString aText;
82
83public:
84 SmXMLImport(const css::uno::Reference<css::uno::XComponentContext>& rContext,
85 OUString const& implementationName, SvXMLImportFlags nImportFlags);
86 virtual ~SmXMLImport() noexcept override;
87
88 void SAL_CALL endDocument() override;
89
91 sal_Int32 nElement,
92 const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList) override;
93
95
96 bool GetSuccess() const { return bSuccess; }
97 [[nodiscard]] const OUString& GetText() const { return aText; }
98 void SetText(const OUString& rStr) { aText = rStr; }
99
100 virtual void
101 SetViewSettings(const css::uno::Sequence<css::beans::PropertyValue>& aViewProps) override;
102 virtual void SetConfigurationSettings(
103 const css::uno::Sequence<css::beans::PropertyValue>& aViewProps) override;
104
106 bool TooDeep() const { return nParseDepth >= 2048; }
108 void SetSmSyntaxVersion(sal_uInt16 nSmSyntaxVersion) { mnSmSyntaxVersion = nSmSyntaxVersion; }
109 sal_uInt16 GetSmSyntaxVersion() const { return mnSmSyntaxVersion; }
110};
111
112/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: node.hxx:125
ErrCode Import(SfxMedium &rMedium)
SmXMLImportWrapper(rtl::Reference< SmModel > xRef)
rtl::Reference< SmModel > m_xModel
void useHTMLMLEntities(bool bUseHTMLMLEntities)
static ErrCode ReadThroughComponent(const css::uno::Reference< css::io::XInputStream > &xInputStream, const css::uno::Reference< css::lang::XComponent > &xModelComponent, css::uno::Reference< css::uno::XComponentContext > const &rxContext, css::uno::Reference< css::beans::XPropertySet > const &rPropSet, const char *pFilterName, bool bEncrypted, bool bUseHTMLMLEntities)
static ErrCode ReadThroughComponent(const css::uno::Reference< css::embed::XStorage > &xStorage, const css::uno::Reference< css::lang::XComponent > &xModelComponent, const char *pStreamName, css::uno::Reference< css::uno::XComponentContext > const &rxContext, css::uno::Reference< css::beans::XPropertySet > const &rPropSet, const char *pFilterName, bool bUseHTMLMLEntities)
SmXMLImport(const css::uno::Reference< css::uno::XComponentContext > &rContext, OUString const &implementationName, SvXMLImportFlags nImportFlags)
virtual ~SmXMLImport() noexcept override
void DecParseDepth()
bool GetSuccess() const
const OUString & GetText() const
void SetText(const OUString &rStr)
SvXMLImportContext * CreateFastContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
void SAL_CALL endDocument() override
void IncParseDepth()
SmNodeStack aNodeStack
bool TooDeep() const
SmNodeStack & GetNodeStack()
sal_uInt16 GetSmSyntaxVersion() const
OUString aText
virtual void SetViewSettings(const css::uno::Sequence< css::beans::PropertyValue > &aViewProps) override
void SetSmSyntaxVersion(sal_uInt16 nSmSyntaxVersion)
virtual void SetConfigurationSettings(const css::uno::Sequence< css::beans::PropertyValue > &aViewProps) override
sal_uInt16 mnSmSyntaxVersion
std::deque< std::unique_ptr< SmNode > > SmNodeStack
class SAL_NO_VTABLE XPropertySet
SvXMLImportFlags