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;
44using ::com::sun::star::xml::sax::XAttributeList;
45
47 SvXMLImport& rImport, Reference<XPropertySet> & rPropSet)
48 : XMLIndexSourceBaseContext(rImport, rPropSet, UseStyles::Single)
49 , nDisplayFormat(0)
50 , bSequenceOK(false)
51 , bDisplayFormatOK(false)
52 , bUseCaption(true)
53{
54}
55
57{
58}
59
61{
62
63 { XML_TEXT, ReferenceFieldPart::TEXT },
64 { XML_CATEGORY_AND_VALUE, ReferenceFieldPart::CATEGORY_AND_NUMBER },
65 { XML_CAPTION, ReferenceFieldPart::ONLY_CAPTION },
66
67 // wrong values that previous versions wrote:
68 { XML_CHAPTER, ReferenceFieldPart::CATEGORY_AND_NUMBER },
69 { XML_PAGE, ReferenceFieldPart::ONLY_CAPTION },
70
72};
73
75{
76 bool bTmp(false);
77
78 switch (aIter.getToken())
79 {
81 if (::sax::Converter::convertBool(bTmp, aIter.toView()))
82 {
83 bUseCaption = bTmp;
84 }
85 break;
86
88 sSequence = aIter.toString();
89 bSequenceOK = true;
90 break;
91
93 {
94 sal_uInt16 nTmp;
97 {
98 nDisplayFormat = nTmp;
99 bDisplayFormatOK = true;
100 }
101 break;
102 }
103
104 default:
106 break;
107 }
108}
109
111{
112 rIndexPropertySet->setPropertyValue("CreateFromLabels", css::uno::Any(bUseCaption));
113
114 if (bSequenceOK)
115 {
116 rIndexPropertySet->setPropertyValue("LabelCategory", css::uno::Any(sSequence));
117 }
118
120 {
121 rIndexPropertySet->setPropertyValue("LabelDisplayType", css::uno::Any(nDisplayFormat));
122 }
123
125}
126
127css::uno::Reference< css::xml::sax::XFastContextHandler > XMLIndexTableSourceContext::createFastChildContext(
128 sal_Int32 nElement,
129 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
130{
132 {
135 XML_TOKEN_INVALID, // no outline-level attr
138 }
139 else
140 {
142 xAttrList);
143 }
144
145}
146
147/* 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:395
@ XML_CATEGORY_AND_VALUE
Definition: xmltoken.hxx:404
@ XML_CAPTION_SEQUENCE_NAME
Definition: xmltoken.hxx:396
@ XML_TABLE_INDEX_ENTRY_TEMPLATE
Definition: xmltoken.hxx:1918
TEXT
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:97