1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_STARMATH_SOURCE_MATHMLIMPORT_HXX
21 #define INCLUDED_STARMATH_SOURCE_MATHMLIMPORT_HXX
23 #include <xmloff/xmlimp.hxx>
24 #include <xmloff/xmlexp.hxx>
25 #include <xmloff/DocumentSettingsContext.hxx>
26 #include <xmloff/xmltoken.hxx>
32 namespace com
{ namespace sun
{ namespace star
{
34 class XIutputStream
; }
41 class SmXMLImportWrapper
43 com::sun::star::uno::Reference
<com::sun::star::frame::XModel
> xModel
;
46 explicit SmXMLImportWrapper(com::sun::star::uno::Reference
<com::sun::star::frame::XModel
> &rRef
)
49 sal_uLong
Import(SfxMedium
&rMedium
);
51 static sal_uLong
ReadThroughComponent(
52 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> xInputStream
,
53 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> xModelComponent
,
54 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> & rxContext
,
55 ::com::sun::star::uno::Reference
<
56 ::com::sun::star::beans::XPropertySet
> & rPropSet
,
57 const sal_Char
* pFilterName
,
60 static sal_uLong
ReadThroughComponent(
61 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
,
62 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> xModelComponent
,
63 const sal_Char
* pStreamName
,
64 const sal_Char
* pCompatibilityStreamName
,
65 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> & rxContext
,
66 ::com::sun::star::uno::Reference
<
67 ::com::sun::star::beans::XPropertySet
> & rPropSet
,
68 const sal_Char
* pFilterName
);
73 class SmXMLImport
: public SvXMLImport
75 std::unique_ptr
<SvXMLTokenMap
> pPresLayoutElemTokenMap
;
76 std::unique_ptr
<SvXMLTokenMap
> pPresLayoutAttrTokenMap
;
77 std::unique_ptr
<SvXMLTokenMap
> pFencedAttrTokenMap
;
78 std::unique_ptr
<SvXMLTokenMap
> pOperatorAttrTokenMap
;
79 std::unique_ptr
<SvXMLTokenMap
> pAnnotationAttrTokenMap
;
80 std::unique_ptr
<SvXMLTokenMap
> pPresElemTokenMap
;
81 std::unique_ptr
<SvXMLTokenMap
> pPresScriptEmptyElemTokenMap
;
82 std::unique_ptr
<SvXMLTokenMap
> pPresTableElemTokenMap
;
83 std::unique_ptr
<SvXMLTokenMap
> pColorTokenMap
;
84 std::unique_ptr
<SvXMLTokenMap
> pActionAttrTokenMap
;
86 SmNodeStack aNodeStack
;
92 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rContext
,
93 OUString
const & implementationName
, SvXMLImportFlags nImportFlags
);
94 virtual ~SmXMLImport() throw ();
97 sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rId
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
98 static const ::com::sun::star::uno::Sequence
< sal_Int8
> & getUnoTunnelId() throw();
100 void SAL_CALL
endDocument()
101 throw( ::com::sun::star::xml::sax::SAXException
,
102 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
104 SvXMLImportContext
*CreateContext(sal_uInt16 nPrefix
,
105 const OUString
&rLocalName
,
106 const com::sun::star::uno::Reference
<
107 com::sun::star::xml::sax::XAttributeList
> &xAttrList
) SAL_OVERRIDE
;
108 SvXMLImportContext
*CreateMathContext(sal_uInt16 nPrefix
,
109 const OUString
&rLocalName
,
110 const com::sun::star::uno::Reference
<
111 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
112 SvXMLImportContext
*CreateRowContext(sal_uInt16 nPrefix
,
113 const OUString
&rLocalName
,
114 const com::sun::star::uno::Reference
<
115 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
116 SvXMLImportContext
*CreateEncloseContext(sal_uInt16 nPrefix
,
117 const OUString
&rLocalName
,
118 const com::sun::star::uno::Reference
<
119 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
120 SvXMLImportContext
*CreateFracContext(sal_uInt16 nPrefix
,
121 const OUString
&rLocalName
,
122 const com::sun::star::uno::Reference
<
123 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
124 SvXMLImportContext
*CreateNumberContext(sal_uInt16 nPrefix
,
125 const OUString
&rLocalName
,
126 const com::sun::star::uno::Reference
<
127 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
128 SvXMLImportContext
*CreateTextContext(sal_uInt16 nPrefix
,
129 const OUString
&rLocalName
,
130 const com::sun::star::uno::Reference
<
131 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
132 SvXMLImportContext
*CreateAnnotationContext(sal_uInt16 nPrefix
,
133 const OUString
&rLocalName
,
134 const com::sun::star::uno::Reference
<
135 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
136 SvXMLImportContext
*CreateStringContext(sal_uInt16 nPrefix
,
137 const OUString
&rLocalName
,
138 const com::sun::star::uno::Reference
<
139 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
140 SvXMLImportContext
*CreateIdentifierContext(sal_uInt16 nPrefix
,
141 const OUString
&rLocalName
,
142 const com::sun::star::uno::Reference
<
143 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
144 SvXMLImportContext
*CreateOperatorContext(sal_uInt16 nPrefix
,
145 const OUString
&rLocalName
,
146 const com::sun::star::uno::Reference
<
147 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
148 SvXMLImportContext
*CreateSpaceContext(sal_uInt16 nPrefix
,
149 const OUString
&rLocalName
,
150 const com::sun::star::uno::Reference
<
151 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
152 SvXMLImportContext
*CreateSqrtContext(sal_uInt16 nPrefix
,
153 const OUString
&rLocalName
,
154 const com::sun::star::uno::Reference
<
155 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
156 SvXMLImportContext
*CreateRootContext(sal_uInt16 nPrefix
,
157 const OUString
&rLocalName
,
158 const com::sun::star::uno::Reference
<
159 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
160 SvXMLImportContext
*CreateStyleContext(sal_uInt16 nPrefix
,
161 const OUString
&rLocalName
,
162 const com::sun::star::uno::Reference
<
163 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
164 SvXMLImportContext
*CreatePaddedContext(sal_uInt16 nPrefix
,
165 const OUString
&rLocalName
,
166 const com::sun::star::uno::Reference
<
167 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
168 SvXMLImportContext
*CreatePhantomContext(sal_uInt16 nPrefix
,
169 const OUString
&rLocalName
,
170 const com::sun::star::uno::Reference
<
171 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
172 SvXMLImportContext
*CreateFencedContext(sal_uInt16 nPrefix
,
173 const OUString
&rLocalName
,
174 const com::sun::star::uno::Reference
<
175 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
176 SvXMLImportContext
*CreateErrorContext(sal_uInt16 nPrefix
,
177 const OUString
&rLocalName
,
178 const com::sun::star::uno::Reference
<
179 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
180 SvXMLImportContext
*CreateSubContext(sal_uInt16 nPrefix
,
181 const OUString
&rLocalName
,
182 const com::sun::star::uno::Reference
<
183 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
184 SvXMLImportContext
*CreateSupContext(sal_uInt16 nPrefix
,
185 const OUString
&rLocalName
,
186 const com::sun::star::uno::Reference
<
187 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
188 SvXMLImportContext
*CreateSubSupContext(sal_uInt16 nPrefix
,
189 const OUString
&rLocalName
,
190 const com::sun::star::uno::Reference
<
191 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
192 SvXMLImportContext
*CreateUnderContext(sal_uInt16 nPrefix
,
193 const OUString
&rLocalName
,
194 const com::sun::star::uno::Reference
<
195 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
196 SvXMLImportContext
*CreateOverContext(sal_uInt16 nPrefix
,
197 const OUString
&rLocalName
,
198 const com::sun::star::uno::Reference
<
199 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
200 SvXMLImportContext
*CreateUnderOverContext(sal_uInt16 nPrefix
,
201 const OUString
&rLocalName
,
202 const com::sun::star::uno::Reference
<
203 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
204 SvXMLImportContext
*CreateMultiScriptsContext(sal_uInt16 nPrefix
,
205 const OUString
&rLocalName
,
206 const com::sun::star::uno::Reference
<
207 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
208 SvXMLImportContext
*CreateNoneContext(sal_uInt16 nPrefix
,
209 const OUString
&rLocalName
,
210 const com::sun::star::uno::Reference
<
211 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
212 SvXMLImportContext
*CreatePrescriptsContext(sal_uInt16 nPrefix
,
213 const OUString
&rLocalName
,
214 const com::sun::star::uno::Reference
<
215 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
216 SvXMLImportContext
*CreateTableContext(sal_uInt16 nPrefix
,
217 const OUString
&rLocalName
,
218 const com::sun::star::uno::Reference
<
219 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
220 SvXMLImportContext
*CreateTableRowContext(sal_uInt16 nPrefix
,
221 const OUString
&rLocalName
,
222 const com::sun::star::uno::Reference
<
223 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
224 SvXMLImportContext
*CreateTableCellContext(sal_uInt16 nPrefix
,
225 const OUString
&rLocalName
,
226 const com::sun::star::uno::Reference
<
227 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
228 SvXMLImportContext
*CreateAlignGroupContext(sal_uInt16 nPrefix
,
229 const OUString
&rLocalName
,
230 const com::sun::star::uno::Reference
<
231 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
232 SvXMLImportContext
*CreateActionContext(sal_uInt16 nPrefix
,
233 const OUString
&rLocalName
,
234 const com::sun::star::uno::Reference
<
235 com::sun::star::xml::sax::XAttributeList
> &xAttrList
);
237 const SvXMLTokenMap
&GetPresLayoutElemTokenMap();
238 const SvXMLTokenMap
&GetPresLayoutAttrTokenMap();
239 const SvXMLTokenMap
&GetFencedAttrTokenMap();
240 const SvXMLTokenMap
&GetOperatorAttrTokenMap();
241 const SvXMLTokenMap
&GetAnnotationAttrTokenMap();
242 const SvXMLTokenMap
&GetPresElemTokenMap();
243 const SvXMLTokenMap
&GetPresScriptEmptyElemTokenMap();
244 const SvXMLTokenMap
&GetPresTableElemTokenMap();
245 const SvXMLTokenMap
&GetColorTokenMap();
246 const SvXMLTokenMap
&GetActionAttrTokenMap();
248 SmNodeStack
& GetNodeStack() { return aNodeStack
; }
251 return popOrZero(aNodeStack
);
254 bool GetSuccess() { return bSuccess
; }
255 SAL_WARN_UNUSED_RESULT OUString
GetText() { return aText
; }
256 void SetText(const OUString
&rStr
) { aText
= rStr
; }
258 virtual void SetViewSettings(const com::sun::star::uno::Sequence
<com::sun::star::beans::PropertyValue
>& aViewProps
) SAL_OVERRIDE
;
259 virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence
<com::sun::star::beans::PropertyValue
>& aViewProps
) SAL_OVERRIDE
;
264 enum SmXMLMathElemTokenMap
269 enum SmXMLPresLayoutElemTokenMap
283 XML_TOK_MMULTISCRIPTS
,
293 enum SmXMLPresLayoutAttrTokenMap
304 enum SmXMLFencedAttrTokenMap
311 enum SmXMLPresTableElemTokenMap
317 enum SmXMLPresElemTokenMap
329 enum SmXMLPresScriptEmptyElemTokenMap
335 enum SmXMLOperatorAttrTokenMap
340 enum SmXMLAnnotationAttrTokenMap
345 enum SmXMLActionAttrTokenMap
353 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */