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 _MATHMLEXPORT_HXX_
21 : #define _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 286 : class SmXMLExportWrapper
42 : {
43 : com::sun::star::uno::Reference<com::sun::star::frame::XModel> xModel;
44 : sal_Bool bFlat; //set true for export to flat .mml, set false for
45 : //export to a .sxm (or whatever) package
46 : public:
47 286 : SmXMLExportWrapper(com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rRef)
48 286 : : xModel(rRef), bFlat(sal_True) {}
49 :
50 : sal_Bool Export(SfxMedium &rMedium);
51 286 : void SetFlat(sal_Bool bIn) {bFlat = bIn;}
52 :
53 : sal_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::lang::XMultiServiceFactory > & rFactory,
60 : ::com::sun::star::uno::Reference<
61 : ::com::sun::star::beans::XPropertySet > & rPropSet,
62 : const sal_Char* pComponentName );
63 :
64 : sal_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 >
67 : xComponent,
68 : const sal_Char* pStreamName,
69 : ::com::sun::star::uno::Reference<
70 : ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
71 : ::com::sun::star::uno::Reference<
72 : ::com::sun::star::beans::XPropertySet > & rPropSet,
73 : const sal_Char* pComponentName );
74 : };
75 :
76 : ////////////////////////////////////////////////////////////
77 :
78 : class SmXMLExport : public SvXMLExport
79 : {
80 : const SmNode * pTree;
81 : String aText;
82 : sal_Bool bSuccess;
83 :
84 : protected:
85 : void ExportNodes(const SmNode *pNode, int nLevel);
86 : void ExportTable(const SmNode *pNode, int nLevel);
87 : void ExportLine(const SmNode *pNode, int nLevel);
88 : void ExportExpression(const SmNode *pNode, int nLevel);
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 ExportSubSupScript(const SmNode *pNode, int nLevel);
97 : void ExportRoot(const SmNode *pNode, int nLevel);
98 : void ExportOperator(const SmNode *pNode, int nLevel);
99 : void ExportAttributes(const SmNode *pNode, int nLevel);
100 : void ExportFont(const SmNode *pNode, int nLevel);
101 : void ExportVerticalBrace(const SmNode *pNode, int nLevel);
102 : void ExportMatrix(const SmNode *pNode, int nLevel);
103 : void ExportBlank(const SmNode *pNode, int nLevel);
104 :
105 : public:
106 : SmXMLExport(
107 : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
108 : sal_uInt16 nExportFlags=EXPORT_ALL);
109 1144 : virtual ~SmXMLExport() {};
110 :
111 : // XServiceInfo (override parent method)
112 : ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
113 :
114 : // XUnoTunnel
115 : sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException);
116 : static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
117 :
118 0 : void _ExportAutoStyles() {}
119 0 : void _ExportMasterStyles() {}
120 : void _ExportContent();
121 : sal_uInt32 exportDoc(enum ::xmloff::token::XMLTokenEnum eClass);
122 :
123 : virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
124 : virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
125 :
126 572 : sal_Bool GetSuccess() {return bSuccess;}
127 : };
128 :
129 : ////////////////////////////////////////////////////////////
130 :
131 : #endif
132 :
133 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|