LibreOffice Module xmloff (master) 1
XMLIndexTableSourceContext.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
20
22
23#include <com/sun/star/beans/XPropertySet.hpp>
24#include <com/sun/star/text/ReferenceFieldPart.hpp>
25
27
29#include <xmloff/xmlictxt.hxx>
30#include <xmloff/xmlimp.hxx>
32#include <xmloff/xmltoken.hxx>
33#include <xmloff/xmluconv.hxx>
34#include <xmloff/xmlement.hxx>
35#include <rtl/ustring.hxx>
36
37
38using namespace ::com::sun::star::text;
39using namespace ::xmloff::token;
40
41using ::com::sun::star::beans::XPropertySet;
42using ::com::sun::star::uno::Reference;
43using ::com::sun::star::uno::Any;
44
46 SvXMLImport& rImport, Reference<XPropertySet> & rPropSet)
47 : XMLIndexSourceBaseContext(rImport, rPropSet, UseStyles::Single)
48 , nDisplayFormat(0)
49 , bSequenceOK(false)
50 , bDisplayFormatOK(false)
51 , bUseCaption(true)
52{
53}
54
56{
57}
58
60{
61
62 { XML_TEXT, ReferenceFieldPart::TEXT },
63 { XML_CATEGORY_AND_VALUE, ReferenceFieldPart::CATEGORY_AND_NUMBER },
64 { XML_CAPTION, ReferenceFieldPart::ONLY_CAPTION },
65
66 // wrong values that previous versions wrote:
67 { XML_CHAPTER, ReferenceFieldPart::CATEGORY_AND_NUMBER },
68 { XML_PAGE, ReferenceFieldPart::ONLY_CAPTION },
69
71};
72
74{
75 bool bTmp(false);
76
77 switch (aIter.getToken())
78 {
80 if (::sax::Converter::convertBool(bTmp, aIter.toView()))
81 {
82 bUseCaption = bTmp;
83 }
84 break;
85
87 sSequence = aIter.toString();
88 bSequenceOK = true;
89 break;
90
92 {
93 sal_uInt16 nTmp;
96 {
97 nDisplayFormat = nTmp;
98 bDisplayFormatOK = true;
99 }
100 break;
101 }
102
103 default:
105 break;
106 }
107}
108
110{
111 rIndexPropertySet->setPropertyValue("CreateFromLabels", css::uno::Any(bUseCaption));
112
113 if (bSequenceOK)
114 {
115 rIndexPropertySet->setPropertyValue("LabelCategory", css::uno::Any(sSequence));
116 }
117
119 {
120 rIndexPropertySet->setPropertyValue("LabelDisplayType", css::uno::Any(nDisplayFormat));
121 }
122
124}
125
126css::uno::Reference< css::xml::sax::XFastContextHandler > XMLIndexTableSourceContext::createFastChildContext(
127 sal_Int32 nElement,
128 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
129{
131 {
134 XML_TOKEN_INVALID, // no outline-level attr
137 }
138 else
139 {
141 xAttrList);
142 }
143
144}
145
146/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvXMLEnumMapEntry< sal_uInt16 > const lcl_aReferenceTypeTokenMap[]
const char * aLevelStylePropNameTableMap[]
const bool aAllowedTokenTypesTable[]
const SvXMLEnumMapEntry< sal_uInt16 > * aLevelNameTableMap
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:60
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
convert string to enum using given enum map, if the enum is not found in the map, this method will re...
Definition: xmluconv.hxx:145
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)
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 ProcessAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &aIter) 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 ...
XMLIndexTableSourceContext(SvXMLImport &rImport, css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Import index entry templates.
static bool convertBool(bool &rBool, std::u16string_view rString)
Handling of tokens in XML:
@ XML_CAPTION_SEQUENCE_FORMAT
Definition: xmltoken.hxx:397
@ XML_CATEGORY_AND_VALUE
Definition: xmltoken.hxx:406
@ XML_CAPTION_SEQUENCE_NAME
Definition: xmltoken.hxx:398
@ XML_TABLE_INDEX_ENTRY_TEMPLATE
Definition: xmltoken.hxx:1923
TEXT
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:97