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