LibreOffice Module reportdesign (master)  1
xmlFormatCondition.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 #include "xmlFormatCondition.hxx"
20 #include "xmlfilter.hxx"
21 #include <xmloff/xmltoken.hxx>
22 #include <xmloff/xmlnamespace.hxx>
23 #include "xmlHelper.hxx"
24 #include <osl/diagnose.h>
25 #include <sal/log.hxx>
26 #include <tools/diagnose_ex.h>
27 
28 namespace rptxml
29 {
30  using namespace ::com::sun::star;
31  using namespace ::com::sun::star::report;
32  using namespace ::com::sun::star::uno;
33  using namespace ::com::sun::star::xml::sax;
34  using namespace ::com::sun::star::beans;
35 
36 OXMLFormatCondition::OXMLFormatCondition( ORptFilter& rImport,
37  const Reference< XFastAttributeList > & _xAttrList
38  ,const Reference< XFormatCondition > & _xComponent ) :
39  SvXMLImportContext( rImport )
40 ,m_rImport(rImport)
41 ,m_xComponent(_xComponent)
42 {
43 
44  OSL_ENSURE(m_xComponent.is(),"Component is NULL!");
45  try
46  {
47  for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
48  {
49  switch( aIter.getToken() )
50  {
51  case XML_ELEMENT(REPORT, XML_ENABLED):
52  m_xComponent->setEnabled(IsXMLToken(aIter, XML_TRUE));
53  break;
54  case XML_ELEMENT(REPORT, XML_FORMULA):
55  m_xComponent->setFormula(ORptFilter::convertFormula(aIter.toString()));
56  break;
57  case XML_ELEMENT(REPORT, XML_STYLE_NAME):
58  m_sStyleName = aIter.toString();
59  break;
60  default:
61  XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
62  break;
63  }
64  }
65  }
66  catch(Exception&)
67  {
68  TOOLS_WARN_EXCEPTION( "reportdesign", "Exception caught while filling the report definition props");
69  }
70 }
71 
72 
74 {
75 }
76 
78 {
80 }
81 
82 } // namespace rptxml
83 
84 
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OXMLFormatCondition(const OXMLFormatCondition &)=delete
SvXMLImport & GetImport()
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
css::uno::Reference< css::report::XFormatCondition > m_xComponent
virtual ~OXMLFormatCondition() override
static void copyStyleElements(const bool _bOld, const OUString &_sStyleName, const SvXMLStylesContext *_pAutoStyles, const css::uno::Reference< css::beans::XPropertySet > &_xProp)
Definition: xmlHelper.cxx:248
#define XMLOFF_WARN_UNKNOWN(area, rIter)
#define TOOLS_WARN_EXCEPTION(area, stream)
bool isOldFormat() const
Definition: xmlfilter.cxx:748
const SvXMLImport & m_rImport
#define XML_ELEMENT(prefix, name)
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
XML_TRUE
SvXMLStylesContext * GetAutoStyles()
OUString toString(OptionInfo const *info)