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 .
21 #include "XMLIndexObjectSourceContext.hxx"
23 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <sax/tools/converter.hxx>
27 #include "XMLIndexTemplateContext.hxx"
28 #include <xmloff/xmlimp.hxx>
29 #include <xmloff/xmlnamespace.hxx>
30 #include <xmloff/xmltoken.hxx>
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
;
39 XMLIndexObjectSourceContext::XMLIndexObjectSourceContext(
41 Reference
<XPropertySet
> & rPropSet
)
42 : XMLIndexSourceBaseContext(rImport
, rPropSet
, UseStyles::Single
),
47 bUseOtherObjects(false)
51 XMLIndexObjectSourceContext::~XMLIndexObjectSourceContext()
55 void XMLIndexObjectSourceContext::ProcessAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter
& aIter
)
59 switch (aIter
.getToken())
61 case XML_ELEMENT(TEXT
, XML_USE_OTHER_OBJECTS
):
62 if (::sax::Converter::convertBool(bTmp
, aIter
.toView()))
64 bUseOtherObjects
= bTmp
;
68 case XML_ELEMENT(TEXT
, XML_USE_SPREADSHEET_OBJECTS
):
69 if (::sax::Converter::convertBool(bTmp
, aIter
.toView()))
75 case XML_ELEMENT(TEXT
, XML_USE_CHART_OBJECTS
):
76 if (::sax::Converter::convertBool(bTmp
, aIter
.toView()))
82 case XML_ELEMENT(TEXT
, XML_USE_DRAW_OBJECTS
):
83 if (::sax::Converter::convertBool(bTmp
, aIter
.toView()))
89 case XML_ELEMENT(TEXT
, XML_USE_MATH_OBJECTS
):
90 if (::sax::Converter::convertBool(bTmp
, aIter
.toView()))
97 XMLIndexSourceBaseContext::ProcessAttribute(aIter
);
102 void XMLIndexObjectSourceContext::endFastElement(sal_Int32 nElement
)
104 rIndexPropertySet
->setPropertyValue(u
"CreateFromStarCalc"_ustr
, css::uno::Any(bUseCalc
));
105 rIndexPropertySet
->setPropertyValue(u
"CreateFromStarChart"_ustr
, css::uno::Any(bUseChart
));
106 rIndexPropertySet
->setPropertyValue(u
"CreateFromStarDraw"_ustr
, css::uno::Any(bUseDraw
));
107 rIndexPropertySet
->setPropertyValue(u
"CreateFromStarMath"_ustr
, css::uno::Any(bUseMath
));
108 rIndexPropertySet
->setPropertyValue(u
"CreateFromOtherEmbeddedObjects"_ustr
, css::uno::Any(bUseOtherObjects
));
110 XMLIndexSourceBaseContext::endFastElement(nElement
);
113 css::uno::Reference
< css::xml::sax::XFastContextHandler
> XMLIndexObjectSourceContext::createFastChildContext(
115 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
)
117 if ( nElement
== XML_ELEMENT(TEXT
, XML_OBJECT_INDEX_ENTRY_TEMPLATE
) )
119 return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet
,
121 XML_TOKEN_INVALID
, // no outline-level attr
122 aLevelStylePropNameTableMap
,
123 aAllowedTokenTypesTable
);
127 return XMLIndexSourceBaseContext::createFastChildContext(nElement
,
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */