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