1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _MATHMLEXPORT_HXX_
29*cdf0e10cSrcweir #define _MATHMLEXPORT_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <xmloff/xmlimp.hxx>
32*cdf0e10cSrcweir #include <xmloff/xmlexp.hxx>
33*cdf0e10cSrcweir #include <xmloff/DocumentSettingsContext.hxx>
34*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include <node.hxx>
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir class SfxMedium;
39*cdf0e10cSrcweir namespace com { namespace sun { namespace star {
40*cdf0e10cSrcweir     namespace io {
41*cdf0e10cSrcweir         class XInputStream;
42*cdf0e10cSrcweir         class XOutputStream; }
43*cdf0e10cSrcweir     namespace beans {
44*cdf0e10cSrcweir         class XPropertySet; }
45*cdf0e10cSrcweir } } }
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir ////////////////////////////////////////////////////////////
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir class SmXMLExportWrapper
51*cdf0e10cSrcweir {
52*cdf0e10cSrcweir     com::sun::star::uno::Reference<com::sun::star::frame::XModel> xModel;
53*cdf0e10cSrcweir     sal_Bool bFlat;     //set true for export to flat .mml, set false for
54*cdf0e10cSrcweir                         //export to a .sxm (or whatever) package
55*cdf0e10cSrcweir public:
56*cdf0e10cSrcweir     SmXMLExportWrapper(com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rRef)
57*cdf0e10cSrcweir         : xModel(rRef), bFlat(sal_True) {}
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir     sal_Bool Export(SfxMedium &rMedium);
60*cdf0e10cSrcweir     void SetFlat(sal_Bool bIn) {bFlat = bIn;}
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir     sal_Bool WriteThroughComponent(
63*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
64*cdf0e10cSrcweir             xOutputStream,
65*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
66*cdf0e10cSrcweir             xComponent,
67*cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
68*cdf0e10cSrcweir             ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
69*cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
70*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet > & rPropSet,
71*cdf0e10cSrcweir         const sal_Char* pComponentName );
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir     sal_Bool WriteThroughComponent(
74*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor,
75*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
76*cdf0e10cSrcweir             xComponent,
77*cdf0e10cSrcweir         const sal_Char* pStreamName,
78*cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
79*cdf0e10cSrcweir             ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
80*cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
81*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet > & rPropSet,
82*cdf0e10cSrcweir         const sal_Char* pComponentName,
83*cdf0e10cSrcweir         sal_Bool bCompress=sal_True );
84*cdf0e10cSrcweir };
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir ////////////////////////////////////////////////////////////
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir class SmXMLExport : public SvXMLExport
89*cdf0e10cSrcweir {
90*cdf0e10cSrcweir     const SmNode *  pTree;
91*cdf0e10cSrcweir     String          aText;
92*cdf0e10cSrcweir     sal_Bool        bSuccess;
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir protected:
95*cdf0e10cSrcweir     void ExportNodes(const SmNode *pNode, int nLevel);
96*cdf0e10cSrcweir     void ExportTable(const SmNode *pNode, int nLevel);
97*cdf0e10cSrcweir     void ExportLine(const SmNode *pNode, int nLevel);
98*cdf0e10cSrcweir     void ExportExpression(const SmNode *pNode, int nLevel);
99*cdf0e10cSrcweir     void ExportText(const SmNode *pNode, int nLevel);
100*cdf0e10cSrcweir     void ExportMath(const SmNode *pNode, int nLevel);
101*cdf0e10cSrcweir     void ExportPolygon(const SmNode *pNode, int nLevel);
102*cdf0e10cSrcweir     void ExportBinaryHorizontal(const SmNode *pNode, int nLevel);
103*cdf0e10cSrcweir     void ExportUnaryHorizontal(const SmNode *pNode, int nLevel);
104*cdf0e10cSrcweir     void ExportBrace(const SmNode *pNode, int nLevel);
105*cdf0e10cSrcweir     void ExportBinaryVertical(const SmNode *pNode, int nLevel);
106*cdf0e10cSrcweir     void ExportSubSupScript(const SmNode *pNode, int nLevel);
107*cdf0e10cSrcweir     void ExportRoot(const SmNode *pNode, int nLevel);
108*cdf0e10cSrcweir     void ExportOperator(const SmNode *pNode, int nLevel);
109*cdf0e10cSrcweir     void ExportAttributes(const SmNode *pNode, int nLevel);
110*cdf0e10cSrcweir     void ExportFont(const SmNode *pNode, int nLevel);
111*cdf0e10cSrcweir     void ExportVerticalBrace(const SmNode *pNode, int nLevel);
112*cdf0e10cSrcweir     void ExportMatrix(const SmNode *pNode, int nLevel);
113*cdf0e10cSrcweir     void ExportBlank(const SmNode *pNode, int nLevel);
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir public:
116*cdf0e10cSrcweir     // #110680#
117*cdf0e10cSrcweir     SmXMLExport(
118*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
119*cdf0e10cSrcweir         sal_uInt16 nExportFlags=EXPORT_ALL);
120*cdf0e10cSrcweir     virtual ~SmXMLExport() {};
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir     // XServiceInfo (override parent method)
123*cdf0e10cSrcweir     ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir     // XUnoTunnel
126*cdf0e10cSrcweir     sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException);
127*cdf0e10cSrcweir     static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir     void _ExportAutoStyles() {}
130*cdf0e10cSrcweir     void _ExportMasterStyles() {}
131*cdf0e10cSrcweir     void _ExportContent();
132*cdf0e10cSrcweir     sal_uInt32 exportDoc(enum ::xmloff::token::XMLTokenEnum eClass);
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir     virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
135*cdf0e10cSrcweir     virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir     sal_Bool GetSuccess() {return bSuccess;}
138*cdf0e10cSrcweir };
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir ////////////////////////////////////////////////////////////
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir #endif
143*cdf0e10cSrcweir 
144