/src/libreoffice/xmloff/source/text/XMLIndexObjectSourceContext.cxx
Line | Count | Source (jump to first uncovered line) |
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 | | |
21 | | #include "XMLIndexObjectSourceContext.hxx" |
22 | | |
23 | | #include <com/sun/star/beans/XPropertySet.hpp> |
24 | | |
25 | | #include <sax/tools/converter.hxx> |
26 | | |
27 | | #include "XMLIndexTemplateContext.hxx" |
28 | | #include <xmloff/xmlimp.hxx> |
29 | | #include <xmloff/xmlnamespace.hxx> |
30 | | #include <xmloff/xmltoken.hxx> |
31 | | |
32 | | |
33 | | using ::com::sun::star::beans::XPropertySet; |
34 | | using ::com::sun::star::uno::Reference; |
35 | | using ::com::sun::star::uno::Any; |
36 | | using namespace ::xmloff::token; |
37 | | |
38 | | |
39 | | XMLIndexObjectSourceContext::XMLIndexObjectSourceContext( |
40 | | SvXMLImport& rImport, |
41 | | Reference<XPropertySet> & rPropSet) |
42 | 0 | : XMLIndexSourceBaseContext(rImport, rPropSet, UseStyles::Single), |
43 | 0 | bUseCalc(false), |
44 | 0 | bUseChart(false), |
45 | 0 | bUseDraw(false), |
46 | 0 | bUseMath(false), |
47 | 0 | bUseOtherObjects(false) |
48 | 0 | { |
49 | 0 | } |
50 | | |
51 | | XMLIndexObjectSourceContext::~XMLIndexObjectSourceContext() |
52 | 0 | { |
53 | 0 | } |
54 | | |
55 | | void XMLIndexObjectSourceContext::ProcessAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter & aIter) |
56 | 0 | { |
57 | 0 | bool bTmp(false); |
58 | |
|
59 | 0 | switch (aIter.getToken()) |
60 | 0 | { |
61 | 0 | case XML_ELEMENT(TEXT, XML_USE_OTHER_OBJECTS): |
62 | 0 | if (::sax::Converter::convertBool(bTmp, aIter.toView())) |
63 | 0 | { |
64 | 0 | bUseOtherObjects = bTmp; |
65 | 0 | } |
66 | 0 | break; |
67 | | |
68 | 0 | case XML_ELEMENT(TEXT, XML_USE_SPREADSHEET_OBJECTS): |
69 | 0 | if (::sax::Converter::convertBool(bTmp, aIter.toView())) |
70 | 0 | { |
71 | 0 | bUseCalc = bTmp; |
72 | 0 | } |
73 | 0 | break; |
74 | | |
75 | 0 | case XML_ELEMENT(TEXT, XML_USE_CHART_OBJECTS): |
76 | 0 | if (::sax::Converter::convertBool(bTmp, aIter.toView())) |
77 | 0 | { |
78 | 0 | bUseChart = bTmp; |
79 | 0 | } |
80 | 0 | break; |
81 | | |
82 | 0 | case XML_ELEMENT(TEXT, XML_USE_DRAW_OBJECTS): |
83 | 0 | if (::sax::Converter::convertBool(bTmp, aIter.toView())) |
84 | 0 | { |
85 | 0 | bUseDraw = bTmp; |
86 | 0 | } |
87 | 0 | break; |
88 | | |
89 | 0 | case XML_ELEMENT(TEXT, XML_USE_MATH_OBJECTS): |
90 | 0 | if (::sax::Converter::convertBool(bTmp, aIter.toView())) |
91 | 0 | { |
92 | 0 | bUseMath = bTmp; |
93 | 0 | } |
94 | 0 | break; |
95 | | |
96 | 0 | default: |
97 | 0 | XMLIndexSourceBaseContext::ProcessAttribute(aIter); |
98 | 0 | break; |
99 | 0 | } |
100 | 0 | } |
101 | | |
102 | | void XMLIndexObjectSourceContext::endFastElement(sal_Int32 nElement) |
103 | 0 | { |
104 | 0 | rIndexPropertySet->setPropertyValue(u"CreateFromStarCalc"_ustr, css::uno::Any(bUseCalc)); |
105 | 0 | rIndexPropertySet->setPropertyValue(u"CreateFromStarChart"_ustr, css::uno::Any(bUseChart)); |
106 | 0 | rIndexPropertySet->setPropertyValue(u"CreateFromStarDraw"_ustr, css::uno::Any(bUseDraw)); |
107 | 0 | rIndexPropertySet->setPropertyValue(u"CreateFromStarMath"_ustr, css::uno::Any(bUseMath)); |
108 | 0 | rIndexPropertySet->setPropertyValue(u"CreateFromOtherEmbeddedObjects"_ustr, css::uno::Any(bUseOtherObjects)); |
109 | |
|
110 | 0 | XMLIndexSourceBaseContext::endFastElement(nElement); |
111 | 0 | } |
112 | | |
113 | | css::uno::Reference< css::xml::sax::XFastContextHandler > XMLIndexObjectSourceContext::createFastChildContext( |
114 | | sal_Int32 nElement, |
115 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) |
116 | 0 | { |
117 | 0 | if ( nElement == XML_ELEMENT(TEXT, XML_OBJECT_INDEX_ENTRY_TEMPLATE) ) |
118 | 0 | { |
119 | 0 | return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet, |
120 | 0 | aLevelNameTableMap, |
121 | 0 | XML_TOKEN_INVALID, // no outline-level attr |
122 | 0 | aLevelStylePropNameTableMap, |
123 | 0 | aAllowedTokenTypesTable); |
124 | 0 | } |
125 | 0 | else |
126 | 0 | { |
127 | 0 | return XMLIndexSourceBaseContext::createFastChildContext(nElement, |
128 | 0 | xAttrList); |
129 | 0 | } |
130 | |
|
131 | 0 | } |
132 | | |
133 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |