fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / xmloff / source / text / XMLIndexObjectSourceContext.cxx
blobfc4e0e5339c678824c32898ca396d4de3d405b23
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 .
21 #include "XMLIndexObjectSourceContext.hxx"
23 #include <rtl/ustring.hxx>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/container/XIndexReplace.hpp>
28 #include <sax/tools/converter.hxx>
30 #include "XMLIndexTemplateContext.hxx"
31 #include "XMLIndexTitleTemplateContext.hxx"
32 #include "XMLIndexTOCStylesContext.hxx"
33 #include <xmloff/xmlictxt.hxx>
34 #include <xmloff/xmlimp.hxx>
35 #include <xmloff/txtimp.hxx>
36 #include "xmloff/xmlnmspe.hxx"
37 #include <xmloff/nmspmap.hxx>
38 #include <xmloff/xmltoken.hxx>
41 using ::com::sun::star::beans::XPropertySet;
42 using ::com::sun::star::uno::Reference;
43 using ::com::sun::star::uno::Any;
44 using ::com::sun::star::xml::sax::XAttributeList;
45 using ::xmloff::token::IsXMLToken;
46 using ::xmloff::token::XML_OBJECT_INDEX_ENTRY_TEMPLATE;
47 using ::xmloff::token::XML_TOKEN_INVALID;
49 const sal_Char sAPI_CreateFromStarCalc[] = "CreateFromStarCalc";
50 const sal_Char sAPI_CreateFromStarChart[] = "CreateFromStarChart";
51 const sal_Char sAPI_CreateFromStarDraw[] = "CreateFromStarDraw";
52 const sal_Char sAPI_CreateFromStarImage[] = "CreateFromStarImage";
53 const sal_Char sAPI_CreateFromStarMath[] = "CreateFromStarMath";
54 const sal_Char sAPI_CreateFromOtherEmbeddedObjects[] = "CreateFromOtherEmbeddedObjects";
57 TYPEINIT1( XMLIndexObjectSourceContext, XMLIndexSourceBaseContext );
59 XMLIndexObjectSourceContext::XMLIndexObjectSourceContext(
60 SvXMLImport& rImport,
61 sal_uInt16 nPrfx,
62 const OUString& rLocalName,
63 Reference<XPropertySet> & rPropSet) :
64 XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName,
65 rPropSet, sal_False),
66 sCreateFromStarCalc(sAPI_CreateFromStarCalc),
67 sCreateFromStarChart(sAPI_CreateFromStarChart),
68 sCreateFromStarDraw(sAPI_CreateFromStarDraw),
69 sCreateFromStarMath(sAPI_CreateFromStarMath),
70 sCreateFromOtherEmbeddedObjects(sAPI_CreateFromOtherEmbeddedObjects),
71 bUseCalc(sal_False),
72 bUseChart(sal_False),
73 bUseDraw(sal_False),
74 bUseMath(sal_False),
75 bUseOtherObjects(sal_False)
79 XMLIndexObjectSourceContext::~XMLIndexObjectSourceContext()
83 void XMLIndexObjectSourceContext::ProcessAttribute(
84 enum IndexSourceParamEnum eParam,
85 const OUString& rValue)
87 bool bTmp(false);
89 switch (eParam)
91 case XML_TOK_INDEXSOURCE_USE_OTHER_OBJECTS:
92 if (::sax::Converter::convertBool(bTmp, rValue))
94 bUseOtherObjects = bTmp;
96 break;
98 case XML_TOK_INDEXSOURCE_USE_SHEET:
99 if (::sax::Converter::convertBool(bTmp, rValue))
101 bUseCalc = bTmp;
103 break;
105 case XML_TOK_INDEXSOURCE_USE_CHART:
106 if (::sax::Converter::convertBool(bTmp, rValue))
108 bUseChart = bTmp;
110 break;
112 case XML_TOK_INDEXSOURCE_USE_DRAW:
113 if (::sax::Converter::convertBool(bTmp, rValue))
115 bUseDraw = bTmp;
117 break;
119 case XML_TOK_INDEXSOURCE_USE_MATH:
120 if (::sax::Converter::convertBool(bTmp, rValue))
122 bUseMath = bTmp;
124 break;
126 default:
127 XMLIndexSourceBaseContext::ProcessAttribute(eParam, rValue);
128 break;
132 void XMLIndexObjectSourceContext::EndElement()
134 Any aAny;
136 aAny.setValue(&bUseCalc, ::getBooleanCppuType());
137 rIndexPropertySet->setPropertyValue(sCreateFromStarCalc, aAny);
139 aAny.setValue(&bUseChart, ::getBooleanCppuType());
140 rIndexPropertySet->setPropertyValue(sCreateFromStarChart, aAny);
142 aAny.setValue(&bUseDraw, ::getBooleanCppuType());
143 rIndexPropertySet->setPropertyValue(sCreateFromStarDraw, aAny);
145 aAny.setValue(&bUseMath, ::getBooleanCppuType());
146 rIndexPropertySet->setPropertyValue(sCreateFromStarMath, aAny);
148 aAny.setValue(&bUseOtherObjects, ::getBooleanCppuType());
149 rIndexPropertySet->setPropertyValue(sCreateFromOtherEmbeddedObjects, aAny);
151 XMLIndexSourceBaseContext::EndElement();
154 SvXMLImportContext* XMLIndexObjectSourceContext::CreateChildContext(
155 sal_uInt16 nPrefix,
156 const OUString& rLocalName,
157 const Reference<XAttributeList> & xAttrList )
159 if ( (XML_NAMESPACE_TEXT == nPrefix) &&
160 (IsXMLToken(rLocalName, XML_OBJECT_INDEX_ENTRY_TEMPLATE)) )
162 return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
163 nPrefix, rLocalName,
164 aLevelNameTableMap,
165 XML_TOKEN_INVALID, // no outline-level attr
166 aLevelStylePropNameTableMap,
167 aAllowedTokenTypesTable);
169 else
171 return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
172 rLocalName,
173 xAttrList);
178 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */