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>
22 #include <sax/tools/converter.hxx>
24 #include <xmloff/xmlictxt.hxx>
25 #include <xmloff/xmlimp.hxx>
26 #include <xmloff/xmlnamespace.hxx>
27 #include <xmloff/xmltoken.hxx>
28 #include <rtl/ustring.hxx>
29 
30 
31 using ::com::sun::star::beans::XPropertySet;
32 using ::com::sun::star::uno::Reference;
33 using ::com::sun::star::uno::Any;
34 using ::com::sun::star::xml::sax::XAttributeList;
38 
40  SvXMLImport& rImport,
41  sal_uInt16 nPrfx,
42  const OUString& rLocalName,
43  Reference<XPropertySet> & rPropSet) :
44  XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName,
45  rPropSet, true),
46  bUseObjects(false),
47  bUseGraphic(false),
48  bUseMarks(false),
49  bUseTables(false),
50  bUseFrames(false),
51  bUseLevelFromSource(false),
52  bUseLevelParagraphStyles(false)
53 {
54 }
55 
57 {
58 }
59 
61  enum IndexSourceParamEnum eParam,
62  const OUString& rValue)
63 {
64  bool bTmp(false);
65 
66  switch (eParam)
67  {
69  if (::sax::Converter::convertBool(bTmp, rValue))
70  {
71  bUseMarks = bTmp;
72  }
73  break;
74 
76  if (::sax::Converter::convertBool(bTmp, rValue))
77  {
78  bUseObjects = bTmp;
79  }
80  break;
81 
83  if (::sax::Converter::convertBool(bTmp, rValue))
84  {
85  bUseGraphic = bTmp;
86  }
87  break;
88 
90  if (::sax::Converter::convertBool(bTmp, rValue))
91  {
92  bUseTables = bTmp;
93  }
94  break;
95 
97  if (::sax::Converter::convertBool(bTmp, rValue))
98  {
99  bUseFrames = bTmp;
100  }
101  break;
102 
104  if (::sax::Converter::convertBool(bTmp, rValue))
105  {
106  bUseLevelFromSource = bTmp;
107  }
108  break;
109 
111  if (::sax::Converter::convertBool(bTmp, rValue))
112  {
114  }
115  break;
116 
118  sIndexName = rValue;
119  break;
120 
121  default:
123  break;
124  }
125 }
126 
128 {
129  rIndexPropertySet->setPropertyValue("CreateFromEmbeddedObjects", css::uno::Any(bUseObjects));
130  rIndexPropertySet->setPropertyValue("CreateFromGraphicObjects", css::uno::Any(bUseGraphic));
131  rIndexPropertySet->setPropertyValue("UseLevelFromSource", css::uno::Any(bUseLevelFromSource));
132  rIndexPropertySet->setPropertyValue("CreateFromMarks", css::uno::Any(bUseMarks));
133  rIndexPropertySet->setPropertyValue("CreateFromTables", css::uno::Any(bUseTables));
134  rIndexPropertySet->setPropertyValue("CreateFromTextFrames", css::uno::Any(bUseFrames));
135  rIndexPropertySet->setPropertyValue("CreateFromLevelParagraphStyles", css::uno::Any(bUseLevelParagraphStyles));
136 
137  if( !sIndexName.isEmpty() )
138  {
139  rIndexPropertySet->setPropertyValue("UserIndexName", css::uno::Any(sIndexName));
140  }
141 
143 }
144 
146  sal_uInt16 nPrefix,
147  const OUString& rLocalName,
148  const Reference<XAttributeList> & xAttrList )
149 {
150  if ( (XML_NAMESPACE_TEXT == nPrefix) &&
152  {
154  nPrefix, rLocalName,
159  }
160  else
161  {
163  rLocalName,
164  xAttrList);
165  }
166 
167 }
168 
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsXMLToken(const OUString &rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3434
static bool convertBool(bool &rBool, const OUString &rString)
const char * aLevelStylePropNameTOCMap[]
Superclass for index source elements.
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:62
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Create a children element context.
css::uno::Any const & rValue
Definition: ImageStyle.hxx:38
virtual ~XMLIndexUserSourceContext() override
const bool aAllowedTokenTypesUser[]
virtual void EndElement() override
EndElement is called before a context will be destructed, but after an elements context has been pars...
constexpr sal_uInt16 XML_NAMESPACE_TEXT
virtual void ProcessAttribute(enum IndexSourceParamEnum eParam, const OUString &rValue)
XMLIndexUserSourceContext(SvXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLocalName, css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Import index entry templates.
css::uno::Reference< css::beans::XPropertySet > & rIndexPropertySet
tab stops relative to margin or indent?
virtual void ProcessAttribute(enum IndexSourceParamEnum eParam, const OUString &rValue) override
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Create a children element context.
virtual void EndElement() override
EndElement is called before a context will be destructed, but after an elements context has been pars...
const SvXMLEnumMapEntry< sal_uInt16 > aSvLevelNameTOCMap[]