merged tag ooo/DEV300_m102
[LibreOffice.git] / starmath / source / mathmlimport.hxx
blobfb397e87f736ea8b5b05088b45fcff0c33cf8ccd
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #ifndef _MATHMLIMPORT_HXX_
29 #define _MATHMLIMPORT_HXX_
31 #include <xmloff/xmlimp.hxx>
32 #include <xmloff/xmlexp.hxx>
33 #include <xmloff/DocumentSettingsContext.hxx>
34 #include <xmloff/xmltoken.hxx>
36 #include <node.hxx>
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 } } }
47 ////////////////////////////////////////////////////////////
49 class SmXMLImportWrapper
51 com::sun::star::uno::Reference<com::sun::star::frame::XModel> xModel;
53 public:
54 SmXMLImportWrapper(com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rRef)
55 : xModel(rRef) {}
57 sal_uLong Import(SfxMedium &rMedium);
59 sal_uLong ReadThroughComponent(
60 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream,
61 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModelComponent,
62 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
63 ::com::sun::star::uno::Reference<
64 ::com::sun::star::beans::XPropertySet > & rPropSet,
65 const sal_Char* pFilterName,
66 sal_Bool bEncrypted );
68 sal_uLong ReadThroughComponent(
69 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
70 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModelComponent,
71 const sal_Char* pStreamName,
72 const sal_Char* pCompatibilityStreamName,
73 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
74 ::com::sun::star::uno::Reference<
75 ::com::sun::star::beans::XPropertySet > & rPropSet,
76 const sal_Char* pFilterName );
79 ////////////////////////////////////////////////////////////
81 class SmXMLImport : public SvXMLImport
83 SvXMLTokenMap *pPresLayoutElemTokenMap;
84 SvXMLTokenMap *pPresLayoutAttrTokenMap;
85 SvXMLTokenMap *pFencedAttrTokenMap;
86 SvXMLTokenMap *pOperatorAttrTokenMap;
87 SvXMLTokenMap *pAnnotationAttrTokenMap;
88 SvXMLTokenMap *pPresElemTokenMap;
89 SvXMLTokenMap *pPresScriptEmptyElemTokenMap;
90 SvXMLTokenMap *pPresTableElemTokenMap;
91 SvXMLTokenMap *pColorTokenMap;
93 SmNodeStack aNodeStack;
94 sal_Bool bSuccess;
95 String aText;
97 public:
98 // #110680#
99 SmXMLImport(
100 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
101 sal_uInt16 nImportFlags=IMPORT_ALL);
102 virtual ~SmXMLImport() throw ();
104 // XServiceInfo (override parent method)
105 ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
107 // XUnoTunnel
108 sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException);
109 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
111 void SAL_CALL endDocument(void)
112 throw( ::com::sun::star::xml::sax::SAXException,
113 ::com::sun::star::uno::RuntimeException );
115 SvXMLImportContext *CreateContext(sal_uInt16 nPrefix,
116 const rtl::OUString &rLocalName,
117 const com::sun::star::uno::Reference <
118 com::sun::star::xml::sax::XAttributeList> &xAttrList);
119 SvXMLImportContext *CreateMathContext(sal_uInt16 nPrefix,
120 const rtl::OUString &rLocalName,
121 const com::sun::star::uno::Reference <
122 com::sun::star::xml::sax::XAttributeList> &xAttrList);
123 SvXMLImportContext *CreateRowContext(sal_uInt16 nPrefix,
124 const rtl::OUString &rLocalName,
125 const com::sun::star::uno::Reference <
126 com::sun::star::xml::sax::XAttributeList> &xAttrList);
127 SvXMLImportContext *CreateFracContext(sal_uInt16 nPrefix,
128 const rtl::OUString &rLocalName,
129 const com::sun::star::uno::Reference <
130 com::sun::star::xml::sax::XAttributeList> &xAttrList);
131 SvXMLImportContext *CreateNumberContext(sal_uInt16 nPrefix,
132 const rtl::OUString &rLocalName,
133 const com::sun::star::uno::Reference <
134 com::sun::star::xml::sax::XAttributeList> &xAttrList);
135 SvXMLImportContext *CreateTextContext(sal_uInt16 nPrefix,
136 const rtl::OUString &rLocalName,
137 const com::sun::star::uno::Reference <
138 com::sun::star::xml::sax::XAttributeList> &xAttrList);
139 SvXMLImportContext *CreateAnnotationContext(sal_uInt16 nPrefix,
140 const rtl::OUString &rLocalName,
141 const com::sun::star::uno::Reference <
142 com::sun::star::xml::sax::XAttributeList> &xAttrList);
143 SvXMLImportContext *CreateStringContext(sal_uInt16 nPrefix,
144 const rtl::OUString &rLocalName,
145 const com::sun::star::uno::Reference <
146 com::sun::star::xml::sax::XAttributeList> &xAttrList);
147 SvXMLImportContext *CreateIdentifierContext(sal_uInt16 nPrefix,
148 const rtl::OUString &rLocalName,
149 const com::sun::star::uno::Reference <
150 com::sun::star::xml::sax::XAttributeList> &xAttrList);
151 SvXMLImportContext *CreateOperatorContext(sal_uInt16 nPrefix,
152 const rtl::OUString &rLocalName,
153 const com::sun::star::uno::Reference <
154 com::sun::star::xml::sax::XAttributeList> &xAttrList);
155 SvXMLImportContext *CreateSpaceContext(sal_uInt16 nPrefix,
156 const rtl::OUString &rLocalName,
157 const com::sun::star::uno::Reference <
158 com::sun::star::xml::sax::XAttributeList> &xAttrList);
159 SvXMLImportContext *CreateSqrtContext(sal_uInt16 nPrefix,
160 const rtl::OUString &rLocalName,
161 const com::sun::star::uno::Reference <
162 com::sun::star::xml::sax::XAttributeList> &xAttrList);
163 SvXMLImportContext *CreateRootContext(sal_uInt16 nPrefix,
164 const rtl::OUString &rLocalName,
165 const com::sun::star::uno::Reference <
166 com::sun::star::xml::sax::XAttributeList> &xAttrList);
167 SvXMLImportContext *CreateStyleContext(sal_uInt16 nPrefix,
168 const rtl::OUString &rLocalName,
169 const com::sun::star::uno::Reference <
170 com::sun::star::xml::sax::XAttributeList> &xAttrList);
171 SvXMLImportContext *CreatePaddedContext(sal_uInt16 nPrefix,
172 const rtl::OUString &rLocalName,
173 const com::sun::star::uno::Reference <
174 com::sun::star::xml::sax::XAttributeList> &xAttrList);
175 SvXMLImportContext *CreatePhantomContext(sal_uInt16 nPrefix,
176 const rtl::OUString &rLocalName,
177 const com::sun::star::uno::Reference <
178 com::sun::star::xml::sax::XAttributeList> &xAttrList);
179 SvXMLImportContext *CreateFencedContext(sal_uInt16 nPrefix,
180 const rtl::OUString &rLocalName,
181 const com::sun::star::uno::Reference <
182 com::sun::star::xml::sax::XAttributeList> &xAttrList);
183 SvXMLImportContext *CreateErrorContext(sal_uInt16 nPrefix,
184 const rtl::OUString &rLocalName,
185 const com::sun::star::uno::Reference <
186 com::sun::star::xml::sax::XAttributeList> &xAttrList);
187 SvXMLImportContext *CreateSubContext(sal_uInt16 nPrefix,
188 const rtl::OUString &rLocalName,
189 const com::sun::star::uno::Reference <
190 com::sun::star::xml::sax::XAttributeList> &xAttrList);
191 SvXMLImportContext *CreateSupContext(sal_uInt16 nPrefix,
192 const rtl::OUString &rLocalName,
193 const com::sun::star::uno::Reference <
194 com::sun::star::xml::sax::XAttributeList> &xAttrList);
195 SvXMLImportContext *CreateSubSupContext(sal_uInt16 nPrefix,
196 const rtl::OUString &rLocalName,
197 const com::sun::star::uno::Reference <
198 com::sun::star::xml::sax::XAttributeList> &xAttrList);
199 SvXMLImportContext *CreateUnderContext(sal_uInt16 nPrefix,
200 const rtl::OUString &rLocalName,
201 const com::sun::star::uno::Reference <
202 com::sun::star::xml::sax::XAttributeList> &xAttrList);
203 SvXMLImportContext *CreateOverContext(sal_uInt16 nPrefix,
204 const rtl::OUString &rLocalName,
205 const com::sun::star::uno::Reference <
206 com::sun::star::xml::sax::XAttributeList> &xAttrList);
207 SvXMLImportContext *CreateUnderOverContext(sal_uInt16 nPrefix,
208 const rtl::OUString &rLocalName,
209 const com::sun::star::uno::Reference <
210 com::sun::star::xml::sax::XAttributeList> &xAttrList);
211 SvXMLImportContext *CreateMultiScriptsContext(sal_uInt16 nPrefix,
212 const rtl::OUString &rLocalName,
213 const com::sun::star::uno::Reference <
214 com::sun::star::xml::sax::XAttributeList> &xAttrList);
215 SvXMLImportContext *CreateNoneContext(sal_uInt16 nPrefix,
216 const rtl::OUString &rLocalName,
217 const com::sun::star::uno::Reference <
218 com::sun::star::xml::sax::XAttributeList> &xAttrList);
219 SvXMLImportContext *CreatePrescriptsContext(sal_uInt16 nPrefix,
220 const rtl::OUString &rLocalName,
221 const com::sun::star::uno::Reference <
222 com::sun::star::xml::sax::XAttributeList> &xAttrList);
223 SvXMLImportContext *CreateTableContext(sal_uInt16 nPrefix,
224 const rtl::OUString &rLocalName,
225 const com::sun::star::uno::Reference <
226 com::sun::star::xml::sax::XAttributeList> &xAttrList);
227 SvXMLImportContext *CreateTableRowContext(sal_uInt16 nPrefix,
228 const rtl::OUString &rLocalName,
229 const com::sun::star::uno::Reference <
230 com::sun::star::xml::sax::XAttributeList> &xAttrList);
231 SvXMLImportContext *CreateTableCellContext(sal_uInt16 nPrefix,
232 const rtl::OUString &rLocalName,
233 const com::sun::star::uno::Reference <
234 com::sun::star::xml::sax::XAttributeList> &xAttrList);
235 SvXMLImportContext *CreateAlignGroupContext(sal_uInt16 nPrefix,
236 const rtl::OUString &rLocalName,
237 const com::sun::star::uno::Reference <
238 com::sun::star::xml::sax::XAttributeList> &xAttrList);
239 SvXMLImportContext *CreateActionContext(sal_uInt16 nPrefix,
240 const rtl::OUString &rLocalName,
241 const com::sun::star::uno::Reference <
242 com::sun::star::xml::sax::XAttributeList> &xAttrList);
244 const SvXMLTokenMap &GetPresLayoutElemTokenMap();
245 const SvXMLTokenMap &GetPresLayoutAttrTokenMap();
246 const SvXMLTokenMap &GetFencedAttrTokenMap();
247 const SvXMLTokenMap &GetOperatorAttrTokenMap();
248 const SvXMLTokenMap &GetAnnotationAttrTokenMap();
249 const SvXMLTokenMap &GetPresElemTokenMap();
250 const SvXMLTokenMap &GetPresScriptEmptyElemTokenMap();
251 const SvXMLTokenMap &GetPresTableElemTokenMap();
252 const SvXMLTokenMap &GetColorTokenMap();
254 SmNodeStack & GetNodeStack() { return aNodeStack; }
255 SmNode *GetTree() { return aNodeStack.Pop(); }
256 sal_Bool GetSuccess() { return bSuccess; }
257 String &GetText() { return aText; }
259 virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
260 virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
263 ////////////////////////////////////////////////////////////
265 enum SmXMLMathElemTokenMap
267 XML_TOK_MATH
270 enum SmXMLPresLayoutElemTokenMap
272 XML_TOK_SEMANTICS,
273 XML_TOK_MSTYLE,
274 XML_TOK_MERROR,
275 XML_TOK_MPHANTOM,
276 XML_TOK_MROW,
277 XML_TOK_MFRAC,
278 XML_TOK_MSQRT,
279 XML_TOK_MROOT,
280 XML_TOK_MSUB,
281 XML_TOK_MSUP,
282 XML_TOK_MSUBSUP,
283 XML_TOK_MMULTISCRIPTS,
284 XML_TOK_MUNDER,
285 XML_TOK_MOVER,
286 XML_TOK_MUNDEROVER,
287 XML_TOK_MTABLE,
288 XML_TOK_MACTION,
289 XML_TOK_MFENCED,
290 XML_TOK_MPADDED
293 enum SmXMLPresLayoutAttrTokenMap
295 XML_TOK_FONTWEIGHT,
296 XML_TOK_FONTSTYLE,
297 XML_TOK_FONTSIZE,
298 XML_TOK_FONTFAMILY,
299 XML_TOK_COLOR
303 enum SmXMLFencedAttrTokenMap
305 XML_TOK_OPEN,
306 XML_TOK_CLOSE
310 enum SmXMLPresTableElemTokenMap
312 XML_TOK_MTR,
313 XML_TOK_MTD
316 enum SmXMLPresElemTokenMap
318 XML_TOK_ANNOTATION,
319 XML_TOK_MI,
320 XML_TOK_MN,
321 XML_TOK_MO,
322 XML_TOK_MTEXT,
323 XML_TOK_MSPACE,
324 XML_TOK_MS,
325 XML_TOK_MALIGNGROUP
328 enum SmXMLPresScriptEmptyElemTokenMap
330 XML_TOK_MPRESCRIPTS,
331 XML_TOK_NONE
334 enum SmXMLOperatorAttrTokenMap
336 XML_TOK_STRETCHY
339 enum SmXMLAnnotationAttrTokenMap
341 XML_TOK_ENCODING
344 ////////////////////////////////////////////////////////////
346 #endif