Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLFACTORY_HXX
21 : #define INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLFACTORY_HXX
22 :
23 : #include <memory>
24 :
25 : #include <dmapper/resourcemodel.hxx>
26 :
27 : #include <oox/token/tokens.hxx>
28 :
29 : #include "OOXMLFastContextHandler.hxx"
30 : #include <boost/intrusive_ptr.hpp>
31 :
32 : namespace writerfilter {
33 : namespace ooxml {
34 :
35 : enum ResourceType_t {
36 : RT_NoResource,
37 : RT_Table,
38 : RT_Stream,
39 : RT_StreamProperties,
40 : RT_List,
41 : RT_Integer,
42 : RT_Properties,
43 : RT_Hex,
44 : RT_String,
45 : RT_Shape,
46 : RT_Boolean,
47 : RT_HexValue,
48 : RT_Value,
49 : RT_XNote,
50 : RT_TextTableCell,
51 : RT_TextTableRow,
52 : RT_TextTable,
53 : RT_PropertyTable,
54 : RT_Math,
55 : RT_Any,
56 : RT_UniversalMeasure
57 : };
58 :
59 : struct AttributeInfo
60 : {
61 : Token_t m_nToken;
62 : ResourceType_t m_nResource;
63 : Id m_nRef;
64 : };
65 :
66 513 : class OOXMLFactory_ns {
67 : public:
68 : typedef std::shared_ptr<OOXMLFactory_ns> Pointer_t;
69 :
70 : virtual void startAction(OOXMLFastContextHandler * pHandler);
71 : virtual void charactersAction(OOXMLFastContextHandler * pHandler, const OUString & rString);
72 : virtual void endAction(OOXMLFastContextHandler * pHandler);
73 : virtual void attributeAction(OOXMLFastContextHandler * pHandler, Token_t nToken, OOXMLValue::Pointer_t pValue);
74 :
75 : protected:
76 : virtual ~OOXMLFactory_ns();
77 :
78 : public:
79 : virtual bool getListValue(Id nId, const OUString& rValue, sal_uInt32& rOutValue) = 0;
80 : virtual Id getResourceId(Id nDefine, sal_Int32 nToken) = 0;
81 : virtual const AttributeInfo* getAttributeInfoArray(Id nId) = 0;
82 : virtual bool getElementId(Id nDefine, Id nId, ResourceType_t& rOutResource, Id& rOutElement) = 0;
83 : };
84 :
85 : class OOXMLFactory
86 : {
87 : public:
88 :
89 : static css::uno::Reference< css::xml::sax::XFastContextHandler> createFastChildContext(OOXMLFastContextHandler * pHandler, Token_t Element);
90 :
91 : static css::uno::Reference< css::xml::sax::XFastContextHandler> createFastChildContextFromStart(OOXMLFastContextHandler * pHandler, Token_t Element);
92 :
93 : static void attributes(OOXMLFastContextHandler * pHandler, const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs);
94 :
95 : static void characters(OOXMLFastContextHandler * pHandler, const OUString & rString);
96 :
97 : static void startAction(OOXMLFastContextHandler * pHandler, Token_t nToken);
98 : static void endAction(OOXMLFastContextHandler * pHandler, Token_t nToken);
99 :
100 : private:
101 : OOXMLFactory() {}
102 : static OOXMLFactory_ns::Pointer_t getFactoryForNamespace(Id id);
103 :
104 : static css::uno::Reference< css::xml::sax::XFastContextHandler> createFastChildContextFromFactory(OOXMLFastContextHandler * pHandler, OOXMLFactory_ns::Pointer_t pFactory, Token_t Element);
105 : };
106 :
107 : }
108 : }
109 :
110 : #endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLFACTORY_HXX
111 :
112 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|