LibreOffice Module xmloff (master)  1
XMLIndexObjectSourceContext.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 <rtl/ustring.hxx>
24 
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 
27 #include <sax/tools/converter.hxx>
28 
30 #include <xmloff/xmlictxt.hxx>
31 #include <xmloff/xmlimp.hxx>
32 #include <xmloff/xmlnmspe.hxx>
33 #include <xmloff/xmltoken.hxx>
34 
35 
36 using ::com::sun::star::beans::XPropertySet;
37 using ::com::sun::star::uno::Reference;
38 using ::com::sun::star::uno::Any;
39 using ::com::sun::star::xml::sax::XAttributeList;
43 
44 
46  SvXMLImport& rImport,
47  sal_uInt16 nPrfx,
48  const OUString& rLocalName,
49  Reference<XPropertySet> & rPropSet) :
50  XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName,
51  rPropSet, false),
52  bUseCalc(false),
53  bUseChart(false),
54  bUseDraw(false),
55  bUseMath(false),
56  bUseOtherObjects(false)
57 {
58 }
59 
61 {
62 }
63 
65  enum IndexSourceParamEnum eParam,
66  const OUString& rValue)
67 {
68  bool bTmp(false);
69 
70  switch (eParam)
71  {
73  if (::sax::Converter::convertBool(bTmp, rValue))
74  {
75  bUseOtherObjects = bTmp;
76  }
77  break;
78 
80  if (::sax::Converter::convertBool(bTmp, rValue))
81  {
82  bUseCalc = bTmp;
83  }
84  break;
85 
87  if (::sax::Converter::convertBool(bTmp, rValue))
88  {
89  bUseChart = bTmp;
90  }
91  break;
92 
94  if (::sax::Converter::convertBool(bTmp, rValue))
95  {
96  bUseDraw = bTmp;
97  }
98  break;
99 
101  if (::sax::Converter::convertBool(bTmp, rValue))
102  {
103  bUseMath = bTmp;
104  }
105  break;
106 
107  default:
109  break;
110  }
111 }
112 
114 {
115  rIndexPropertySet->setPropertyValue("CreateFromStarCalc", css::uno::Any(bUseCalc));
116  rIndexPropertySet->setPropertyValue("CreateFromStarChart", css::uno::Any(bUseChart));
117  rIndexPropertySet->setPropertyValue("CreateFromStarDraw", css::uno::Any(bUseDraw));
118  rIndexPropertySet->setPropertyValue("CreateFromStarMath", css::uno::Any(bUseMath));
119  rIndexPropertySet->setPropertyValue("CreateFromOtherEmbeddedObjects", css::uno::Any(bUseOtherObjects));
120 
122 }
123 
125  sal_uInt16 nPrefix,
126  const OUString& rLocalName,
127  const Reference<XAttributeList> & xAttrList )
128 {
129  if ( (XML_NAMESPACE_TEXT == nPrefix) &&
131  {
133  nPrefix, rLocalName,
135  XML_TOKEN_INVALID, // no outline-level attr
138  }
139  else
140  {
142  rLocalName,
143  xAttrList);
144  }
145 
146 }
147 
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const char * aLevelStylePropNameTableMap[]
bool IsXMLToken(const OUString &rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3422
static bool convertBool(bool &rBool, const OUString &rString)
Superclass for index source elements.
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:62
constexpr sal_uInt16 XML_NAMESPACE_TEXT
Definition: xmlnmspe.hxx:31
css::uno::Any const & rValue
Definition: ImageStyle.hxx:38
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 ProcessAttribute(enum IndexSourceParamEnum eParam, const OUString &rValue)
XMLIndexObjectSourceContext(SvXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLocalName, css::uno::Reference< css::beans::XPropertySet > &rPropSet)
const SvXMLEnumMapEntry< sal_uInt16 > * aLevelNameTableMap
Import index entry templates.
css::uno::Reference< css::beans::XPropertySet > & rIndexPropertySet
tab stops relative to margin or indent?
virtual void EndElement() override
EndElement is called before a context will be destructed, but after an elements context has been pars...
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 bool aAllowedTokenTypesTable[]