LibreOffice Module xmloff (master) 1
XMLIndexUserSourceContext.cxx
Go to the documentation of this file.
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
21#include <com/sun/star/beans/XPropertySet.hpp>
24#include <xmloff/xmlictxt.hxx>
25#include <xmloff/xmlimp.hxx>
27#include <xmloff/xmltoken.hxx>
28#include <rtl/ustring.hxx>
29
30
31using ::com::sun::star::beans::XPropertySet;
32using ::com::sun::star::uno::Reference;
33using ::com::sun::star::uno::Any;
34using namespace ::xmloff::token;
35
37 SvXMLImport& rImport,
38 Reference<XPropertySet> & rPropSet)
39 : XMLIndexSourceBaseContext(rImport, rPropSet, UseStyles::Level),
40 bUseObjects(false),
41 bUseGraphic(false),
42 bUseMarks(false),
43 bUseTables(false),
44 bUseFrames(false),
45 bUseLevelFromSource(false),
46 bUseLevelParagraphStyles(false)
47{
48}
49
51{
52}
53
55{
56 bool bTmp(false);
57
58 switch (aIter.getToken())
59 {
61 if (::sax::Converter::convertBool(bTmp, aIter.toView()))
62 {
63 bUseMarks = bTmp;
64 }
65 break;
66
68 if (::sax::Converter::convertBool(bTmp, aIter.toView()))
69 {
70 bUseObjects = bTmp;
71 }
72 break;
73
75 if (::sax::Converter::convertBool(bTmp, aIter.toView()))
76 {
77 bUseGraphic = bTmp;
78 }
79 break;
80
82 if (::sax::Converter::convertBool(bTmp, aIter.toView()))
83 {
84 bUseTables = bTmp;
85 }
86 break;
87
89 if (::sax::Converter::convertBool(bTmp, aIter.toView()))
90 {
91 bUseFrames = bTmp;
92 }
93 break;
94
96 if (::sax::Converter::convertBool(bTmp, aIter.toView()))
97 {
99 }
100 break;
101
103 if (::sax::Converter::convertBool(bTmp, aIter.toView()))
104 {
106 }
107 break;
108
110 sIndexName = aIter.toString();
111 break;
112
113 default:
115 break;
116 }
117}
118
120{
121 rIndexPropertySet->setPropertyValue("CreateFromEmbeddedObjects", css::uno::Any(bUseObjects));
122 rIndexPropertySet->setPropertyValue("CreateFromGraphicObjects", css::uno::Any(bUseGraphic));
123 rIndexPropertySet->setPropertyValue("UseLevelFromSource", css::uno::Any(bUseLevelFromSource));
124 rIndexPropertySet->setPropertyValue("CreateFromMarks", css::uno::Any(bUseMarks));
125 rIndexPropertySet->setPropertyValue("CreateFromTables", css::uno::Any(bUseTables));
126 rIndexPropertySet->setPropertyValue("CreateFromTextFrames", css::uno::Any(bUseFrames));
127 rIndexPropertySet->setPropertyValue("CreateFromLevelParagraphStyles", css::uno::Any(bUseLevelParagraphStyles));
128
129 if( !sIndexName.isEmpty() )
130 {
131 rIndexPropertySet->setPropertyValue("UserIndexName", css::uno::Any(sIndexName));
132 }
133
135}
136
137css::uno::Reference< css::xml::sax::XFastContextHandler > XMLIndexUserSourceContext::createFastChildContext(
138 sal_Int32 nElement,
139 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
140{
142 {
148 }
149 else
150 {
152 xAttrList);
153 }
154
155}
156
157/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const char * aLevelStylePropNameTOCMap[]
const bool aAllowedTokenTypesUser[]
const SvXMLEnumMapEntry< sal_uInt16 > aSvLevelNameTOCMap[]
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:60
Superclass for index source elements.
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
css::uno::Reference< css::beans::XPropertySet > & rIndexPropertySet
tab stops relative to margin or indent?
virtual void ProcessAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &aIter)
Import index entry templates.
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
XMLIndexUserSourceContext(SvXMLImport &rImport, css::uno::Reference< css::beans::XPropertySet > &rPropSet)
virtual ~XMLIndexUserSourceContext() override
virtual void ProcessAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &aIter) override
static bool convertBool(bool &rBool, std::u16string_view rString)
Handling of tokens in XML:
@ XML_USE_FLOATING_FRAMES
Definition: xmltoken.hxx:2070
@ XML_COPY_OUTLINE_LEVELS
Definition: xmltoken.hxx:523
@ XML_USE_INDEX_SOURCE_STYLES
Definition: xmltoken.hxx:2074
@ XML_USER_INDEX_ENTRY_TEMPLATE
Definition: xmltoken.hxx:2093
TEXT
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:97