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