LibreOffice Module starmath (master) 1
mathmlexport.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/xmlexp.hxx>
24#include <xmloff/xmltoken.hxx>
25
26class SfxMedium;
27class SmNode;
29namespace com::sun::star
30{
31namespace io
32{
33class XOutputStream;
34}
35namespace beans
36{
37class XPropertySet;
38}
39}
40
42{
43 css::uno::Reference<css::frame::XModel> xModel;
44 bool bFlat; //set true for export to flat .mml, set false for
45 //export to a .sxm (or whatever) package
46
47private:
48 // Use customized entities
50
51public:
52 explicit SmXMLExportWrapper(css::uno::Reference<css::frame::XModel> xRef)
53 : xModel(std::move(xRef))
54 , bFlat(true)
56 {
57 }
58
59 bool Export(SfxMedium& rMedium);
60 void SetFlat(bool bIn) { bFlat = bIn; }
61
63 void SetUseHTMLMLEntities(bool bUseHTMLMLEntities)
64 {
65 m_bUseHTMLMLEntities = bUseHTMLMLEntities;
66 }
67
68 bool WriteThroughComponent(const css::uno::Reference<css::io::XOutputStream>& xOutputStream,
69 const css::uno::Reference<css::lang::XComponent>& xComponent,
70 css::uno::Reference<css::uno::XComponentContext> const& rxContext,
71 css::uno::Reference<css::beans::XPropertySet> const& rPropSet,
72 const char* pComponentName);
73
74 bool WriteThroughComponent(const css::uno::Reference<css::embed::XStorage>& xStor,
75 const css::uno::Reference<css::lang::XComponent>& xComponent,
76 const char* pStreamName,
77 css::uno::Reference<css::uno::XComponentContext> const& rxContext,
78 css::uno::Reference<css::beans::XPropertySet> const& rPropSet,
79 const char* pComponentName);
80};
81
82class SmXMLExport final : public SvXMLExport
83{
84 const SmNode* pTree;
85 OUString aText;
87
88 void ExportNodes(const SmNode* pNode, int nLevel);
89 void ExportTable(const SmNode* pNode, int nLevel);
90 void ExportLine(const SmNode* pNode, int nLevel);
91 void ExportExpression(const SmNode* pNode, int nLevel, bool bNoMrowContainer = false);
92 void ExportText(const SmNode* pNode);
93 void ExportMath(const SmNode* pNode);
94 void ExportBinaryHorizontal(const SmNode* pNode, int nLevel);
95 void ExportUnaryHorizontal(const SmNode* pNode, int nLevel);
96 void ExportBrace(const SmNode* pNode, int nLevel);
97 void ExportBinaryVertical(const SmNode* pNode, int nLevel);
98 void ExportBinaryDiagonal(const SmNode* pNode, int nLevel);
99 void ExportSubSupScript(const SmNode* pNode, int nLevel);
100 void ExportRoot(const SmNode* pNode, int nLevel);
101 void ExportOperator(const SmNode* pNode, int nLevel);
102 void ExportAttributes(const SmNode* pNode, int nLevel);
103 void ExportFont(const SmNode* pNode, int nLevel);
104 void ExportVerticalBrace(const SmVerticalBraceNode* pNode, int nLevel);
105 void ExportMatrix(const SmNode* pNode, int nLevel);
106 void ExportBlank(const SmNode* pNode);
107
108public:
109 SmXMLExport(const css::uno::Reference<css::uno::XComponentContext>& rContext,
110 OUString const& implementationName, SvXMLExportFlags nExportFlags);
111
112 void ExportAutoStyles_() override {}
113 void ExportMasterStyles_() override {}
114 void ExportContent_() override;
115 ErrCode exportDoc(enum ::xmloff::token::XMLTokenEnum eClass
116 = ::xmloff::token::XML_TOKEN_INVALID) override;
117
118 virtual void GetViewSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps) override;
119 virtual void
120 GetConfigurationSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps) override;
121
122 bool GetSuccess() const { return bSuccess; }
123};
124
125/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: node.hxx:125
Node for vertical brace construction.
Definition: node.hxx:1750
bool WriteThroughComponent(const css::uno::Reference< css::embed::XStorage > &xStor, const css::uno::Reference< css::lang::XComponent > &xComponent, const char *pStreamName, css::uno::Reference< css::uno::XComponentContext > const &rxContext, css::uno::Reference< css::beans::XPropertySet > const &rPropSet, const char *pComponentName)
bool WriteThroughComponent(const css::uno::Reference< css::io::XOutputStream > &xOutputStream, const css::uno::Reference< css::lang::XComponent > &xComponent, css::uno::Reference< css::uno::XComponentContext > const &rxContext, css::uno::Reference< css::beans::XPropertySet > const &rPropSet, const char *pComponentName)
SmXMLExportWrapper(css::uno::Reference< css::frame::XModel > xRef)
void SetUseHTMLMLEntities(bool bUseHTMLMLEntities)
css::uno::Reference< css::frame::XModel > xModel
void SetFlat(bool bIn)
bool IsUseHTMLMLEntities() const
bool Export(SfxMedium &rMedium)
void ExportBinaryHorizontal(const SmNode *pNode, int nLevel)
void ExportTable(const SmNode *pNode, int nLevel)
ErrCode exportDoc(enum ::xmloff::token::XMLTokenEnum eClass=::xmloff::token::XML_TOKEN_INVALID) override
bool GetSuccess() const
void ExportText(const SmNode *pNode)
const SmNode * pTree
void ExportLine(const SmNode *pNode, int nLevel)
void ExportBinaryVertical(const SmNode *pNode, int nLevel)
void ExportVerticalBrace(const SmVerticalBraceNode *pNode, int nLevel)
SmXMLExport(const css::uno::Reference< css::uno::XComponentContext > &rContext, OUString const &implementationName, SvXMLExportFlags nExportFlags)
void ExportNodes(const SmNode *pNode, int nLevel)
void ExportMatrix(const SmNode *pNode, int nLevel)
virtual void GetConfigurationSettings(css::uno::Sequence< css::beans::PropertyValue > &aProps) override
void ExportExpression(const SmNode *pNode, int nLevel, bool bNoMrowContainer=false)
void ExportBlank(const SmNode *pNode)
void ExportAutoStyles_() override
void ExportContent_() override
void ExportBrace(const SmNode *pNode, int nLevel)
void ExportSubSupScript(const SmNode *pNode, int nLevel)
OUString aText
void ExportRoot(const SmNode *pNode, int nLevel)
void ExportFont(const SmNode *pNode, int nLevel)
virtual void GetViewSettings(css::uno::Sequence< css::beans::PropertyValue > &aProps) override
void ExportUnaryHorizontal(const SmNode *pNode, int nLevel)
void ExportBinaryDiagonal(const SmNode *pNode, int nLevel)
void ExportMath(const SmNode *pNode)
void ExportAttributes(const SmNode *pNode, int nLevel)
void ExportMasterStyles_() override
void ExportOperator(const SmNode *pNode, int nLevel)
class SAL_NO_VTABLE XPropertySet
SvXMLExportFlags