merge the formfield patch from ooo-build
[ooovba.git] / starmath / source / mathmlimport.hxx
blobed46efa823fc36f7bd95a841b4c2380f5828edff
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: x $
10 * $Revision: 1.00 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _MATHMLIMPORT_HXX_
32 #define _MATHMLIMPORT_HXX_
34 #include <xmloff/xmlimp.hxx>
35 #include <xmloff/xmlexp.hxx>
36 #include <xmloff/DocumentSettingsContext.hxx>
37 #include <xmloff/xmltoken.hxx>
39 #include <node.hxx>
41 class SfxMedium;
42 namespace com { namespace sun { namespace star {
43 namespace io {
44 class XInputStream;
45 class XOutputStream; }
46 namespace beans {
47 class XPropertySet; }
48 } } }
50 ////////////////////////////////////////////////////////////
52 class SmXMLImportWrapper
54 com::sun::star::uno::Reference<com::sun::star::frame::XModel> xModel;
56 public:
57 SmXMLImportWrapper(com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rRef)
58 : xModel(rRef) {}
60 ULONG Import(SfxMedium &rMedium);
62 ULONG ReadThroughComponent(
63 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream,
64 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModelComponent,
65 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
66 ::com::sun::star::uno::Reference<
67 ::com::sun::star::beans::XPropertySet > & rPropSet,
68 const sal_Char* pFilterName,
69 sal_Bool bEncrypted );
71 ULONG ReadThroughComponent(
72 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
73 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModelComponent,
74 const sal_Char* pStreamName,
75 const sal_Char* pCompatibilityStreamName,
76 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
77 ::com::sun::star::uno::Reference<
78 ::com::sun::star::beans::XPropertySet > & rPropSet,
79 const sal_Char* pFilterName );
82 ////////////////////////////////////////////////////////////
84 class SmXMLImport : public SvXMLImport
86 SvXMLTokenMap *pPresLayoutElemTokenMap;
87 SvXMLTokenMap *pPresLayoutAttrTokenMap;
88 SvXMLTokenMap *pFencedAttrTokenMap;
89 SvXMLTokenMap *pOperatorAttrTokenMap;
90 SvXMLTokenMap *pAnnotationAttrTokenMap;
91 SvXMLTokenMap *pPresElemTokenMap;
92 SvXMLTokenMap *pPresScriptEmptyElemTokenMap;
93 SvXMLTokenMap *pPresTableElemTokenMap;
94 SvXMLTokenMap *pColorTokenMap;
96 SmNodeStack aNodeStack;
97 sal_Bool bSuccess;
98 String aText;
100 public:
101 // #110680#
102 SmXMLImport(
103 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
104 sal_uInt16 nImportFlags=IMPORT_ALL);
105 virtual ~SmXMLImport() throw ();
107 // XServiceInfo (override parent method)
108 ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
110 // XUnoTunnel
111 sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException);
112 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
114 void SAL_CALL endDocument(void)
115 throw( ::com::sun::star::xml::sax::SAXException,
116 ::com::sun::star::uno::RuntimeException );
118 SvXMLImportContext *CreateContext(sal_uInt16 nPrefix,
119 const rtl::OUString &rLocalName,
120 const com::sun::star::uno::Reference <
121 com::sun::star::xml::sax::XAttributeList> &xAttrList);
122 SvXMLImportContext *CreateMathContext(sal_uInt16 nPrefix,
123 const rtl::OUString &rLocalName,
124 const com::sun::star::uno::Reference <
125 com::sun::star::xml::sax::XAttributeList> &xAttrList);
126 SvXMLImportContext *CreateRowContext(sal_uInt16 nPrefix,
127 const rtl::OUString &rLocalName,
128 const com::sun::star::uno::Reference <
129 com::sun::star::xml::sax::XAttributeList> &xAttrList);
130 SvXMLImportContext *CreateFracContext(sal_uInt16 nPrefix,
131 const rtl::OUString &rLocalName,
132 const com::sun::star::uno::Reference <
133 com::sun::star::xml::sax::XAttributeList> &xAttrList);
134 SvXMLImportContext *CreateNumberContext(sal_uInt16 nPrefix,
135 const rtl::OUString &rLocalName,
136 const com::sun::star::uno::Reference <
137 com::sun::star::xml::sax::XAttributeList> &xAttrList);
138 SvXMLImportContext *CreateTextContext(sal_uInt16 nPrefix,
139 const rtl::OUString &rLocalName,
140 const com::sun::star::uno::Reference <
141 com::sun::star::xml::sax::XAttributeList> &xAttrList);
142 SvXMLImportContext *CreateAnnotationContext(sal_uInt16 nPrefix,
143 const rtl::OUString &rLocalName,
144 const com::sun::star::uno::Reference <
145 com::sun::star::xml::sax::XAttributeList> &xAttrList);
146 SvXMLImportContext *CreateStringContext(sal_uInt16 nPrefix,
147 const rtl::OUString &rLocalName,
148 const com::sun::star::uno::Reference <
149 com::sun::star::xml::sax::XAttributeList> &xAttrList);
150 SvXMLImportContext *CreateIdentifierContext(sal_uInt16 nPrefix,
151 const rtl::OUString &rLocalName,
152 const com::sun::star::uno::Reference <
153 com::sun::star::xml::sax::XAttributeList> &xAttrList);
154 SvXMLImportContext *CreateOperatorContext(sal_uInt16 nPrefix,
155 const rtl::OUString &rLocalName,
156 const com::sun::star::uno::Reference <
157 com::sun::star::xml::sax::XAttributeList> &xAttrList);
158 SvXMLImportContext *CreateSpaceContext(sal_uInt16 nPrefix,
159 const rtl::OUString &rLocalName,
160 const com::sun::star::uno::Reference <
161 com::sun::star::xml::sax::XAttributeList> &xAttrList);
162 SvXMLImportContext *CreateSqrtContext(sal_uInt16 nPrefix,
163 const rtl::OUString &rLocalName,
164 const com::sun::star::uno::Reference <
165 com::sun::star::xml::sax::XAttributeList> &xAttrList);
166 SvXMLImportContext *CreateRootContext(sal_uInt16 nPrefix,
167 const rtl::OUString &rLocalName,
168 const com::sun::star::uno::Reference <
169 com::sun::star::xml::sax::XAttributeList> &xAttrList);
170 SvXMLImportContext *CreateStyleContext(sal_uInt16 nPrefix,
171 const rtl::OUString &rLocalName,
172 const com::sun::star::uno::Reference <
173 com::sun::star::xml::sax::XAttributeList> &xAttrList);
174 SvXMLImportContext *CreatePaddedContext(sal_uInt16 nPrefix,
175 const rtl::OUString &rLocalName,
176 const com::sun::star::uno::Reference <
177 com::sun::star::xml::sax::XAttributeList> &xAttrList);
178 SvXMLImportContext *CreatePhantomContext(sal_uInt16 nPrefix,
179 const rtl::OUString &rLocalName,
180 const com::sun::star::uno::Reference <
181 com::sun::star::xml::sax::XAttributeList> &xAttrList);
182 SvXMLImportContext *CreateFencedContext(sal_uInt16 nPrefix,
183 const rtl::OUString &rLocalName,
184 const com::sun::star::uno::Reference <
185 com::sun::star::xml::sax::XAttributeList> &xAttrList);
186 SvXMLImportContext *CreateErrorContext(sal_uInt16 nPrefix,
187 const rtl::OUString &rLocalName,
188 const com::sun::star::uno::Reference <
189 com::sun::star::xml::sax::XAttributeList> &xAttrList);
190 SvXMLImportContext *CreateSubContext(sal_uInt16 nPrefix,
191 const rtl::OUString &rLocalName,
192 const com::sun::star::uno::Reference <
193 com::sun::star::xml::sax::XAttributeList> &xAttrList);
194 SvXMLImportContext *CreateSupContext(sal_uInt16 nPrefix,
195 const rtl::OUString &rLocalName,
196 const com::sun::star::uno::Reference <
197 com::sun::star::xml::sax::XAttributeList> &xAttrList);
198 SvXMLImportContext *CreateSubSupContext(sal_uInt16 nPrefix,
199 const rtl::OUString &rLocalName,
200 const com::sun::star::uno::Reference <
201 com::sun::star::xml::sax::XAttributeList> &xAttrList);
202 SvXMLImportContext *CreateUnderContext(sal_uInt16 nPrefix,
203 const rtl::OUString &rLocalName,
204 const com::sun::star::uno::Reference <
205 com::sun::star::xml::sax::XAttributeList> &xAttrList);
206 SvXMLImportContext *CreateOverContext(sal_uInt16 nPrefix,
207 const rtl::OUString &rLocalName,
208 const com::sun::star::uno::Reference <
209 com::sun::star::xml::sax::XAttributeList> &xAttrList);
210 SvXMLImportContext *CreateUnderOverContext(sal_uInt16 nPrefix,
211 const rtl::OUString &rLocalName,
212 const com::sun::star::uno::Reference <
213 com::sun::star::xml::sax::XAttributeList> &xAttrList);
214 SvXMLImportContext *CreateMultiScriptsContext(sal_uInt16 nPrefix,
215 const rtl::OUString &rLocalName,
216 const com::sun::star::uno::Reference <
217 com::sun::star::xml::sax::XAttributeList> &xAttrList);
218 SvXMLImportContext *CreateNoneContext(sal_uInt16 nPrefix,
219 const rtl::OUString &rLocalName,
220 const com::sun::star::uno::Reference <
221 com::sun::star::xml::sax::XAttributeList> &xAttrList);
222 SvXMLImportContext *CreatePrescriptsContext(sal_uInt16 nPrefix,
223 const rtl::OUString &rLocalName,
224 const com::sun::star::uno::Reference <
225 com::sun::star::xml::sax::XAttributeList> &xAttrList);
226 SvXMLImportContext *CreateTableContext(sal_uInt16 nPrefix,
227 const rtl::OUString &rLocalName,
228 const com::sun::star::uno::Reference <
229 com::sun::star::xml::sax::XAttributeList> &xAttrList);
230 SvXMLImportContext *CreateTableRowContext(sal_uInt16 nPrefix,
231 const rtl::OUString &rLocalName,
232 const com::sun::star::uno::Reference <
233 com::sun::star::xml::sax::XAttributeList> &xAttrList);
234 SvXMLImportContext *CreateTableCellContext(sal_uInt16 nPrefix,
235 const rtl::OUString &rLocalName,
236 const com::sun::star::uno::Reference <
237 com::sun::star::xml::sax::XAttributeList> &xAttrList);
238 SvXMLImportContext *CreateAlignGroupContext(sal_uInt16 nPrefix,
239 const rtl::OUString &rLocalName,
240 const com::sun::star::uno::Reference <
241 com::sun::star::xml::sax::XAttributeList> &xAttrList);
242 SvXMLImportContext *CreateActionContext(sal_uInt16 nPrefix,
243 const rtl::OUString &rLocalName,
244 const com::sun::star::uno::Reference <
245 com::sun::star::xml::sax::XAttributeList> &xAttrList);
247 const SvXMLTokenMap &GetPresLayoutElemTokenMap();
248 const SvXMLTokenMap &GetPresLayoutAttrTokenMap();
249 const SvXMLTokenMap &GetFencedAttrTokenMap();
250 const SvXMLTokenMap &GetOperatorAttrTokenMap();
251 const SvXMLTokenMap &GetAnnotationAttrTokenMap();
252 const SvXMLTokenMap &GetPresElemTokenMap();
253 const SvXMLTokenMap &GetPresScriptEmptyElemTokenMap();
254 const SvXMLTokenMap &GetPresTableElemTokenMap();
255 const SvXMLTokenMap &GetColorTokenMap();
257 SmNodeStack & GetNodeStack() {return aNodeStack;}
258 SmNode *GetTree() { return aNodeStack.Pop();}
259 sal_Bool GetSuccess() { return bSuccess; }
260 String &GetText() { return aText;}
262 virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
263 virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
266 ////////////////////////////////////////////////////////////
268 enum SmXMLMathElemTokenMap
270 XML_TOK_MATH
273 enum SmXMLPresLayoutElemTokenMap
275 XML_TOK_SEMANTICS,
276 XML_TOK_MSTYLE,
277 XML_TOK_MERROR,
278 XML_TOK_MPHANTOM,
279 XML_TOK_MROW,
280 XML_TOK_MFRAC,
281 XML_TOK_MSQRT,
282 XML_TOK_MROOT,
283 XML_TOK_MSUB,
284 XML_TOK_MSUP,
285 XML_TOK_MSUBSUP,
286 XML_TOK_MMULTISCRIPTS,
287 XML_TOK_MUNDER,
288 XML_TOK_MOVER,
289 XML_TOK_MUNDEROVER,
290 XML_TOK_MTABLE,
291 XML_TOK_MACTION,
292 XML_TOK_MFENCED,
293 XML_TOK_MPADDED
296 enum SmXMLPresLayoutAttrTokenMap
298 XML_TOK_FONTWEIGHT,
299 XML_TOK_FONTSTYLE,
300 XML_TOK_FONTSIZE,
301 XML_TOK_FONTFAMILY,
302 XML_TOK_COLOR
306 enum SmXMLFencedAttrTokenMap
308 XML_TOK_OPEN,
309 XML_TOK_CLOSE
313 enum SmXMLPresTableElemTokenMap
315 XML_TOK_MTR,
316 XML_TOK_MTD
319 enum SmXMLPresElemTokenMap
321 XML_TOK_ANNOTATION,
322 XML_TOK_MI,
323 XML_TOK_MN,
324 XML_TOK_MO,
325 XML_TOK_MTEXT,
326 XML_TOK_MSPACE,
327 XML_TOK_MS,
328 XML_TOK_MALIGNGROUP
331 enum SmXMLPresScriptEmptyElemTokenMap
333 XML_TOK_MPRESCRIPTS,
334 XML_TOK_NONE
337 enum SmXMLOperatorAttrTokenMap
339 XML_TOK_STRETCHY
342 enum SmXMLAnnotationAttrTokenMap
344 XML_TOK_ENCODING
347 ////////////////////////////////////////////////////////////
349 #endif