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 <rtl/ustring.hxx>
25 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <sax/tools/converter.hxx>
29 #include "XMLIndexTemplateContext.hxx"
30 #include <xmloff/xmlictxt.hxx>
31 #include <xmloff/xmlimp.hxx>
32 #include <xmloff/xmlnamespace.hxx>
33 #include <xmloff/xmltoken.hxx>
36 using ::com::sun::star::beans::XPropertySet
;
37 using ::com::sun::star::uno::Reference
;
38 using ::com::sun::star::uno::Any
;
39 using namespace ::xmloff::token
;
42 XMLIndexObjectSourceContext::XMLIndexObjectSourceContext(
44 Reference
<XPropertySet
> & rPropSet
)
45 : XMLIndexSourceBaseContext(rImport
, rPropSet
, UseStyles::Single
),
50 bUseOtherObjects(false)
54 XMLIndexObjectSourceContext::~XMLIndexObjectSourceContext()
58 void XMLIndexObjectSourceContext::ProcessAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter
& aIter
)
62 switch (aIter
.getToken())
64 case XML_ELEMENT(TEXT
, XML_USE_OTHER_OBJECTS
):
65 if (::sax::Converter::convertBool(bTmp
, aIter
.toView()))
67 bUseOtherObjects
= bTmp
;
71 case XML_ELEMENT(TEXT
, XML_USE_SPREADSHEET_OBJECTS
):
72 if (::sax::Converter::convertBool(bTmp
, aIter
.toView()))
78 case XML_ELEMENT(TEXT
, XML_USE_CHART_OBJECTS
):
79 if (::sax::Converter::convertBool(bTmp
, aIter
.toView()))
85 case XML_ELEMENT(TEXT
, XML_USE_DRAW_OBJECTS
):
86 if (::sax::Converter::convertBool(bTmp
, aIter
.toView()))
92 case XML_ELEMENT(TEXT
, XML_USE_MATH_OBJECTS
):
93 if (::sax::Converter::convertBool(bTmp
, aIter
.toView()))
100 XMLIndexSourceBaseContext::ProcessAttribute(aIter
);
105 void XMLIndexObjectSourceContext::endFastElement(sal_Int32 nElement
)
107 rIndexPropertySet
->setPropertyValue("CreateFromStarCalc", css::uno::Any(bUseCalc
));
108 rIndexPropertySet
->setPropertyValue("CreateFromStarChart", css::uno::Any(bUseChart
));
109 rIndexPropertySet
->setPropertyValue("CreateFromStarDraw", css::uno::Any(bUseDraw
));
110 rIndexPropertySet
->setPropertyValue("CreateFromStarMath", css::uno::Any(bUseMath
));
111 rIndexPropertySet
->setPropertyValue("CreateFromOtherEmbeddedObjects", css::uno::Any(bUseOtherObjects
));
113 XMLIndexSourceBaseContext::endFastElement(nElement
);
116 css::uno::Reference
< css::xml::sax::XFastContextHandler
> XMLIndexObjectSourceContext::createFastChildContext(
118 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
)
120 if ( nElement
== XML_ELEMENT(TEXT
, XML_OBJECT_INDEX_ENTRY_TEMPLATE
) )
122 return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet
,
124 XML_TOKEN_INVALID
, // no outline-level attr
125 aLevelStylePropNameTableMap
,
126 aAllowedTokenTypesTable
);
130 return XMLIndexSourceBaseContext::createFastChildContext(nElement
,
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */