LibreOffice Module reportdesign (master)  1
xmlCondPrtExpr.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 "xmlCondPrtExpr.hxx"
20 #include "xmlfilter.hxx"
21 #include <xmloff/xmltoken.hxx>
22 #include <xmloff/xmlnamespace.hxx>
23 #include <strings.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 report;
32  using namespace uno;
33  using namespace xml::sax;
34 
35 OXMLCondPrtExpr::OXMLCondPrtExpr( ORptFilter& _rImport
36  ,const uno::Reference< xml::sax::XFastAttributeList > & _xAttrList
37  ,const Reference< XPropertySet > & _xComponent ) :
38  SvXMLImportContext( _rImport )
39 ,m_xComponent(_xComponent)
40 {
41  OSL_ENSURE(m_xComponent.is(),"Component is NULL!");
42  try
43  {
44  for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
45  {
46  switch( aIter.getToken() )
47  {
48  case XML_ELEMENT(REPORT, XML_FORMULA):
50  break;
51  default:
52  XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
53  break;
54  }
55 
56  }
57  }
58  catch(const Exception&)
59  {
60  TOOLS_WARN_EXCEPTION( "reportdesign", "Exception caught while putting Function props!");
61  }
62 }
63 
64 
66 {
67 }
68 
69 
70 void OXMLCondPrtExpr::characters( const OUString& rChars )
71 {
72  m_aCharBuffer.append(rChars);
73 }
74 
76 {
77  if (m_aCharBuffer.getLength())
78  m_xComponent->setPropertyValue(PROPERTY_CONDITIONALPRINTEXPRESSION,makeAny(m_aCharBuffer.makeStringAndClear()));
79 }
80 
81 } // namespace rptxml
82 
83 
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUStringBuffer m_aCharBuffer
css::uno::Reference< css::beans::XPropertySet > m_xComponent
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
virtual ~OXMLCondPrtExpr() override
#define XMLOFF_WARN_UNKNOWN(area, rIter)
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
css::uno::Reference< css::report::XReportComponent > m_xComponent
#define TOOLS_WARN_EXCEPTION(area, stream)
OXMLCondPrtExpr(const OXMLCondPrtExpr &)=delete
bool setPropertyValue(uno::Sequence< beans::PropertyValue > &aProp, const OUString &aName, const uno::Any &aValue)
#define XML_ELEMENT(prefix, name)
virtual void SAL_CALL characters(const OUString &rChars) override
#define PROPERTY_CONDITIONALPRINTEXPRESSION
Definition: strings.hxx:110
OUString toString(OptionInfo const *info)
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)