Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / writerfilter / source / ooxml / OOXMLFactory.hxx
blob04a71bbc92f4bf784b9d4a666e4f1f5e62629fbd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_WRITERFILTER_SOURCE_OOXML_OOXMLFACTORY_HXX
21 #define INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLFACTORY_HXX
23 #include <memory>
25 #include <dmapper/resourcemodel.hxx>
27 #include <oox/token/tokens.hxx>
29 #include "OOXMLFastContextHandler.hxx"
30 #include <boost/intrusive_ptr.hpp>
32 namespace writerfilter {
33 namespace ooxml {
35 enum class ResourceType {
36 NoResource,
37 Table,
38 Stream,
39 List,
40 Integer,
41 Properties,
42 Hex,
43 HexColor,
44 String,
45 Shape,
46 Boolean,
47 Value,
48 XNote,
49 TextTableCell,
50 TextTableRow,
51 TextTable,
52 PropertyTable,
53 Math,
54 Any,
55 TwipsMeasure_asSigned,
56 TwipsMeasure_asZero,
57 HpsMeasure,
58 MeasurementOrPercent
61 struct AttributeInfo
63 Token_t const m_nToken;
64 ResourceType const m_nResource;
65 Id const m_nRef;
68 class OOXMLFactory_ns : public virtual SvRefBase {
69 public:
70 typedef tools::SvRef<OOXMLFactory_ns> Pointer_t;
72 virtual void startAction(OOXMLFastContextHandler * pHandler);
73 virtual void charactersAction(OOXMLFastContextHandler * pHandler, const OUString & rString);
74 virtual void endAction(OOXMLFastContextHandler * pHandler);
75 virtual void attributeAction(OOXMLFastContextHandler * pHandler, Token_t nToken, const OOXMLValue::Pointer_t& pValue);
77 protected:
78 virtual ~OOXMLFactory_ns() override;
80 public:
81 virtual bool getListValue(Id nId, const OUString& rValue, sal_uInt32& rOutValue) = 0;
82 virtual Id getResourceId(Id nDefine, sal_Int32 nToken) = 0;
83 virtual const AttributeInfo* getAttributeInfoArray(Id nId) = 0;
84 virtual bool getElementId(Id nDefine, Id nId, ResourceType& rOutResource, Id& rOutElement) = 0;
87 class OOXMLFactory
89 public:
91 static css::uno::Reference< css::xml::sax::XFastContextHandler> createFastChildContext(OOXMLFastContextHandler * pHandler, Token_t Element);
93 static css::uno::Reference< css::xml::sax::XFastContextHandler> createFastChildContextFromStart(OOXMLFastContextHandler * pHandler, Token_t Element);
95 static void attributes(OOXMLFastContextHandler * pHandler, const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs);
97 static void characters(OOXMLFastContextHandler * pHandler, const OUString & rString);
99 static void startAction(OOXMLFastContextHandler * pHandler);
100 static void endAction(OOXMLFastContextHandler * pHandler);
102 private:
103 OOXMLFactory() = delete;
104 static OOXMLFactory_ns::Pointer_t getFactoryForNamespace(Id id);
106 static css::uno::Reference< css::xml::sax::XFastContextHandler> createFastChildContextFromFactory(OOXMLFastContextHandler * pHandler, OOXMLFactory_ns::Pointer_t pFactory, Token_t Element);
112 #endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLFACTORY_HXX
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */