Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/starmath/inc/mathml/mathmlexport.hxx
Line
Count
Source
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
26
class SfxMedium;
27
class SmNode;
28
class SmVerticalBraceNode;
29
namespace com::sun::star
30
{
31
namespace io
32
{
33
class XOutputStream;
34
}
35
namespace beans
36
{
37
class XPropertySet;
38
}
39
}
40
41
class SmXMLExportWrapper
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
47
private:
48
    // Use customized entities
49
    bool m_bUseHTMLMLEntities;
50
51
public:
52
    explicit SmXMLExportWrapper(css::uno::Reference<css::frame::XModel> xRef)
53
0
        : xModel(std::move(xRef))
54
0
        , bFlat(true)
55
0
        , m_bUseHTMLMLEntities(false)
56
0
    {
57
0
    }
58
59
    bool Export(SfxMedium& rMedium);
60
0
    void SetFlat(bool bIn) { bFlat = bIn; }
61
62
0
    bool IsUseHTMLMLEntities() const { return m_bUseHTMLMLEntities; }
63
    void SetUseHTMLMLEntities(bool bUseHTMLMLEntities)
64
0
    {
65
0
        m_bUseHTMLMLEntities = bUseHTMLMLEntities;
66
0
    }
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
82
class SmXMLExport final : public SvXMLExport
83
{
84
    const SmNode* pTree;
85
    OUString aText;
86
    bool bSuccess;
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
108
public:
109
    SmXMLExport(const css::uno::Reference<css::uno::XComponentContext>& rContext,
110
                OUString const& implementationName, SvXMLExportFlags nExportFlags);
111
112
0
    void ExportAutoStyles_() override {}
113
0
    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
0
    bool GetSuccess() const { return bSuccess; }
123
};
124
125
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */