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)
49 rPropSet, false)
50 , nDisplayFormat(0)
51 , bSequenceOK(false)
52 , bDisplayFormatOK(false)
53 , bUseCaption(true)
54{
55}
56
58{
59}
60
62{
63
64 { XML_TEXT, ReferenceFieldPart::TEXT },
65 { XML_CATEGORY_AND_VALUE, ReferenceFieldPart::CATEGORY_AND_NUMBER },
66 { XML_CAPTION, ReferenceFieldPart::ONLY_CAPTION },
67
68 // wrong values that previous versions wrote:
69 { XML_CHAPTER, ReferenceFieldPart::CATEGORY_AND_NUMBER },
70 { XML_PAGE, ReferenceFieldPart::ONLY_CAPTION },
71
73};
74
76{
77 bool bTmp(false);
78
79 switch (aIter.getToken())
80 {
82 if (::sax::Converter::convertBool(bTmp, aIter.toView()))
83 {
84 bUseCaption = bTmp;
85 }
86 break;
87
89 sSequence = aIter.toString();
90 bSequenceOK = true;
91 break;
92
94 {
95 sal_uInt16 nTmp;
98 {
99 nDisplayFormat = nTmp;
100 bDisplayFormatOK = true;
101 }
102 break;
103 }
104
105 default:
107 break;
108 }
109}
110
112{
113 rIndexPropertySet->setPropertyValue("CreateFromLabels", css::uno::Any(bUseCaption));
114
115 if (bSequenceOK)
116 {
117 rIndexPropertySet->setPropertyValue("LabelCategory", css::uno::Any(sSequence));
118 }
119
121 {
122 rIndexPropertySet->setPropertyValue("LabelDisplayType", css::uno::Any(nDisplayFormat));
123 }
124
126}
127
128css::uno::Reference< css::xml::sax::XFastContextHandler > XMLIndexTableSourceContext::createFastChildContext(
129 sal_Int32 nElement,
130 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
131{
133 {
136 XML_TOKEN_INVALID, // no outline-level attr
139 }
140 else
141 {
143 xAttrList);
144 }
145
146}
147
148/* 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:1912
TEXT
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:97