Line data Source code
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 : #ifndef INCLUDED_STARMATH_SOURCE_MATHMLEXPORT_HXX
21 : #define INCLUDED_STARMATH_SOURCE_MATHMLEXPORT_HXX
22 :
23 : #include <xmloff/xmlimp.hxx>
24 : #include <xmloff/xmlexp.hxx>
25 : #include <xmloff/DocumentSettingsContext.hxx>
26 : #include <xmloff/xmltoken.hxx>
27 :
28 : #include <node.hxx>
29 :
30 : class SfxMedium;
31 : namespace com { namespace sun { namespace star {
32 : namespace io {
33 : class XOutputStream; }
34 : namespace beans {
35 : class XPropertySet; }
36 : } } }
37 :
38 :
39 :
40 :
41 1118 : class SmXMLExportWrapper
42 : {
43 : com::sun::star::uno::Reference<com::sun::star::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 : public:
47 1118 : SmXMLExportWrapper(com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rRef)
48 1118 : : xModel(rRef), bFlat(true) {}
49 :
50 : bool Export(SfxMedium &rMedium);
51 1118 : void SetFlat(bool bIn) {bFlat = bIn;}
52 :
53 : bool WriteThroughComponent(
54 : ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
55 : xOutputStream,
56 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
57 : xComponent,
58 : ::com::sun::star::uno::Reference<
59 : ::com::sun::star::uno::XComponentContext > & rxContext,
60 : ::com::sun::star::uno::Reference<
61 : ::com::sun::star::beans::XPropertySet > & rPropSet,
62 : const sal_Char* pComponentName );
63 :
64 : bool WriteThroughComponent(
65 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor,
66 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComponent,
67 : const sal_Char* pStreamName,
68 : ::com::sun::star::uno::Reference<
69 : ::com::sun::star::uno::XComponentContext > & rxContext,
70 : ::com::sun::star::uno::Reference<
71 : ::com::sun::star::beans::XPropertySet > & rPropSet,
72 : const sal_Char* pComponentName );
73 : };
74 :
75 :
76 :
77 : class SmXMLExport : public SvXMLExport
78 : {
79 : const SmNode * pTree;
80 : OUString aText;
81 : bool bSuccess;
82 :
83 : protected:
84 : void ExportNodes(const SmNode *pNode, int nLevel);
85 : void ExportTable(const SmNode *pNode, int nLevel);
86 : void ExportLine(const SmNode *pNode, int nLevel);
87 : void ExportExpression(const SmNode *pNode, int nLevel,
88 : bool bNoMrowContainer = false);
89 : void ExportText(const SmNode *pNode, int nLevel);
90 : void ExportMath(const SmNode *pNode, int nLevel);
91 : void ExportPolygon(const SmNode *pNode, int nLevel);
92 : void ExportBinaryHorizontal(const SmNode *pNode, int nLevel);
93 : void ExportUnaryHorizontal(const SmNode *pNode, int nLevel);
94 : void ExportBrace(const SmNode *pNode, int nLevel);
95 : void ExportBinaryVertical(const SmNode *pNode, int nLevel);
96 : void ExportBinaryDiagonal(const SmNode *pNode, int nLevel);
97 : void ExportSubSupScript(const SmNode *pNode, int nLevel);
98 : void ExportRoot(const SmNode *pNode, int nLevel);
99 : void ExportOperator(const SmNode *pNode, int nLevel);
100 : void ExportAttributes(const SmNode *pNode, int nLevel);
101 : void ExportFont(const SmNode *pNode, int nLevel);
102 : void ExportVerticalBrace(const SmNode *pNode, int nLevel);
103 : void ExportMatrix(const SmNode *pNode, int nLevel);
104 : void ExportBlank(const SmNode *pNode, int nLevel);
105 :
106 : public:
107 : SmXMLExport(
108 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
109 : OUString const & implementationName, sal_uInt16 nExportFlags);
110 4496 : virtual ~SmXMLExport() {};
111 :
112 : // XUnoTunnel
113 : sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
114 : static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
115 :
116 0 : void _ExportAutoStyles() SAL_OVERRIDE {}
117 0 : void _ExportMasterStyles() SAL_OVERRIDE {}
118 : void _ExportContent() SAL_OVERRIDE;
119 : sal_uInt32 exportDoc(enum ::xmloff::token::XMLTokenEnum eClass) SAL_OVERRIDE;
120 :
121 : virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps) SAL_OVERRIDE;
122 : virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps) SAL_OVERRIDE;
123 :
124 2236 : bool GetSuccess() {return bSuccess;}
125 : };
126 :
127 :
128 :
129 : #endif
130 :
131 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|