1*f6a9d5caSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6a9d5caSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6a9d5caSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6a9d5caSAndrew Rist  * distributed with this work for additional information
6*f6a9d5caSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6a9d5caSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6a9d5caSAndrew Rist  * "License"); you may not use this file except in compliance
9*f6a9d5caSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f6a9d5caSAndrew Rist  *
11*f6a9d5caSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f6a9d5caSAndrew Rist  *
13*f6a9d5caSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6a9d5caSAndrew Rist  * software distributed under the License is distributed on an
15*f6a9d5caSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6a9d5caSAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6a9d5caSAndrew Rist  * specific language governing permissions and limitations
18*f6a9d5caSAndrew Rist  * under the License.
19*f6a9d5caSAndrew Rist  *
20*f6a9d5caSAndrew Rist  *************************************************************/
21*f6a9d5caSAndrew Rist 
22*f6a9d5caSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _MATHMLEXPORT_HXX_
25cdf0e10cSrcweir #define _MATHMLEXPORT_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <xmloff/xmlimp.hxx>
28cdf0e10cSrcweir #include <xmloff/xmlexp.hxx>
29cdf0e10cSrcweir #include <xmloff/DocumentSettingsContext.hxx>
30cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <node.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir class SfxMedium;
35cdf0e10cSrcweir namespace com { namespace sun { namespace star {
36cdf0e10cSrcweir     namespace io {
37cdf0e10cSrcweir         class XInputStream;
38cdf0e10cSrcweir         class XOutputStream; }
39cdf0e10cSrcweir     namespace beans {
40cdf0e10cSrcweir         class XPropertySet; }
41cdf0e10cSrcweir } } }
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 
44cdf0e10cSrcweir ////////////////////////////////////////////////////////////
45cdf0e10cSrcweir 
46cdf0e10cSrcweir class SmXMLExportWrapper
47cdf0e10cSrcweir {
48cdf0e10cSrcweir     com::sun::star::uno::Reference<com::sun::star::frame::XModel> xModel;
49cdf0e10cSrcweir     sal_Bool bFlat;     //set true for export to flat .mml, set false for
50cdf0e10cSrcweir                         //export to a .sxm (or whatever) package
51cdf0e10cSrcweir public:
SmXMLExportWrapper(com::sun::star::uno::Reference<com::sun::star::frame::XModel> & rRef)52cdf0e10cSrcweir     SmXMLExportWrapper(com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rRef)
53cdf0e10cSrcweir         : xModel(rRef), bFlat(sal_True) {}
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     sal_Bool Export(SfxMedium &rMedium);
SetFlat(sal_Bool bIn)56cdf0e10cSrcweir     void SetFlat(sal_Bool bIn) {bFlat = bIn;}
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     sal_Bool WriteThroughComponent(
59cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
60cdf0e10cSrcweir             xOutputStream,
61cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
62cdf0e10cSrcweir             xComponent,
63cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
64cdf0e10cSrcweir             ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
65cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
66cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet > & rPropSet,
67cdf0e10cSrcweir         const sal_Char* pComponentName );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     sal_Bool WriteThroughComponent(
70cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor,
71cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
72cdf0e10cSrcweir             xComponent,
73cdf0e10cSrcweir         const sal_Char* pStreamName,
74cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
75cdf0e10cSrcweir             ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
76cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
77cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet > & rPropSet,
78cdf0e10cSrcweir         const sal_Char* pComponentName,
79cdf0e10cSrcweir         sal_Bool bCompress=sal_True );
80cdf0e10cSrcweir };
81cdf0e10cSrcweir 
82cdf0e10cSrcweir ////////////////////////////////////////////////////////////
83cdf0e10cSrcweir 
84cdf0e10cSrcweir class SmXMLExport : public SvXMLExport
85cdf0e10cSrcweir {
86cdf0e10cSrcweir     const SmNode *  pTree;
87cdf0e10cSrcweir     String          aText;
88cdf0e10cSrcweir     sal_Bool        bSuccess;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir protected:
91cdf0e10cSrcweir     void ExportNodes(const SmNode *pNode, int nLevel);
92cdf0e10cSrcweir     void ExportTable(const SmNode *pNode, int nLevel);
93cdf0e10cSrcweir     void ExportLine(const SmNode *pNode, int nLevel);
94cdf0e10cSrcweir     void ExportExpression(const SmNode *pNode, int nLevel);
95cdf0e10cSrcweir     void ExportText(const SmNode *pNode, int nLevel);
96cdf0e10cSrcweir     void ExportMath(const SmNode *pNode, int nLevel);
97cdf0e10cSrcweir     void ExportPolygon(const SmNode *pNode, int nLevel);
98cdf0e10cSrcweir     void ExportBinaryHorizontal(const SmNode *pNode, int nLevel);
99cdf0e10cSrcweir     void ExportUnaryHorizontal(const SmNode *pNode, int nLevel);
100cdf0e10cSrcweir     void ExportBrace(const SmNode *pNode, int nLevel);
101cdf0e10cSrcweir     void ExportBinaryVertical(const SmNode *pNode, int nLevel);
102cdf0e10cSrcweir     void ExportSubSupScript(const SmNode *pNode, int nLevel);
103cdf0e10cSrcweir     void ExportRoot(const SmNode *pNode, int nLevel);
104cdf0e10cSrcweir     void ExportOperator(const SmNode *pNode, int nLevel);
105cdf0e10cSrcweir     void ExportAttributes(const SmNode *pNode, int nLevel);
106cdf0e10cSrcweir     void ExportFont(const SmNode *pNode, int nLevel);
107cdf0e10cSrcweir     void ExportVerticalBrace(const SmNode *pNode, int nLevel);
108cdf0e10cSrcweir     void ExportMatrix(const SmNode *pNode, int nLevel);
109cdf0e10cSrcweir     void ExportBlank(const SmNode *pNode, int nLevel);
110cdf0e10cSrcweir 
111cdf0e10cSrcweir public:
112cdf0e10cSrcweir     // #110680#
113cdf0e10cSrcweir     SmXMLExport(
114cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
115cdf0e10cSrcweir         sal_uInt16 nExportFlags=EXPORT_ALL);
~SmXMLExport()116cdf0e10cSrcweir     virtual ~SmXMLExport() {};
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     // XServiceInfo (override parent method)
119cdf0e10cSrcweir     ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     // XUnoTunnel
122cdf0e10cSrcweir     sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException);
123cdf0e10cSrcweir     static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
124cdf0e10cSrcweir 
_ExportAutoStyles()125cdf0e10cSrcweir     void _ExportAutoStyles() {}
_ExportMasterStyles()126cdf0e10cSrcweir     void _ExportMasterStyles() {}
127cdf0e10cSrcweir     void _ExportContent();
128cdf0e10cSrcweir     sal_uInt32 exportDoc(enum ::xmloff::token::XMLTokenEnum eClass);
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
131cdf0e10cSrcweir     virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
132cdf0e10cSrcweir 
GetSuccess()133cdf0e10cSrcweir     sal_Bool GetSuccess() {return bSuccess;}
134cdf0e10cSrcweir };
135cdf0e10cSrcweir 
136cdf0e10cSrcweir ////////////////////////////////////////////////////////////
137cdf0e10cSrcweir 
138cdf0e10cSrcweir #endif
139cdf0e10cSrcweir 
140